@treasuredata/tdx 2026.9.3 → 2026.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/ai-usage-command-base.js +1 -1
  11. package/dist/commands/api-command.js +1 -1
  12. package/dist/commands/auth-command.d.ts.map +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-command.js.map +1 -1
  15. package/dist/commands/cas-command.js +1 -1
  16. package/dist/commands/cas-journey-command.d.ts +34 -0
  17. package/dist/commands/cas-journey-command.d.ts.map +1 -0
  18. package/dist/commands/cas-journey-command.js +1 -0
  19. package/dist/commands/cas-journey-command.js.map +1 -0
  20. package/dist/commands/cas-segment-command.js +1 -1
  21. package/dist/commands/chat-command.js +1 -1
  22. package/dist/commands/claude-command.d.ts.map +1 -1
  23. package/dist/commands/claude-command.js +1 -1
  24. package/dist/commands/claude-command.js.map +1 -1
  25. package/dist/commands/claude-statusline-command.js +1 -1
  26. package/dist/commands/claude-usage-command.js +1 -1
  27. package/dist/commands/codex-command.d.ts.map +1 -1
  28. package/dist/commands/codex-command.js +1 -1
  29. package/dist/commands/codex-command.js.map +1 -1
  30. package/dist/commands/command.js +1 -1
  31. package/dist/commands/connection-command.js +1 -1
  32. package/dist/commands/databases.js +1 -1
  33. package/dist/commands/delivery-command.js +1 -1
  34. package/dist/commands/describe.js +1 -1
  35. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  36. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  37. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  38. package/dist/commands/engage-campaign-pull-command.js +1 -1
  39. package/dist/commands/engage-campaign-push-command.js +1 -1
  40. package/dist/commands/engage-campaign-readiness-command.js +1 -1
  41. package/dist/commands/engage-campaign-validate-command.js +1 -1
  42. package/dist/commands/engage-command.js +1 -1
  43. package/dist/commands/engage-in-browser-message-command.js +1 -1
  44. package/dist/commands/engage-landing-page-command.js +1 -1
  45. package/dist/commands/engage-template-pull-command.js +1 -1
  46. package/dist/commands/engage-template-push-command.js +1 -1
  47. package/dist/commands/engage-template-validate-command.js +1 -1
  48. package/dist/commands/engage-workspace-assignment-command.js +1 -1
  49. package/dist/commands/job-command.js +1 -1
  50. package/dist/commands/journey-command.d.ts +46 -0
  51. package/dist/commands/journey-command.d.ts.map +1 -1
  52. package/dist/commands/journey-command.js +1 -1
  53. package/dist/commands/journey-command.js.map +1 -1
  54. package/dist/commands/journey-validate-command.js +1 -1
  55. package/dist/commands/llm-command.js +1 -1
  56. package/dist/commands/mcp-command.js +1 -1
  57. package/dist/commands/opencode-command.d.ts +25 -0
  58. package/dist/commands/opencode-command.d.ts.map +1 -1
  59. package/dist/commands/opencode-command.js +1 -1
  60. package/dist/commands/opencode-command.js.map +1 -1
  61. package/dist/commands/opencode-usage-command.js +1 -1
  62. package/dist/commands/p13n-command.js +1 -1
  63. package/dist/commands/parent-segment-command.js +1 -1
  64. package/dist/commands/policy-command.js +1 -1
  65. package/dist/commands/profile-command.js +1 -1
  66. package/dist/commands/profiles-command.js +1 -1
  67. package/dist/commands/query-command.js +1 -1
  68. package/dist/commands/schedule-command.js +1 -1
  69. package/dist/commands/segment-command.js +1 -1
  70. package/dist/commands/segment-create-command.js +1 -1
  71. package/dist/commands/segment-fields-command.js +1 -1
  72. package/dist/commands/segment-move-command.js +1 -1
  73. package/dist/commands/segment-pull-command.js +1 -1
  74. package/dist/commands/segment-push-command.js +1 -1
  75. package/dist/commands/segment-update-command.js +1 -1
  76. package/dist/commands/segment-use-command.js +1 -1
  77. package/dist/commands/segment-validate-command.js +1 -1
  78. package/dist/commands/segments.js +1 -1
  79. package/dist/commands/show.js +1 -1
  80. package/dist/commands/status-command.js +1 -1
  81. package/dist/commands/table-deleted.js +1 -1
  82. package/dist/commands/tables.js +1 -1
  83. package/dist/commands/unset-command.js +1 -1
  84. package/dist/commands/upgrade-command.js +1 -1
  85. package/dist/commands/use-command.js +1 -1
  86. package/dist/commands/user-command.js +1 -1
  87. package/dist/commands/work-command.js +1 -1
  88. package/dist/commands/workflow-command.js +1 -1
  89. package/dist/core/auth.d.ts +10 -1
  90. package/dist/core/auth.d.ts.map +1 -1
  91. package/dist/core/auth.js +1 -1
  92. package/dist/core/auth.js.map +1 -1
  93. package/dist/core/command-output.js +1 -1
  94. package/dist/core/config.js +1 -1
  95. package/dist/core/connection-cache.js +1 -1
  96. package/dist/core/constants.js +1 -1
  97. package/dist/core/credential-cache.js +1 -1
  98. package/dist/core/global-context.js +1 -1
  99. package/dist/core/keychain.js +1 -1
  100. package/dist/core/oauth-keychain.js +1 -1
  101. package/dist/core/oauth.js +1 -1
  102. package/dist/core/profile.js +1 -1
  103. package/dist/core/project-config.js +1 -1
  104. package/dist/core/session.js +1 -1
  105. package/dist/core/site-mismatch.js +1 -1
  106. package/dist/core/user-cache.js +1 -1
  107. package/dist/core/version.js +1 -1
  108. package/dist/index.js +1 -1
  109. package/dist/mcp/server.js +1 -1
  110. package/dist/mcp/tools/index.js +1 -1
  111. package/dist/mcp/tools/tdx-run.js +1 -1
  112. package/dist/mcp/tools/tdx-search.js +1 -1
  113. package/dist/mcp/tools/work-create-item.js +1 -1
  114. package/dist/mcp/utils.js +1 -1
  115. package/dist/proxy/claude-usage-tracker.js +1 -1
  116. package/dist/proxy/passthrough-server.d.ts +2 -0
  117. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  118. package/dist/proxy/passthrough-server.js +1 -1
  119. package/dist/proxy/passthrough-server.js.map +1 -1
  120. package/dist/proxy/sse-usage-parser.js +1 -1
  121. package/dist/sdk/agent/agent-config.js +1 -1
  122. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  123. package/dist/sdk/agent/agent-yaml.js +1 -1
  124. package/dist/sdk/agent/test/evaluator.js +1 -1
  125. package/dist/sdk/agent/test/executor.js +1 -1
  126. package/dist/sdk/agent/test/index.js +1 -1
  127. package/dist/sdk/agent/test/output.js +1 -1
  128. package/dist/sdk/agent/test/parser.js +1 -1
  129. package/dist/sdk/agent/tool-target-registry.js +1 -1
  130. package/dist/sdk/api.js +1 -1
  131. package/dist/sdk/auth-token.js +1 -1
  132. package/dist/sdk/cas/audience-context.d.ts +33 -0
  133. package/dist/sdk/cas/audience-context.d.ts.map +1 -0
  134. package/dist/sdk/cas/audience-context.js +1 -0
  135. package/dist/sdk/cas/audience-context.js.map +1 -0
  136. package/dist/sdk/cas/cas-api-client.js +1 -1
  137. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  138. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  139. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  140. package/dist/sdk/cas/cas-segment-schema.js +1 -1
  141. package/dist/sdk/cas/cas-segment-validator.js +1 -1
  142. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  143. package/dist/sdk/cas/index.d.ts +8 -0
  144. package/dist/sdk/cas/index.d.ts.map +1 -1
  145. package/dist/sdk/cas/index.js +1 -1
  146. package/dist/sdk/cas/index.js.map +1 -1
  147. package/dist/sdk/cas/pull-workflow.js +1 -1
  148. package/dist/sdk/cas/push-workflow.js +1 -1
  149. package/dist/sdk/cas/validate-files.js +1 -1
  150. package/dist/sdk/client/cdp-api-client.js +1 -1
  151. package/dist/sdk/client/delivery-api-client.js +1 -1
  152. package/dist/sdk/client/endpoints.js +1 -1
  153. package/dist/sdk/client/engage-api-client.js +1 -1
  154. package/dist/sdk/client/http-client.js +1 -1
  155. package/dist/sdk/client/llm-api-client.js +1 -1
  156. package/dist/sdk/client/oauth-refresh.js +1 -1
  157. package/dist/sdk/client/p13n-studio-api-client.js +1 -1
  158. package/dist/sdk/client/rate-limiter.js +1 -1
  159. package/dist/sdk/client/td-api-client.js +1 -1
  160. package/dist/sdk/client/trino-api-client.js +1 -1
  161. package/dist/sdk/client/workflow-client.js +1 -1
  162. package/dist/sdk/connection-validator.js +1 -1
  163. package/dist/sdk/connection.js +1 -1
  164. package/dist/sdk/delivery.js +1 -1
  165. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  166. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  167. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  168. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  169. package/dist/sdk/engage/campaign-pull.js +1 -1
  170. package/dist/sdk/engage/campaign-push.js +1 -1
  171. package/dist/sdk/engage/campaign-readiness-workflow.js +1 -1
  172. package/dist/sdk/engage/campaign-readiness.js +1 -1
  173. package/dist/sdk/engage/campaign-validator.js +1 -1
  174. package/dist/sdk/engage/campaign-yaml.js +1 -1
  175. package/dist/sdk/engage/in-browser-message-pull.js +1 -1
  176. package/dist/sdk/engage/in-browser-message-push.js +1 -1
  177. package/dist/sdk/engage/in-browser-message-validator.js +1 -1
  178. package/dist/sdk/engage/in-browser-message-yaml.js +1 -1
  179. package/dist/sdk/engage/landing-page-init.js +1 -1
  180. package/dist/sdk/engage/landing-page-public-asset.js +1 -1
  181. package/dist/sdk/engage/landing-page-pull.js +1 -1
  182. package/dist/sdk/engage/landing-page-push.js +1 -1
  183. package/dist/sdk/engage/landing-page-static-site.js +1 -1
  184. package/dist/sdk/engage/landing-page-validator.js +1 -1
  185. package/dist/sdk/engage/landing-page-workspace.js +1 -1
  186. package/dist/sdk/engage/landing-page-yaml.js +1 -1
  187. package/dist/sdk/engage/list-campaign-schema.js +1 -1
  188. package/dist/sdk/engage/list-campaign-yaml.js +1 -1
  189. package/dist/sdk/engage/template-pull.js +1 -1
  190. package/dist/sdk/engage/template-push.js +1 -1
  191. package/dist/sdk/engage/template-validator.js +1 -1
  192. package/dist/sdk/engage/template-yaml.js +1 -1
  193. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  194. package/dist/sdk/engage/types/campaign-def.js +1 -1
  195. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  196. package/dist/sdk/engage/types/in-browser-message-schema.js +1 -1
  197. package/dist/sdk/engage/types/landing-page-schema.js +1 -1
  198. package/dist/sdk/engage/types/template-schema.js +1 -1
  199. package/dist/sdk/engage/workspace-assignments.js +1 -1
  200. package/dist/sdk/engage.js +1 -1
  201. package/dist/sdk/errors.js +1 -1
  202. package/dist/sdk/index.js +1 -1
  203. package/dist/sdk/io/index.js +1 -1
  204. package/dist/sdk/io/node-filesystem.js +1 -1
  205. package/dist/sdk/job.js +1 -1
  206. package/dist/sdk/journey.d.ts +4 -1
  207. package/dist/sdk/journey.d.ts.map +1 -1
  208. package/dist/sdk/journey.js +1 -1
  209. package/dist/sdk/journey.js.map +1 -1
  210. package/dist/sdk/llm/chat-cache.js +1 -1
  211. package/dist/sdk/llm/index.js +1 -1
  212. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  213. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  214. package/dist/sdk/llm/model-factors.js +1 -1
  215. package/dist/sdk/llm/model-factors.js.map +1 -1
  216. package/dist/sdk/llm/user-settings.js +1 -1
  217. package/dist/sdk/p13n-studio-errors.js +1 -1
  218. package/dist/sdk/p13n-studio.js +1 -1
  219. package/dist/sdk/personalization.js +1 -1
  220. package/dist/sdk/policy.js +1 -1
  221. package/dist/sdk/query/deleted-table-validation.js +1 -1
  222. package/dist/sdk/query/index.js +1 -1
  223. package/dist/sdk/query/sql-parser.js +1 -1
  224. package/dist/sdk/realtime.js +1 -1
  225. package/dist/sdk/schedule.js +1 -1
  226. package/dist/sdk/segment/audience-context.js +1 -1
  227. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  228. package/dist/sdk/segment/fields-display.js +1 -1
  229. package/dist/sdk/segment/file-discovery.js +1 -1
  230. package/dist/sdk/segment/journey-utils.js +1 -1
  231. package/dist/sdk/segment/journey-validator.js +1 -1
  232. package/dist/sdk/segment/journey-yaml.js +1 -1
  233. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  234. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  235. package/dist/sdk/segment/pull-workflow.js +1 -1
  236. package/dist/sdk/segment/push-recovery.js +1 -1
  237. package/dist/sdk/segment/push-workflow.js +1 -1
  238. package/dist/sdk/segment/resolution-context.js +1 -1
  239. package/dist/sdk/segment/segment-path-parser.js +1 -1
  240. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  241. package/dist/sdk/segment/segment-validator.js +1 -1
  242. package/dist/sdk/segment/target-resolution.js +1 -1
  243. package/dist/sdk/segment/tdx-config.js +1 -1
  244. package/dist/sdk/segment/types/activation-schema.js +1 -1
  245. package/dist/sdk/segment/types/journey-def.js +1 -1
  246. package/dist/sdk/segment/types/journey-schema.js +1 -1
  247. package/dist/sdk/segment/types/segment-def.js +1 -1
  248. package/dist/sdk/segment/types/segment-schema.js +1 -1
  249. package/dist/sdk/segment/validate-files.js +1 -1
  250. package/dist/sdk/segment/yaml-validator.js +1 -1
  251. package/dist/sdk/segment.js +1 -1
  252. package/dist/sdk/types/index.js +1 -1
  253. package/dist/sdk/types/progress.js +1 -1
  254. package/dist/sdk/types/workspace.js +1 -1
  255. package/dist/sdk/user.js +1 -1
  256. package/dist/sdk/util/format-detector.js +1 -1
  257. package/dist/sdk/util/formatters.js +1 -1
  258. package/dist/sdk/util/index.js +1 -1
  259. package/dist/sdk/util/paginate.js +1 -1
  260. package/dist/sdk/util/tree-formatter.js +1 -1
  261. package/dist/sdk/util/tree-search.js +1 -1
  262. package/dist/sdk/workflow/archive-validation.js +1 -1
  263. package/dist/sdk/workflow/clone-workflow.js +1 -1
  264. package/dist/sdk/workflow/index.js +1 -1
  265. package/dist/sdk/workflow/pull-workflow.js +1 -1
  266. package/dist/sdk/workflow/push-workflow.js +1 -1
  267. package/dist/sdk/workflow/task-graph.js +1 -1
  268. package/dist/sdk/workflow/tdx-config.js +1 -1
  269. package/dist/sdk/workflow/workflow-utils.js +1 -1
  270. package/dist/sdk/workspace/access-tracker.js +1 -1
  271. package/dist/sdk/workspace/frontmatter.js +1 -1
  272. package/dist/sdk/workspace/git.js +1 -1
  273. package/dist/sdk/workspace/index.js +1 -1
  274. package/dist/sdk/workspace/templates.js +1 -1
  275. package/dist/sdk/workspace/weekly.js +1 -1
  276. package/dist/sdk/workspace/wikilinks.js +1 -1
  277. package/dist/test-utils/command-runner.js +1 -1
  278. package/dist/test-utils/factories.js +1 -1
  279. package/dist/test-utils/fixtures.js +1 -1
  280. package/dist/test-utils/http-mock.js +1 -1
  281. package/dist/test-utils/index.js +1 -1
  282. package/dist/utils/async.js +1 -1
  283. package/dist/utils/claude-code-state.js +1 -1
  284. package/dist/utils/colors.js +1 -1
  285. package/dist/utils/diff.js +1 -1
  286. package/dist/utils/file-permissions.js +1 -1
  287. package/dist/utils/file-reader.js +1 -1
  288. package/dist/utils/github-releases.js +1 -1
  289. package/dist/utils/global-cache.js +1 -1
  290. package/dist/utils/json-loader.js +1 -1
  291. package/dist/utils/local-cache.js +1 -1
  292. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  293. package/dist/utils/logger/formatters/index.js +1 -1
  294. package/dist/utils/logger/handlers/console-handler.js +1 -1
  295. package/dist/utils/logger/handlers/file-handler.js +1 -1
  296. package/dist/utils/logger/handlers/index.js +1 -1
  297. package/dist/utils/logger/handlers/null-handler.js +1 -1
  298. package/dist/utils/logger/index.js +1 -1
  299. package/dist/utils/logger/logger.js +1 -1
  300. package/dist/utils/logger/types.js +1 -1
  301. package/dist/utils/option-validation.js +1 -1
  302. package/dist/utils/process.js +1 -1
  303. package/dist/utils/prompt.js +1 -1
  304. package/dist/utils/proxy-fetch.js +1 -1
  305. package/dist/utils/spinner.js +1 -1
  306. package/dist/utils/sse-parser.js +1 -1
  307. package/dist/utils/string-utils.js +1 -1
  308. package/dist/utils/table-ref-parser.js +1 -1
  309. package/dist/utils/tdx-logger.js +1 -1
  310. package/dist/utils/version-check.js +1 -1
  311. package/package.json +2 -1
@@ -1 +1 @@
1
- const a179_0x29048a=a179_0x2201;(function(_0xeaa8c9,_0x4189dc){const _0x597abf=a179_0x2201,_0xc4136f=_0xeaa8c9();while(!![]){try{const _0xebc8b2=parseInt(_0x597abf(0x29f))/0x1+parseInt(_0x597abf(0x2ec))/0x2*(parseInt(_0x597abf(0x284))/0x3)+-parseInt(_0x597abf(0x2be))/0x4*(parseInt(_0x597abf(0x234))/0x5)+-parseInt(_0x597abf(0x278))/0x6+-parseInt(_0x597abf(0x258))/0x7*(-parseInt(_0x597abf(0x2ed))/0x8)+parseInt(_0x597abf(0x211))/0x9*(parseInt(_0x597abf(0x2c6))/0xa)+-parseInt(_0x597abf(0x1ff))/0xb*(parseInt(_0x597abf(0x2d3))/0xc);if(_0xebc8b2===_0x4189dc)break;else _0xc4136f['push'](_0xc4136f['shift']());}catch(_0x567969){_0xc4136f['push'](_0xc4136f['shift']());}}}(a179_0x83d2,0xc7767));import{LLMApiClient}from'../client/llm-api-client.js';import*as a179_0x2ad1cd from'node:fs';import*as a179_0x62086b 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';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';function a179_0x2201(_0x54b41c,_0x128b73){_0x54b41c=_0x54b41c-0x1cf;const _0x83d2cc=a179_0x83d2();let _0x220173=_0x83d2cc[_0x54b41c];return _0x220173;}function a179_0x83d2(){const _0x50792c=['No\x20tdx.json\x20found\x20in\x20','PERMISSION_DENIED','Renamed\x20experimental\x20artifact\x20directory:\x20','image_gen','\x0a---\x20function:\x20','9YXKMdY','updateExperimentalKnowledgeBase','listWebSearchTools','project.json','profile','path','errors','startChat','getChatLog','version','total','json_schema.json','_reasoning_','):\x20','\x27.\x20This\x20should\x20not\x20happen.','listAgentsFull','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','serviceType','currentProjectId','signal','client','pushProject','writeFileSync','message','chatWelcomeMessage','deleteAgent','prompts','def','updateFormInterface','code.js','createExperimentalKnowledgeBase','listImageGenerators','prompt.md','deleteProject','unchanged','10ZmNOPm','chat_interfaces','chatIgnoreManagedActions','Multiple\x20agents\x20found\x20with\x20name\x20\x27','web_search','claude-4.5-sonnet','setDefaultAgent','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','yaml','statSync','agents.json','getBackupMetadata','Agent\x20\x27','agent','createFormInterface','.md','info','sort','INTERNAL','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','webSearchTools','localeCompare','formInterfaces','llm_project','logger','functions','createImageGenerator','systemPrompt','getChatInfo','new','files','.yml','readFileSync','type','agentsFull','7835093rmBOSG','service_type','textKnowledgeBases','createIntegration','json_schema','ALREADY_EXISTS','#\x20prompt.md\x0a','nameToId','sdk.llm','oldPath','readdirSync','integrations','Only\x20safe\x20types\x20(','updated','agentId','context','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','project','listTextKnowledgeBases','map','getDefaultProjectName','attributes','TextKnowledgeBase','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','getProject','---\x20file:\x20','listExperimentalArtifacts','dir','resolveProjectId','clearDefaultAgent','conflict','9542004QSEWlS','action','getOrCreateDefaultProject','starter_message.md','NOT_FOUND','actions','find','webhookCorsOrigins','createAgent','listKnowledgeBases','basename','dry-run-','29883TIUrSR','\x0a---\x20code\x20---\x0a','listIntegrations','createTextKnowledgeBase','Renamed\x20KB\x20file:\x20','size','cwd','already\x20exists','\x20in\x20project\x20','integrations.json','Renamed\x20integration\x20file:\x20','\x20---\x0a','tdx_','KnowledgeBase','resolveProjectName','listPrompts','jsonSchemaHint','split','restoreProject','event','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','experimentalArtifacts','agents','includes','loadJsonFile','INVALID_ARGUMENT','dirname','936359SeTgIf','none','knowledgebases.json','filter','keys','toLowerCase','set','mkdirSync','experimentalKnowledgeBases','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','parse','toISOString','code','chatInterfaces','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','chatId','chat_generic','1.0','updateExperimentalArtifact','Renamed\x20chat\x20interface\x20file:\x20','agent.yml','status','prompts.json','promptId','counts','isManaged','text_content','exportedFrom','rmSync','updateAgent','isDir','947404MPbupY','Invalid\x20agent\x20reference\x20format:\x20','length','Renamed\x20experimental\x20KB\x20directory:\x20','isFile','unlinkSync','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','createWebSearchTool','10116670zgdUoX','LLM_PROJECT_NOT_FOUND','Could\x20not\x20resolve\x20agent\x20reference','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','Backup\x20folder\x20not\x20found:\x20','updateAgentResponse','knowledgeBases','Skipping\x20integration\x20\x27','chatInfo','Output\x20directory\x20already\x20exists:\x20','metadata','medium','tools','10244124lSwXKD','cloneProject','Unresolved\x20dependencies:\x20','endsWith','listToolTargets','createAgentResponse','createChatInterface','starterMessage','getOrCreateDefaultAgent','created','renamed','join','chat_agent_console','(dry-run)','form_interfaces','createProject','file_name','getAgent','Removed\x20deleted\x20file:\x20','imageGenerators','updateChatInterface','description',')\x20can\x20be\x20pushed.\x20','getDefaultAgent','getChatHistory','134FIIUqQ','8JnAizg','Project\x20\x22','AGENT_NOT_FOUND','isDirectory','\x0a\x0a#\x20agent.yml\x0a','text','error','Renamed\x20prompt\x20file:\x20','Renamed\x20folder:\x20','continueChat','listAgents','tdx.json','listProjects','starter_message','listFormInterfaces','---\x20schema:\x20','chats','deleteIntegration','target','Agent\x20reference\x20not\x20found','modelType','temperature','\x20→\x20','pullAgent','createKnowledgeBase','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','utf-8','newProjectId','idToName','some','Project\x20not\x20found:\x20','add','Renamed\x20agent\x20folder:\x20','listChatInterfaces','\x0a---\x20schema:\x20','dryRun','name','has','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','warn','.llm','knowledge_bases','high','\x27\x20(','\x20attempts\x20due\x20to\x20name\x20conflicts.','low','experimental_artifacts','experimental_knowledge_bases','site','existsSync','agent.yml\x20not\x20found\x20in\x20','backupProject','listExperimentalKnowledgeBases','Removed\x20deleted\x20directory:\x20','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','updatePrompt','11BaSbxS','reasoningEffort','get','projectName','resolveAgentId','push','Unsupported\x20backup\x20version:\x20','models','createPrompt','ExperimentalKnowledgeBase','Agent\x20not\x20found:\x20','listChats','pushAgent'];a179_0x83d2=function(){return _0x50792c;};return a179_0x83d2();}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=[a179_0x29048a(0x2af),a179_0x29048a(0x2df),'chat_parent_segment'];async function safeListOrEmpty(_0x4b523){try{return await _0x4b523();}catch(_0x5a4ff4){if(_0x5a4ff4 instanceof HTTPClientError&&_0x5a4ff4['status']===0x194)return[];throw _0x5a4ff4;}}export class LLMSDK{[a179_0x29048a(0x223)];[a179_0x29048a(0x225)];[a179_0x29048a(0x267)];[a179_0x29048a(0x24d)]=Logger['of'](a179_0x29048a(0x260));constructor(_0x12d762){const _0x58f495=a179_0x29048a;this[_0x58f495(0x225)]=new LLMApiClient(_0x12d762),this[_0x58f495(0x267)]=_0x12d762;}[a179_0x29048a(0x26c)](){const _0x16aebc=getSanitizedUsername();return'tdx_default_'+_0x16aebc;}async['setCurrentProject'](_0x416d10){const _0x227869=a179_0x29048a,{projectId:_0x3a0fd4}=await this[_0x227869(0x292)](_0x416d10);this[_0x227869(0x223)]=_0x3a0fd4;}['getCurrentProject'](){const _0x1c8dd2=a179_0x29048a;return this[_0x1c8dd2(0x223)];}async[a179_0x29048a(0x23a)](_0xcfb31e){const _0x51d188=a179_0x29048a,_0xd3460=this[_0x51d188(0x267)][_0x51d188(0x215)];let _0x118e9e,_0x171c6c;if(_0xcfb31e[_0x51d188(0x29b)]('/')){const _0x6a0a25=_0xcfb31e[_0x51d188(0x295)]('/');if(_0x6a0a25[_0x51d188(0x2c0)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x51d188(0x2bf)+_0xcfb31e,undefined,{'helpText':_0x51d188(0x23c)});const [_0x1f3ece,_0x21a51b]=_0x6a0a25;_0x118e9e=await this[_0x51d188(0x275)](_0x1f3ece),_0x171c6c=_0x21a51b;}else _0x118e9e=this[_0x51d188(0x223)]||(await this['getOrCreateDefaultProject']())['id'],_0x171c6c=_0xcfb31e;const _0x48c4dc=await this[_0x51d188(0x203)](_0x171c6c,_0x118e9e),_0x16214c=await this[_0x51d188(0x225)][_0x51d188(0x2e4)](_0x48c4dc);writeCachedLLMAgent(_0x16214c['attributes'][_0x51d188(0x1eb)],_0x48c4dc,_0x118e9e,_0xd3460);}[a179_0x29048a(0x2ea)](){const _0x128ba2=a179_0x29048a,_0x4ff441=this[_0x128ba2(0x267)][_0x128ba2(0x215)];return readCachedLLMAgent(_0x4ff441)||undefined;}[a179_0x29048a(0x276)](){const _0x20be73=a179_0x29048a,_0x1a06d2=this[_0x20be73(0x267)]['profile'];clearCachedLLMAgent(_0x1a06d2);}async[a179_0x29048a(0x206)](){const _0x3753d8=a179_0x29048a,_0x718732=await this[_0x3753d8(0x225)]['getUserSettings']();return toModelInfos(_0x718732);}async[a179_0x29048a(0x2e2)](_0x1c79b2){const _0x479d81=a179_0x29048a;return await this[_0x479d81(0x225)][_0x479d81(0x2e2)](_0x1c79b2);}async[a179_0x29048a(0x232)](_0x23dee0){const _0x5f0378=a179_0x29048a,{projectId:_0x71fb13}=await this[_0x5f0378(0x292)](_0x23dee0);await this[_0x5f0378(0x225)][_0x5f0378(0x232)](_0x71fb13);}async['projects'](_0x3d32dc=0x32){const _0x4e8ea0=a179_0x29048a;return await this[_0x4e8ea0(0x225)][_0x4e8ea0(0x1d3)](_0x3d32dc);}async[a179_0x29048a(0x27a)](_0x3a88b4){const _0xa2f614=a179_0x29048a,_0x526d8c=_0x3a88b4||this[_0xa2f614(0x26c)](),_0x3c1995=this[_0xa2f614(0x267)][_0xa2f614(0x215)];if(!_0x3a88b4){const _0x14134e=readCachedLLMProject(_0x3c1995);if(_0x14134e&&_0x14134e['name']===_0x526d8c)try{const _0x280264=await this['client'][_0xa2f614(0x271)](_0x14134e['id']);if(_0x280264[_0xa2f614(0x26d)]['name']===_0x526d8c)return _0x280264;}catch{}}const _0x122e60=await this[_0xa2f614(0x225)][_0xa2f614(0x1d3)](),_0x21f1d3=_0x122e60[_0xa2f614(0x27e)](_0xc2b286=>_0xc2b286[_0xa2f614(0x26d)][_0xa2f614(0x1eb)]===_0x526d8c);if(_0x21f1d3)return!_0x3a88b4&&writeCachedLLMProject(_0x526d8c,_0x21f1d3['id'],_0x3c1995),_0x21f1d3;const _0x2c87b1=await this[_0xa2f614(0x225)][_0xa2f614(0x2e2)]({'name':_0x526d8c,'description':_0xa2f614(0x270)+getSanitizedUsername()+')'});return!_0x3a88b4&&writeCachedLLMProject(_0x526d8c,_0x2c87b1['id'],_0x3c1995),_0x2c87b1;}async[a179_0x29048a(0x275)](_0x30b53e){const _0x365ccf=a179_0x29048a,_0x455e25=await this[_0x365ccf(0x225)][_0x365ccf(0x1d3)](),_0x4d7db6=_0x455e25[_0x365ccf(0x2a2)](_0xad5d6b=>_0xad5d6b[_0x365ccf(0x26d)][_0x365ccf(0x1eb)]===_0x30b53e);if(_0x4d7db6[_0x365ccf(0x2c0)]===0x0)throw new SDKError(ErrorCode[_0x365ccf(0x2c7)],_0x365ccf(0x1e5)+_0x30b53e,undefined,{'helpText':_0x365ccf(0x1ed)});if(_0x4d7db6[_0x365ccf(0x2c0)]>0x1)throw new SDKError(ErrorCode[_0x365ccf(0x247)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x30b53e+_0x365ccf(0x21f));return _0x4d7db6[0x0]['id'];}async['resolveProjectName'](_0x2f96bc){const _0x440474=a179_0x29048a,_0x7b2f5d=await this[_0x440474(0x225)][_0x440474(0x1d3)](),_0xbcf678=_0x7b2f5d[_0x440474(0x27e)](_0x788dec=>_0x788dec['attributes'][_0x440474(0x1eb)]===_0x2f96bc);if(_0xbcf678)return{'projectId':_0xbcf678['id'],'project':_0xbcf678};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x2f96bc,undefined,{'helpText':_0x440474(0x1ed)});}async[a179_0x29048a(0x2db)](_0x213a00=a179_0x29048a(0x239),_0xc6f3a9=0x0,_0x40f2bf){const _0x3d81a5=a179_0x29048a,_0x1950b1=0xa;let _0x32cf09=0x0,_0x2e34af;while(_0x32cf09<_0x1950b1){try{const _0x44cbc5=await this['getOrCreateDefaultProject'](_0x2e34af),_0x2eb7f1=_0x44cbc5['id'],_0x1afe69=[_0x3d81a5(0x2a0),'minimal',_0x3d81a5(0x1f4),_0x3d81a5(0x2d1),_0x3d81a5(0x1f1)],_0x57d208=_0xc6f3a9===0x0?_0x3d81a5(0x290)+_0x213a00:'tdx_'+_0x213a00+_0x3d81a5(0x21d)+_0x1afe69[_0xc6f3a9],_0x989a2=await this[_0x3d81a5(0x225)][_0x3d81a5(0x1d1)](_0x2eb7f1),_0x3df837=_0x989a2[_0x3d81a5(0x27e)](_0x46d934=>_0x46d934['attributes'][_0x3d81a5(0x1eb)]===_0x57d208);if(_0x3df837)return _0x3df837;const _0xe78afe=_0xc6f3a9>0x0?0x1:_0x40f2bf;return await this[_0x3d81a5(0x225)]['createAgent']({'name':_0x57d208,'projectId':_0x2eb7f1,'modelType':_0x213a00,'systemPrompt':'','temperature':_0xe78afe,'reasoningEffort':_0xc6f3a9>0x0?_0xc6f3a9:undefined});}catch(_0x3ca387){if(_0x3ca387 instanceof HTTPClientError){const _0x37bd70=_0x3ca387[_0x3d81a5(0x2b4)];if(_0x37bd70>=0x190&&_0x37bd70<0x1f4){if(_0x37bd70===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x3ca387);else{if(_0x37bd70===0x193)throw new SDKError(ErrorCode[_0x3d81a5(0x20d)],_0x3d81a5(0x1fd),_0x3ca387);}throw _0x3ca387;}}if(errorContains(_0x3ca387,_0x3d81a5(0x28b),'duplicate',_0x3d81a5(0x277))){_0x32cf09++;if(_0x32cf09>=_0x1950b1)throw new SDKError(ErrorCode[_0x3d81a5(0x25d)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x1950b1+_0x3d81a5(0x1f3),_0x3ca387);const _0x32baa5=this[_0x3d81a5(0x26c)]();_0x2e34af=_0x32baa5+'_'+generateRandomHex();continue;}throw _0x3ca387;}}throw new SDKError(ErrorCode['INTERNAL'],_0x3d81a5(0x2c4));}async[a179_0x29048a(0x203)](_0x402742,_0x3a2276){const _0x1ba7db=a179_0x29048a,_0x33708f=_0x3a2276||this[_0x1ba7db(0x223)],_0x3ed033=await this['client'][_0x1ba7db(0x1d1)](_0x33708f),_0x329b44=_0x3ed033[_0x1ba7db(0x2a2)](_0x415e69=>_0x415e69[_0x1ba7db(0x26d)][_0x1ba7db(0x1eb)]===_0x402742);if(_0x329b44['length']===0x0){const _0x1bdba9=_0x33708f?_0x1ba7db(0x28c)+_0x33708f:'';throw new SDKError(ErrorCode[_0x1ba7db(0x2ef)],_0x1ba7db(0x209)+_0x402742+_0x1bdba9,undefined,{'helpText':_0x33708f?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x329b44[_0x1ba7db(0x2c0)]>0x1)throw new SDKError(ErrorCode[_0x1ba7db(0x247)],_0x1ba7db(0x237)+_0x402742+_0x1ba7db(0x21f));return _0x329b44[0x0]['id'];}async['agents'](_0x2eb1a9){const _0x26eb49=a179_0x29048a,_0x55a793=_0x2eb1a9||this['currentProjectId'];return await this[_0x26eb49(0x225)][_0x26eb49(0x1d1)](_0x55a793);}async[a179_0x29048a(0x257)](_0x5992d8){const _0x3e03b0=a179_0x29048a;return await this[_0x3e03b0(0x225)][_0x3e03b0(0x220)](_0x5992d8);}async[a179_0x29048a(0x242)](_0x7651c3){return await this['client']['getAgent'](_0x7651c3);}async['createAgent'](_0x1851c6){const _0x5bbc90=a179_0x29048a;return await this['client'][_0x5bbc90(0x280)](_0x1851c6);}async['updateAgent'](_0x4a2d83,_0x2c88ef){const _0x1cd359=a179_0x29048a;return await this[_0x1cd359(0x225)][_0x1cd359(0x2bc)](_0x4a2d83,_0x2c88ef);}async[a179_0x29048a(0x22a)](_0x18e38c){const _0x3ef1cf=a179_0x29048a;await this['client'][_0x3ef1cf(0x22a)](_0x18e38c);}async[a179_0x29048a(0x218)](_0x1eab50){const _0x506798=a179_0x29048a;return await this[_0x506798(0x225)][_0x506798(0x218)]({'agentId':_0x1eab50});}async*['chat'](_0x2885b6,_0x485786){const _0x2e3e95=a179_0x29048a;let _0x57a890=_0x485786?.[_0x2e3e95(0x2ae)];const _0x67ee32=_0x485786?.['agentId'];if(!_0x57a890){if(!_0x67ee32)throw new Error(_0x2e3e95(0x248));const _0x30ee4b=await this['client'][_0x2e3e95(0x218)]({'agentId':_0x67ee32});_0x57a890=_0x30ee4b['id'],yield{'type':_0x2e3e95(0x2d0),'data':{'chatId':_0x57a890,'agentId':_0x67ee32,'projectId':_0x30ee4b['attributes']['projectId']}};}for await(const _0x52b7de of this[_0x2e3e95(0x225)][_0x2e3e95(0x1d0)](_0x57a890,_0x2885b6,_0x485786?.[_0x2e3e95(0x224)])){yield{'type':_0x2e3e95(0x297),'data':_0x52b7de};}}async[a179_0x29048a(0x1d7)](_0x141bfc=0x32){const _0x539f04=a179_0x29048a;return await this[_0x539f04(0x225)][_0x539f04(0x20a)](_0x141bfc);}async['history'](_0x506c45){const _0x43850c=a179_0x29048a;return await this['client'][_0x43850c(0x2eb)](_0x506c45);}async[a179_0x29048a(0x219)](_0x473bda){const _0xdcc871=a179_0x29048a;return await this[_0xdcc871(0x225)][_0xdcc871(0x219)](_0x473bda);}async[a179_0x29048a(0x2ce)](_0x5ea25b){const _0x64c9b0=a179_0x29048a;return await this[_0x64c9b0(0x225)][_0x64c9b0(0x251)](_0x5ea25b);}async[a179_0x29048a(0x1fa)](_0x31128f,_0x381b0d,_0x1f4146){const _0x47046d=a179_0x29048a,_0x2912cb=_0x1f4146?.['dryRun']??![],{projectId:_0x3f49f5,project:_0x28902f}=await this[_0x47046d(0x292)](_0x31128f),_0x21150a=_0x28902f['attributes'][_0x47046d(0x1eb)],_0x347316=_0x381b0d||_0x21150a+_0x47046d(0x1ef);if(a179_0x2ad1cd['existsSync'](_0x347316)&&!_0x2912cb)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x47046d(0x2cf)+_0x347316,undefined,{'helpText':_0x47046d(0x2c9)});const _0x2defa8=await this[_0x47046d(0x225)]['listAgentsFull'](_0x3f49f5),_0x2e4df9=await this[_0x47046d(0x225)]['listKnowledgeBases'](_0x3f49f5),_0x288096=await this[_0x47046d(0x225)][_0x47046d(0x293)](_0x3f49f5),_0x5380ed=await this[_0x47046d(0x225)]['listIntegrations'](_0x3f49f5);if(!_0x2912cb){a179_0x2ad1cd['mkdirSync'](_0x347316,{'recursive':!![]});const _0x57f588={'version':_0x47046d(0x2b0),'exportedAt':new Date()[_0x47046d(0x2aa)](),'exportedFrom':{'site':this[_0x47046d(0x267)][_0x47046d(0x1f7)],'projectId':_0x3f49f5,'projectName':_0x21150a},'project':_0x28902f};a179_0x2ad1cd['writeFileSync'](a179_0x62086b[_0x47046d(0x2de)](_0x347316,_0x47046d(0x214)),JSON['stringify'](_0x57f588,null,0x2)),a179_0x2ad1cd[_0x47046d(0x227)](a179_0x62086b[_0x47046d(0x2de)](_0x347316,_0x47046d(0x23f)),JSON['stringify'](_0x2defa8,null,0x2)),a179_0x2ad1cd[_0x47046d(0x227)](a179_0x62086b[_0x47046d(0x2de)](_0x347316,_0x47046d(0x2a1)),JSON['stringify'](_0x2e4df9,null,0x2)),a179_0x2ad1cd['writeFileSync'](a179_0x62086b[_0x47046d(0x2de)](_0x347316,_0x47046d(0x2b5)),JSON['stringify'](_0x288096,null,0x2)),a179_0x2ad1cd[_0x47046d(0x227)](a179_0x62086b[_0x47046d(0x2de)](_0x347316,_0x47046d(0x28d)),JSON['stringify'](_0x5380ed,null,0x2));}return{'projectName':_0x21150a,'outputDir':_0x347316,'counts':{'agents':_0x2defa8['length'],'knowledgeBases':_0x2e4df9[_0x47046d(0x2c0)],'prompts':_0x288096[_0x47046d(0x2c0)],'integrations':_0x5380ed[_0x47046d(0x2c0)]}};}async[a179_0x29048a(0x296)](_0x48ab59,_0x1770bf){const _0x313f32=a179_0x29048a,_0x5d43ee=_0x1770bf?.[_0x313f32(0x1ea)]??![],_0x22e957=this[_0x313f32(0x240)](_0x48ab59),_0x23b93f=_0x22e957['exportedFrom']['site'],_0x1e0eff=this[_0x313f32(0x267)][_0x313f32(0x1f7)],_0x149aef=_0x23b93f!==_0x1e0eff?_0x23b93f:undefined,_0xf3807d=this[_0x313f32(0x29c)](a179_0x62086b[_0x313f32(0x2de)](_0x48ab59,_0x313f32(0x23f)),[]),_0x417c4b=this[_0x313f32(0x29c)](a179_0x62086b['join'](_0x48ab59,'knowledgebases.json'),[]),_0x3c861e=this['loadJsonFile'](a179_0x62086b[_0x313f32(0x2de)](_0x48ab59,_0x313f32(0x2b5)),[]),_0x5354f0=this[_0x313f32(0x29c)](a179_0x62086b[_0x313f32(0x2de)](_0x48ab59,_0x313f32(0x28d)),[]),_0xde3cb2=_0x1770bf?.['name']||_0x22e957[_0x313f32(0x2ba)][_0x313f32(0x202)];if(_0x5d43ee){const _0x25a99a=new Map(),_0xac4c11=[..._0xf3807d],_0x4f7338=_0xf3807d[_0x313f32(0x2c0)]+0x1;let _0x51519e=0x0;while(_0xac4c11['length']>0x0&&_0x51519e<_0x4f7338){_0x51519e++;const _0x55b849=[];for(const _0x2169a2 of _0xac4c11){canCreateAgent(_0x2169a2,_0x25a99a)?_0x25a99a[_0x313f32(0x2a5)](_0x2169a2['id'],_0x313f32(0x283)+_0x2169a2['id']):_0x55b849[_0x313f32(0x204)](_0x2169a2);}if(_0x55b849[_0x313f32(0x2c0)]===_0xac4c11[_0x313f32(0x2c0)])throw new SDKError(ErrorCode[_0x313f32(0x247)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x313f32(0x2a8)});_0xac4c11[_0x313f32(0x2c0)]=0x0,_0xac4c11[_0x313f32(0x204)](..._0x55b849);}const _0x4718c7=_0x3c861e['filter'](_0x3a09bd=>_0x25a99a['has'](_0x3a09bd[_0x313f32(0x26d)][_0x313f32(0x266)]))[_0x313f32(0x2c0)];return{'projectName':_0xde3cb2,'projectId':_0x313f32(0x2e0),'counts':{'agents':_0xf3807d['length'],'knowledgeBases':_0x417c4b[_0x313f32(0x2c0)],'prompts':_0x4718c7,'integrations':_0x5354f0['length']},'sourceSite':_0x149aef};}const _0x1f2144=await this[_0x313f32(0x225)]['createProject']({'name':_0xde3cb2,'description':_0x22e957[_0x313f32(0x269)][_0x313f32(0x26d)][_0x313f32(0x2e8)]}),_0x4d7d49=_0x1f2144['id'],_0x262f83=new Map(),_0x19af8f=new Map(),_0x577428=new Map();for(const _0x175891 of _0x417c4b){const _0x35aae5=await this[_0x313f32(0x225)][_0x313f32(0x1df)]({'projectId':_0x4d7d49,'name':_0x175891[_0x313f32(0x26d)][_0x313f32(0x1eb)],'tdDatabaseName':_0x175891[_0x313f32(0x26d)]['tdDatabaseName'],'tables':_0x175891[_0x313f32(0x26d)]['tables']});_0x262f83['set'](_0x175891['id'],_0x35aae5['id']);}const _0x24ff02=[..._0xf3807d],_0x378203=_0xf3807d[_0x313f32(0x2c0)]+0x1;let _0x2b011e=0x0;while(_0x24ff02['length']>0x0&&_0x2b011e<_0x378203){_0x2b011e++;const _0x442fd7=[];for(const _0x1411a3 of _0x24ff02){if(canCreateAgent(_0x1411a3,_0x19af8f)){const _0x3418e7=remapToolIds(_0x1411a3[_0x313f32(0x26d)]['tools'],_0x262f83,_0x19af8f),_0x25cda4=remapVariableIds(_0x1411a3[_0x313f32(0x26d)]['variables'],_0x262f83),_0x3b892c=await this[_0x313f32(0x225)][_0x313f32(0x2d8)]({'name':_0x1411a3[_0x313f32(0x26d)][_0x313f32(0x1eb)],'projectId':_0x4d7d49,'systemPrompt':_0x1411a3[_0x313f32(0x26d)][_0x313f32(0x250)],'starterMessage':_0x1411a3[_0x313f32(0x26d)][_0x313f32(0x2da)],'modelType':migrateModelType(_0x1411a3[_0x313f32(0x26d)][_0x313f32(0x1db)]),'maxToolIterations':_0x1411a3[_0x313f32(0x26d)]['maxToolIterations'],'temperature':_0x1411a3[_0x313f32(0x26d)][_0x313f32(0x1dc)],'reasoningEffort':_0x1411a3[_0x313f32(0x26d)][_0x313f32(0x200)],'outputs':_0x1411a3['attributes']['outputs'],'tools':_0x3418e7,'variables':_0x25cda4});_0x19af8f[_0x313f32(0x2a5)](_0x1411a3['id'],_0x3b892c['id']);}else _0x442fd7['push'](_0x1411a3);}if(_0x442fd7[_0x313f32(0x2c0)]===_0x24ff02[_0x313f32(0x2c0)])throw new SDKError(ErrorCode['INTERNAL'],_0x313f32(0x2ad),undefined,{'helpText':_0x313f32(0x2a8)});_0x24ff02[_0x313f32(0x2c0)]=0x0,_0x24ff02['push'](..._0x442fd7);}for(const _0x22e5a3 of _0x3c861e){const _0x4c0a35=_0x19af8f['get'](_0x22e5a3['attributes']['agentId']);if(!_0x4c0a35)continue;const _0x1c724d=await this[_0x313f32(0x225)]['createPrompt']({'projectId':_0x4d7d49,'agentId':_0x4c0a35,'name':_0x22e5a3[_0x313f32(0x26d)][_0x313f32(0x1eb)],'systemPrompt':_0x22e5a3[_0x313f32(0x26d)][_0x313f32(0x250)],'template':_0x22e5a3[_0x313f32(0x26d)]['template'],'jsonSchemaHint':_0x22e5a3[_0x313f32(0x26d)][_0x313f32(0x294)]});_0x577428[_0x313f32(0x2a5)](_0x22e5a3['id'],_0x1c724d['id']);}for(const _0x17d6fd of _0x5354f0){const _0x27cdf4=_0x17d6fd[_0x313f32(0x26d)][_0x313f32(0x27d)][_0x313f32(0x26b)](_0x13411d=>({..._0x13411d,'promptId':_0x577428[_0x313f32(0x201)](_0x13411d[_0x313f32(0x2b6)])||_0x13411d[_0x313f32(0x2b6)]}));await this[_0x313f32(0x225)][_0x313f32(0x25b)]({'projectId':_0x4d7d49,'serviceType':_0x17d6fd['attributes']['serviceType'],'actions':_0x27cdf4,'slackMessageMode':_0x17d6fd[_0x313f32(0x26d)]['slackMessageMode'],'chatIgnoreManagedActions':_0x17d6fd[_0x313f32(0x26d)][_0x313f32(0x236)],'chatWelcomeMessage':_0x17d6fd[_0x313f32(0x26d)][_0x313f32(0x229)],'webhookCorsOrigins':_0x17d6fd[_0x313f32(0x26d)][_0x313f32(0x27f)]});}return{'projectName':_0xde3cb2,'projectId':_0x4d7d49,'counts':{'agents':_0x19af8f[_0x313f32(0x289)],'knowledgeBases':_0x262f83[_0x313f32(0x289)],'prompts':_0x577428[_0x313f32(0x289)],'integrations':_0x5354f0['length']},'sourceSite':_0x149aef};}[a179_0x29048a(0x29c)](_0x5268e3,_0x97cb2b){const _0x558dee=a179_0x29048a;if(!a179_0x2ad1cd[_0x558dee(0x1f8)](_0x5268e3))return _0x97cb2b;return JSON[_0x558dee(0x2a9)](a179_0x2ad1cd[_0x558dee(0x255)](_0x5268e3,_0x558dee(0x1e1)));}['getBackupMetadata'](_0x1c0fdf){const _0x3a5e4a=a179_0x29048a;if(!a179_0x2ad1cd[_0x3a5e4a(0x1f8)](_0x1c0fdf))throw new SDKError(ErrorCode[_0x3a5e4a(0x27c)],_0x3a5e4a(0x2ca)+_0x1c0fdf,undefined,{'helpText':_0x3a5e4a(0x26f)});const _0x2fc1d0=a179_0x62086b[_0x3a5e4a(0x2de)](_0x1c0fdf,_0x3a5e4a(0x214));if(!a179_0x2ad1cd[_0x3a5e4a(0x1f8)](_0x2fc1d0))throw new SDKError(ErrorCode[_0x3a5e4a(0x29d)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x1c0fdf,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x31b288=JSON[_0x3a5e4a(0x2a9)](a179_0x2ad1cd[_0x3a5e4a(0x255)](_0x2fc1d0,_0x3a5e4a(0x1e1)));if(!isSupportedBackupVersion(_0x31b288[_0x3a5e4a(0x21a)]))throw new SDKError(ErrorCode[_0x3a5e4a(0x29d)],_0x3a5e4a(0x205)+_0x31b288[_0x3a5e4a(0x21a)],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x31b288;}async['pullProject'](_0x5ced24,_0x27000c,_0x2cb065){const _0x43ceb2=a179_0x29048a,{projectId:_0x568650,project:_0x4e5bbf}=await this[_0x43ceb2(0x292)](_0x5ced24),_0x5735cb=_0x4e5bbf['attributes'][_0x43ceb2(0x1eb)];let _0x4015e7;if(_0x27000c)_0x4015e7=_0x27000c;else{const _0x20126e=a179_0x62086b[_0x43ceb2(0x2de)](process[_0x43ceb2(0x28a)](),_0x43ceb2(0x29a)),_0x43e47a=getSanitizedPathWithMigration(_0x20126e,_0x5735cb);_0x43e47a[_0x43ceb2(0x2dd)]&&this[_0x43ceb2(0x24d)][_0x43ceb2(0x245)](_0x43ceb2(0x1cf)+a179_0x62086b[_0x43ceb2(0x282)](_0x43e47a['oldPath'])+'\x20→\x20'+a179_0x62086b['basename'](_0x43e47a[_0x43ceb2(0x216)])),_0x4015e7=_0x43e47a[_0x43ceb2(0x216)];}const _0x6c1bfe=await this[_0x43ceb2(0x225)][_0x43ceb2(0x220)](_0x568650),_0x1fe95f=await this['client']['listKnowledgeBases'](_0x568650),_0x287eb1=await this[_0x43ceb2(0x225)]['listTextKnowledgeBases'](_0x568650),_0x137adc=await safeListOrEmpty(()=>this[_0x43ceb2(0x225)][_0x43ceb2(0x230)](_0x568650)),_0x427a1f=await safeListOrEmpty(()=>this['client'][_0x43ceb2(0x213)](_0x568650)),_0x202fd2=await this[_0x43ceb2(0x225)][_0x43ceb2(0x293)](_0x568650),_0x35d276=await this[_0x43ceb2(0x225)]['listIntegrations'](_0x568650),_0x4a8851=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x568650)),_0x5b3a59=await safeListOrEmpty(()=>this[_0x43ceb2(0x225)][_0x43ceb2(0x273)](_0x568650)),_0x167837=await safeListOrEmpty(()=>this['client']['listFormInterfaces'](_0x568650)),_0x17b16e=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x568650)),_0x378d25=_0x35d276[_0x43ceb2(0x2a2)](_0x1fec64=>!_0x1fec64['attributes'][_0x43ceb2(0x2b8)]&&SAFE_INTEGRATION_TYPES[_0x43ceb2(0x29b)](_0x1fec64[_0x43ceb2(0x26d)][_0x43ceb2(0x222)][_0x43ceb2(0x2a4)]())),_0x33c272=new Map(),_0xd09026=new Map(),_0x421143=new Map(),_0x5bdc3b=new Map(),_0x42fd5c=new Map(),_0x36507d=new Map(),_0x6b694a=new Map();for(const _0x4947b7 of _0x6c1bfe){_0x33c272[_0x43ceb2(0x2a5)](_0x4947b7['id'],_0x4947b7[_0x43ceb2(0x26d)]['name']);}for(const _0x37e9d4 of _0x1fe95f){_0xd09026[_0x43ceb2(0x2a5)](_0x37e9d4['id'],_0x37e9d4[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)]);}for(const _0xdc3b5b of _0x287eb1){_0x421143[_0x43ceb2(0x2a5)](_0xdc3b5b['id'],_0xdc3b5b[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)]);}for(const _0x2bf9c1 of _0x137adc){_0x5bdc3b[_0x43ceb2(0x2a5)](_0x2bf9c1['id'],_0x2bf9c1[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)]);}for(const _0x4f509e of _0x427a1f){_0x42fd5c[_0x43ceb2(0x2a5)](_0x4f509e['id'],_0x4f509e[_0x43ceb2(0x26d)]['name']);}for(const _0x588da2 of _0x202fd2){_0x36507d['set'](_0x588da2['id'],_0x588da2[_0x43ceb2(0x26d)]['name']);}for(const _0x149afe of _0x4a8851){_0x6b694a[_0x43ceb2(0x2a5)](_0x149afe['id'],_0x149afe[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)]);}const _0x594632={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xd09026,'TextKnowledgeBase':_0x421143,'Agent':_0x33c272,'WebSearchTool':_0x42fd5c,'ImageGenerator':_0x5bdc3b,'ExperimentalKnowledgeBase':_0x6b694a}),'resolvePromptName':async _0x396ced=>_0x36507d[_0x43ceb2(0x201)](_0x396ced),'onWarning':_0x144456=>this[_0x43ceb2(0x24d)][_0x43ceb2(0x1ee)](_0x144456)},_0x1d6580={'projectName':_0x5735cb,'outputDir':_0x4015e7,'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}}},_0x54c0f0=[],_0x5e654d=[];for(const _0x5e623f of _0x6c1bfe){const _0x36303e=getSanitizedPathWithMigration(_0x4015e7,_0x5e623f['attributes'][_0x43ceb2(0x1eb)]);_0x36303e[_0x43ceb2(0x2dd)]&&this['logger']['info'](_0x43ceb2(0x1e7)+a179_0x62086b[_0x43ceb2(0x282)](_0x36303e[_0x43ceb2(0x261)])+_0x43ceb2(0x1dd)+a179_0x62086b['basename'](_0x36303e[_0x43ceb2(0x216)]));const _0x46b6d9=_0x36303e[_0x43ceb2(0x216)],_0x285721=a179_0x62086b[_0x43ceb2(0x2de)](_0x46b6d9,_0x43ceb2(0x231)),_0x39b528=a179_0x62086b[_0x43ceb2(0x2de)](_0x46b6d9,_0x43ceb2(0x2b3)),_0x2db54b=a179_0x62086b[_0x43ceb2(0x2de)](_0x46b6d9,'starter_message.md'),{yaml:_0x3053af,systemPrompt:_0x24a71a,starterMessage:_0x24c0a0}=await agentResponseToDef(_0x5e623f,_0x594632),_0x25c8cd=toAgentYamlString(_0x3053af),_0x3be7c4=!a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x39b528);let _0x16df8c=_0x3be7c4,_0x2e8d66;if(!_0x3be7c4){const _0x3c130b=a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x285721)?a179_0x2ad1cd[_0x43ceb2(0x255)](_0x285721,_0x43ceb2(0x1e1)):'',_0x5b3bd4=a179_0x2ad1cd[_0x43ceb2(0x255)](_0x39b528,_0x43ceb2(0x1e1)),_0x1ad170=_0x43ceb2(0x25e)+_0x3c130b+_0x43ceb2(0x2f1)+_0x5b3bd4,_0x455772=_0x43ceb2(0x25e)+_0x24a71a+_0x43ceb2(0x2f1)+_0x25c8cd,_0x4ff1b8=generateDiff(_0x1ad170,_0x455772);_0x16df8c=hasChanges(_0x4ff1b8),_0x16df8c&&(_0x2e8d66=formatDiffWithColors(_0x4ff1b8));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x46b6d9,'content':'','isDir':!![]}),_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x285721,'content':_0x24a71a}),_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x39b528,'content':_0x25c8cd});_0x24c0a0&&_0x24c0a0[_0x43ceb2(0x29b)]('\x0a')&&_0x54c0f0['push']({'path':_0x2db54b,'content':_0x24c0a0});_0x1d6580[_0x43ceb2(0x29a)][_0x43ceb2(0x204)]({'agentName':_0x5e623f[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'outputPath':_0x46b6d9,'isNew':_0x3be7c4,'hasChanges':_0x16df8c,'diff':_0x2e8d66}),_0x1d6580[_0x43ceb2(0x2b7)]['agents'][_0x43ceb2(0x21b)]++;if(_0x3be7c4)_0x1d6580['counts'][_0x43ceb2(0x29a)][_0x43ceb2(0x252)]++;else{if(_0x16df8c)_0x1d6580[_0x43ceb2(0x2b7)]['agents']['updated']++;else _0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x29a)][_0x43ceb2(0x233)]++;}}for(const _0x5c9237 of _0x1fe95f){if(_0x5c9237[_0x43ceb2(0x26d)][_0x43ceb2(0x2b8)])continue;const _0x519cf4=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4015e7),_0x5c9237[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'.yml');_0x519cf4[_0x43ceb2(0x2dd)]&&this[_0x43ceb2(0x24d)]['info'](_0x43ceb2(0x288)+a179_0x62086b[_0x43ceb2(0x282)](_0x519cf4['oldPath'])+_0x43ceb2(0x1dd)+a179_0x62086b[_0x43ceb2(0x282)](_0x519cf4[_0x43ceb2(0x216)]));const _0xfbb958=_0x519cf4[_0x43ceb2(0x216)],_0x3d9938=apiKnowledgeBaseToYaml(_0x5c9237),_0x137a12=toKnowledgeBaseYamlString(_0x3d9938),_0x235fa0=!a179_0x2ad1cd['existsSync'](_0xfbb958);let _0x59b289=_0x235fa0,_0x43c45d;if(!_0x235fa0){const _0x5a81d=a179_0x2ad1cd[_0x43ceb2(0x255)](_0xfbb958,'utf-8'),_0x34e960=generateDiff(_0x5a81d,_0x137a12);_0x59b289=hasChanges(_0x34e960),_0x59b289&&(_0x43c45d=formatDiffWithColors(_0x34e960));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0xfbb958,'content':_0x137a12}),_0x1d6580['knowledgeBases'][_0x43ceb2(0x204)]({'name':_0x5c9237[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'outputPath':_0xfbb958,'isNew':_0x235fa0,'hasChanges':_0x59b289,'diff':_0x43c45d}),_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x2cc)][_0x43ceb2(0x21b)]++;if(_0x235fa0)_0x1d6580['counts']['knowledgeBases']['new']++;else{if(_0x59b289)_0x1d6580[_0x43ceb2(0x2b7)]['knowledgeBases']['updated']++;else _0x1d6580['counts'][_0x43ceb2(0x2cc)][_0x43ceb2(0x233)]++;}}for(const _0x26b628 of _0x287eb1){if(_0x26b628['attributes'][_0x43ceb2(0x2b8)])continue;const _0x2c23b2=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4015e7),_0x26b628[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'.md');_0x2c23b2['renamed']&&this['logger'][_0x43ceb2(0x245)]('Renamed\x20text\x20KB\x20file:\x20'+a179_0x62086b['basename'](_0x2c23b2[_0x43ceb2(0x261)])+_0x43ceb2(0x1dd)+a179_0x62086b[_0x43ceb2(0x282)](_0x2c23b2[_0x43ceb2(0x216)]));const _0x270def=_0x2c23b2[_0x43ceb2(0x216)],_0x8364bb=toTextKnowledgeBaseMd(_0x26b628['attributes'][_0x43ceb2(0x1eb)],_0x26b628[_0x43ceb2(0x26d)][_0x43ceb2(0x2f2)]),_0x24d19b=!a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x270def);let _0x5dd0c8=_0x24d19b,_0x2fd7ea;if(!_0x24d19b){const _0x521505=a179_0x2ad1cd[_0x43ceb2(0x255)](_0x270def,_0x43ceb2(0x1e1)),_0x370c4f=generateDiff(_0x521505,_0x8364bb);_0x5dd0c8=hasChanges(_0x370c4f),_0x5dd0c8&&(_0x2fd7ea=formatDiffWithColors(_0x370c4f));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x270def,'content':_0x8364bb}),_0x1d6580[_0x43ceb2(0x25a)][_0x43ceb2(0x204)]({'name':_0x26b628['attributes'][_0x43ceb2(0x1eb)],'outputPath':_0x270def,'isNew':_0x24d19b,'hasChanges':_0x5dd0c8,'diff':_0x2fd7ea}),_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x25a)][_0x43ceb2(0x21b)]++;if(_0x24d19b)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x25a)][_0x43ceb2(0x252)]++;else{if(_0x5dd0c8)_0x1d6580[_0x43ceb2(0x2b7)]['textKnowledgeBases'][_0x43ceb2(0x265)]++;else _0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x25a)]['unchanged']++;}}for(const _0x582ada of _0x202fd2){if(_0x582ada[_0x43ceb2(0x26d)][_0x43ceb2(0x2b8)])continue;const _0x57733d=getSanitizedPathWithMigration(getPromptsDir(_0x4015e7),_0x582ada['attributes'][_0x43ceb2(0x1eb)],'.yml');_0x57733d[_0x43ceb2(0x2dd)]&&this[_0x43ceb2(0x24d)][_0x43ceb2(0x245)](_0x43ceb2(0x2f4)+a179_0x62086b[_0x43ceb2(0x282)](_0x57733d[_0x43ceb2(0x261)])+_0x43ceb2(0x1dd)+a179_0x62086b[_0x43ceb2(0x282)](_0x57733d[_0x43ceb2(0x216)]));const _0x4646c9=_0x57733d[_0x43ceb2(0x216)],_0x44f951=await apiPromptToYaml(_0x582ada,_0x594632);if(!_0x44f951)continue;const _0x53c943=toPromptYamlString(_0x44f951),_0x5b806a=!a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x4646c9);let _0x214e06=_0x5b806a,_0x1d4aee;if(!_0x5b806a){const _0x55ba0d=a179_0x2ad1cd[_0x43ceb2(0x255)](_0x4646c9,_0x43ceb2(0x1e1)),_0x50ee04=generateDiff(_0x55ba0d,_0x53c943);_0x214e06=hasChanges(_0x50ee04),_0x214e06&&(_0x1d4aee=formatDiffWithColors(_0x50ee04));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x4646c9,'content':_0x53c943}),_0x1d6580[_0x43ceb2(0x22b)][_0x43ceb2(0x204)]({'name':_0x582ada[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'outputPath':_0x4646c9,'isNew':_0x5b806a,'hasChanges':_0x214e06,'diff':_0x1d4aee}),_0x1d6580[_0x43ceb2(0x2b7)]['prompts'][_0x43ceb2(0x21b)]++;if(_0x5b806a)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x22b)]['new']++;else{if(_0x214e06)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x22b)][_0x43ceb2(0x265)]++;else _0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x22b)][_0x43ceb2(0x233)]++;}}for(const _0x4d3ba2 of _0x378d25){const _0x393a6a=_0x4d3ba2['attributes'][_0x43ceb2(0x222)][_0x43ceb2(0x2a4)](),_0x4788d0=getSanitizedPathWithMigration(getIntegrationsDir(_0x4015e7),_0x393a6a,_0x43ceb2(0x254));_0x4788d0[_0x43ceb2(0x2dd)]&&this[_0x43ceb2(0x24d)]['info'](_0x43ceb2(0x28e)+a179_0x62086b[_0x43ceb2(0x282)](_0x4788d0[_0x43ceb2(0x261)])+_0x43ceb2(0x1dd)+a179_0x62086b[_0x43ceb2(0x282)](_0x4788d0[_0x43ceb2(0x216)]));const _0x3d038e=_0x4788d0[_0x43ceb2(0x216)],_0x1933d9=await apiIntegrationToYaml(_0x4d3ba2,_0x594632),_0x934e73=toIntegrationYamlString(_0x1933d9),_0x4aad24=!a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x3d038e);let _0x3d17de=_0x4aad24,_0x286864;if(!_0x4aad24){const _0x3bdfaf=a179_0x2ad1cd[_0x43ceb2(0x255)](_0x3d038e,_0x43ceb2(0x1e1)),_0x22def9=generateDiff(_0x3bdfaf,_0x934e73);_0x3d17de=hasChanges(_0x22def9),_0x3d17de&&(_0x286864=formatDiffWithColors(_0x22def9));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x3d038e,'content':_0x934e73}),_0x1d6580[_0x43ceb2(0x263)][_0x43ceb2(0x204)]({'name':_0x393a6a,'outputPath':_0x3d038e,'isNew':_0x4aad24,'hasChanges':_0x3d17de,'diff':_0x286864}),_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x263)][_0x43ceb2(0x21b)]++;if(_0x4aad24)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x263)][_0x43ceb2(0x252)]++;else{if(_0x3d17de)_0x1d6580['counts'][_0x43ceb2(0x263)][_0x43ceb2(0x265)]++;else _0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x263)]['unchanged']++;}}for(const _0x4efac9 of _0x4a8851){if(_0x4efac9[_0x43ceb2(0x26d)][_0x43ceb2(0x2b8)])continue;const _0x563501=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x4015e7),_0x4efac9[_0x43ceb2(0x26d)]['name']);_0x563501[_0x43ceb2(0x2dd)]&&this[_0x43ceb2(0x24d)]['info'](_0x43ceb2(0x2c1)+a179_0x62086b[_0x43ceb2(0x282)](_0x563501[_0x43ceb2(0x261)])+_0x43ceb2(0x1dd)+a179_0x62086b[_0x43ceb2(0x282)](_0x563501['path']));const _0x3658c4=_0x563501[_0x43ceb2(0x216)],_0x3e6ae2=a179_0x62086b[_0x43ceb2(0x2de)](_0x3658c4,sanitizeForFilesystem(_0x4efac9[_0x43ceb2(0x26d)]['name'])+_0x43ceb2(0x254)),_0x10be05=a179_0x62086b[_0x43ceb2(0x2de)](_0x3658c4,_0x43ceb2(0x24e)),_0x145a06=apiExperimentalKnowledgeBaseToYaml(_0x4efac9),_0x223142=toExperimentalKnowledgeBaseYamlString(_0x145a06),_0x4e46cb=!a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x3658c4);let _0x397f3e=_0x4e46cb,_0x5a0173,_0x2ed15a=_0x223142;const _0x17dc55=[..._0x145a06['functions']][_0x43ceb2(0x246)]((_0x38ef80,_0x17cae9)=>_0x38ef80[_0x43ceb2(0x1eb)][_0x43ceb2(0x24a)](_0x17cae9[_0x43ceb2(0x1eb)]));for(const _0x28f1c9 of _0x17dc55){_0x2ed15a+=_0x43ceb2(0x210)+_0x28f1c9[_0x43ceb2(0x1eb)]+_0x43ceb2(0x28f)+_0x28f1c9[_0x43ceb2(0x2ab)]+_0x43ceb2(0x1e9)+_0x28f1c9[_0x43ceb2(0x1eb)]+_0x43ceb2(0x28f)+_0x28f1c9[_0x43ceb2(0x25c)]+'\x0a';}if(!_0x4e46cb){let _0xd436eb='';a179_0x2ad1cd['existsSync'](_0x3e6ae2)&&(_0xd436eb=a179_0x2ad1cd[_0x43ceb2(0x255)](_0x3e6ae2,'utf-8'));if(a179_0x2ad1cd['existsSync'](_0x10be05)){const _0x127805=a179_0x2ad1cd[_0x43ceb2(0x262)](_0x10be05,{'withFileTypes':!![]}),_0x2d1c2a=_0x127805[_0x43ceb2(0x2a2)](_0xae233f=>_0xae233f[_0x43ceb2(0x2f0)]())[_0x43ceb2(0x246)]((_0x14d8d6,_0x1710af)=>_0x14d8d6['name'][_0x43ceb2(0x24a)](_0x1710af['name']));for(const _0x30bc52 of _0x2d1c2a){const _0x3d1f1b=a179_0x62086b[_0x43ceb2(0x2de)](_0x10be05,_0x30bc52[_0x43ceb2(0x1eb)],_0x43ceb2(0x22e)),_0x34d4aa=a179_0x62086b[_0x43ceb2(0x2de)](_0x10be05,_0x30bc52[_0x43ceb2(0x1eb)],_0x43ceb2(0x21c));a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x3d1f1b)&&(_0xd436eb+=_0x43ceb2(0x210)+_0x30bc52['name']+_0x43ceb2(0x28f)+a179_0x2ad1cd['readFileSync'](_0x3d1f1b,_0x43ceb2(0x1e1))+'\x0a'),a179_0x2ad1cd['existsSync'](_0x34d4aa)&&(_0xd436eb+=_0x43ceb2(0x1d6)+_0x30bc52[_0x43ceb2(0x1eb)]+_0x43ceb2(0x28f)+a179_0x2ad1cd[_0x43ceb2(0x255)](_0x34d4aa,_0x43ceb2(0x1e1))+'\x0a');}}const _0x2874f5=generateDiff(_0xd436eb,_0x2ed15a);_0x397f3e=hasChanges(_0x2874f5),_0x397f3e&&(_0x5a0173=formatDiffWithColors(_0x2874f5));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x3658c4,'content':'','isDir':!![]}),_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x3e6ae2,'content':_0x223142}),_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x10be05,'content':'','isDir':!![]});for(const _0x305789 of _0x145a06[_0x43ceb2(0x24e)]){const _0x5807ae=a179_0x62086b[_0x43ceb2(0x2de)](_0x10be05,sanitizeForFilesystem(_0x305789['name'])),_0x54b587=a179_0x62086b[_0x43ceb2(0x2de)](_0x5807ae,_0x43ceb2(0x22e)),_0x501e6d=a179_0x62086b[_0x43ceb2(0x2de)](_0x5807ae,'json_schema.json');_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x5807ae,'content':'','isDir':!![]}),_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x54b587,'content':_0x305789[_0x43ceb2(0x2ab)]}),_0x54c0f0['push']({'path':_0x501e6d,'content':_0x305789[_0x43ceb2(0x25c)]});}if(a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x10be05)){const _0x2bea01=a179_0x2ad1cd[_0x43ceb2(0x262)](_0x10be05,{'withFileTypes':!![]}),_0x5a9a24=new Set(_0x145a06['functions']['map'](_0xb4ed3e=>sanitizeForFilesystem(_0xb4ed3e[_0x43ceb2(0x1eb)])));for(const _0x379cd9 of _0x2bea01){if(_0x379cd9[_0x43ceb2(0x2f0)]()&&!_0x5a9a24['has'](_0x379cd9[_0x43ceb2(0x1eb)])){const _0x429ff8=a179_0x62086b['join'](_0x10be05,_0x379cd9['name']);_0x5e654d[_0x43ceb2(0x204)]({'path':_0x429ff8,'isDir':!![]});}}}_0x1d6580['experimentalKnowledgeBases'][_0x43ceb2(0x204)]({'name':_0x4efac9[_0x43ceb2(0x26d)]['name'],'outputPath':_0x3658c4,'isNew':_0x4e46cb,'hasChanges':_0x397f3e,'diff':_0x5a0173}),_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x2a7)]['total']++;if(_0x4e46cb)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x2a7)][_0x43ceb2(0x252)]++;else{if(_0x397f3e)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x2a7)]['updated']++;else _0x1d6580[_0x43ceb2(0x2b7)]['experimentalKnowledgeBases'][_0x43ceb2(0x233)]++;}}for(const _0xb4bbd7 of _0x5b3a59){if(_0xb4bbd7['attributes'][_0x43ceb2(0x2b8)])continue;const _0xb53094=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x4015e7),_0xb4bbd7['attributes'][_0x43ceb2(0x1eb)]);_0xb53094['renamed']&&this[_0x43ceb2(0x24d)]['info'](_0x43ceb2(0x20e)+a179_0x62086b[_0x43ceb2(0x282)](_0xb53094[_0x43ceb2(0x261)])+_0x43ceb2(0x1dd)+a179_0x62086b['basename'](_0xb53094[_0x43ceb2(0x216)]));const _0x18a8fc=_0xb53094['path'],_0x54a858=a179_0x62086b[_0x43ceb2(0x2de)](_0x18a8fc,sanitizeForFilesystem(_0xb4bbd7[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)])+'.yml'),_0xa592d1=a179_0x62086b[_0x43ceb2(0x2de)](_0x18a8fc,_0x43ceb2(0x22e)),_0x5ed97b=a179_0x62086b[_0x43ceb2(0x2de)](_0x18a8fc,_0x43ceb2(0x253)),_0x31ac9d=apiExperimentalArtifactToYaml(_0xb4bbd7),_0x32aa89=toExperimentalArtifactYamlString(_0x31ac9d),_0x4f3580=!a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x18a8fc);let _0x525d32=_0x4f3580,_0x499a47,_0x4d281c=_0x32aa89+(_0x43ceb2(0x285)+_0x31ac9d[_0x43ceb2(0x2ab)]+'\x0a');const _0x417648=[..._0x31ac9d[_0x43ceb2(0x253)]]['sort']((_0x87326a,_0x1806d4)=>_0x87326a[_0x43ceb2(0x2e3)][_0x43ceb2(0x24a)](_0x1806d4[_0x43ceb2(0x2e3)]));for(const _0x6d5635 of _0x417648){_0x4d281c+='---\x20file:\x20'+_0x6d5635[_0x43ceb2(0x2e3)]+_0x43ceb2(0x28f)+_0x6d5635[_0x43ceb2(0x2b9)]+'\x0a';}if(!_0x4f3580){let _0x5dea93='';a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x54a858)&&(_0x5dea93=a179_0x2ad1cd[_0x43ceb2(0x255)](_0x54a858,_0x43ceb2(0x1e1)));a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0xa592d1)&&(_0x5dea93+=_0x43ceb2(0x285)+a179_0x2ad1cd[_0x43ceb2(0x255)](_0xa592d1,_0x43ceb2(0x1e1))+'\x0a');if(a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x5ed97b)){const _0x346185=a179_0x2ad1cd[_0x43ceb2(0x262)](_0x5ed97b),_0x13eecc=_0x346185['filter'](_0xddbb3e=>{const _0x315705=_0x43ceb2,_0x33b5a2=a179_0x62086b['join'](_0x5ed97b,_0xddbb3e);return a179_0x2ad1cd[_0x315705(0x23e)](_0x33b5a2)[_0x315705(0x2c2)]();})[_0x43ceb2(0x246)]((_0x1bb45f,_0x2a91ab)=>_0x1bb45f[_0x43ceb2(0x24a)](_0x2a91ab));for(const _0x484168 of _0x13eecc){const _0x530e33=a179_0x62086b[_0x43ceb2(0x2de)](_0x5ed97b,_0x484168);_0x5dea93+=_0x43ceb2(0x272)+_0x484168+_0x43ceb2(0x28f)+a179_0x2ad1cd[_0x43ceb2(0x255)](_0x530e33,_0x43ceb2(0x1e1))+'\x0a';}}const _0x1465bd=generateDiff(_0x5dea93,_0x4d281c);_0x525d32=hasChanges(_0x1465bd),_0x525d32&&(_0x499a47=formatDiffWithColors(_0x1465bd));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x18a8fc,'content':'','isDir':!![]}),_0x54c0f0['push']({'path':_0x54a858,'content':_0x32aa89}),_0x54c0f0['push']({'path':_0xa592d1,'content':_0x31ac9d['code']});if(_0x31ac9d[_0x43ceb2(0x253)]['length']>0x0){_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x5ed97b,'content':'','isDir':!![]});for(const _0x1542a6 of _0x31ac9d[_0x43ceb2(0x253)]){const _0x2797b0=a179_0x62086b[_0x43ceb2(0x2de)](_0x5ed97b,_0x1542a6[_0x43ceb2(0x2e3)]);_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x2797b0,'content':_0x1542a6['text_content']});}}if(a179_0x2ad1cd[_0x43ceb2(0x1f8)](_0x5ed97b)){const _0x5822cb=a179_0x2ad1cd[_0x43ceb2(0x262)](_0x5ed97b),_0x2cc522=new Set(_0x31ac9d[_0x43ceb2(0x253)][_0x43ceb2(0x26b)](_0x2900ae=>_0x2900ae['file_name']));for(const _0x2e2d31 of _0x5822cb){const _0x462d06=a179_0x62086b['join'](_0x5ed97b,_0x2e2d31);a179_0x2ad1cd[_0x43ceb2(0x23e)](_0x462d06)[_0x43ceb2(0x2c2)]()&&!_0x2cc522[_0x43ceb2(0x1ec)](_0x2e2d31)&&_0x5e654d['push']({'path':_0x462d06});}}_0x1d6580['experimentalArtifacts'][_0x43ceb2(0x204)]({'name':_0xb4bbd7[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'outputPath':_0x18a8fc,'isNew':_0x4f3580,'hasChanges':_0x525d32,'diff':_0x499a47}),_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x299)][_0x43ceb2(0x21b)]++;if(_0x4f3580)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x299)]['new']++;else{if(_0x525d32)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x299)][_0x43ceb2(0x265)]++;else _0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x299)]['unchanged']++;}}for(const _0x53cc26 of _0x167837){const _0x2d4fb9=getSanitizedPathWithMigration(getFormInterfacesDir(_0x4015e7),_0x53cc26['attributes'][_0x43ceb2(0x1eb)],_0x43ceb2(0x254));_0x2d4fb9['renamed']&&this[_0x43ceb2(0x24d)]['info']('Renamed\x20form\x20interface\x20file:\x20'+a179_0x62086b[_0x43ceb2(0x282)](_0x2d4fb9[_0x43ceb2(0x261)])+_0x43ceb2(0x1dd)+a179_0x62086b[_0x43ceb2(0x282)](_0x2d4fb9['path']));const _0x11fccf=_0x2d4fb9[_0x43ceb2(0x216)],_0x438c1b=await apiFormInterfaceToYaml(_0x53cc26,_0x594632),_0x1510ab=toFormInterfaceYamlString(_0x438c1b),_0x4f4113=!a179_0x2ad1cd['existsSync'](_0x11fccf);let _0x4def48=_0x4f4113,_0x362022;if(!_0x4f4113){const _0x3c216f=a179_0x2ad1cd['readFileSync'](_0x11fccf,'utf-8'),_0x49dd30=generateDiff(_0x3c216f,_0x1510ab);_0x4def48=hasChanges(_0x49dd30),_0x4def48&&(_0x362022=formatDiffWithColors(_0x49dd30));}_0x54c0f0[_0x43ceb2(0x204)]({'path':_0x11fccf,'content':_0x1510ab}),_0x1d6580[_0x43ceb2(0x24b)][_0x43ceb2(0x204)]({'name':_0x53cc26[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'outputPath':_0x11fccf,'isNew':_0x4f4113,'hasChanges':_0x4def48,'diff':_0x362022}),_0x1d6580[_0x43ceb2(0x2b7)]['formInterfaces'][_0x43ceb2(0x21b)]++;if(_0x4f4113)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x24b)][_0x43ceb2(0x252)]++;else{if(_0x4def48)_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x24b)][_0x43ceb2(0x265)]++;else _0x1d6580['counts'][_0x43ceb2(0x24b)][_0x43ceb2(0x233)]++;}}for(const _0x3f3502 of _0x17b16e){if(_0x3f3502[_0x43ceb2(0x26d)][_0x43ceb2(0x2b8)])continue;const _0x2bdf2d=getSanitizedPathWithMigration(getChatInterfacesDir(_0x4015e7),_0x3f3502[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],_0x43ceb2(0x254));_0x2bdf2d[_0x43ceb2(0x2dd)]&&this[_0x43ceb2(0x24d)][_0x43ceb2(0x245)](_0x43ceb2(0x2b2)+a179_0x62086b['basename'](_0x2bdf2d[_0x43ceb2(0x261)])+'\x20→\x20'+a179_0x62086b['basename'](_0x2bdf2d[_0x43ceb2(0x216)]));const _0x3f0a44=_0x2bdf2d['path'],_0x3245fe=await apiChatInterfaceToYaml(_0x3f3502,_0x594632),_0x29446a=toChatInterfaceYamlString(_0x3245fe),_0x298934=!a179_0x2ad1cd['existsSync'](_0x3f0a44);let _0x5961a0=_0x298934,_0x4423cd;if(!_0x298934){const _0x2c3fb7=a179_0x2ad1cd['readFileSync'](_0x3f0a44,'utf-8'),_0x528898=generateDiff(_0x2c3fb7,_0x29446a);_0x5961a0=hasChanges(_0x528898),_0x5961a0&&(_0x4423cd=formatDiffWithColors(_0x528898));}_0x54c0f0['push']({'path':_0x3f0a44,'content':_0x29446a}),_0x1d6580['chatInterfaces'][_0x43ceb2(0x204)]({'name':_0x3f3502[_0x43ceb2(0x26d)][_0x43ceb2(0x1eb)],'outputPath':_0x3f0a44,'isNew':_0x298934,'hasChanges':_0x5961a0,'diff':_0x4423cd}),_0x1d6580[_0x43ceb2(0x2b7)][_0x43ceb2(0x2ac)][_0x43ceb2(0x21b)]++;if(_0x298934)_0x1d6580[_0x43ceb2(0x2b7)]['chatInterfaces']['new']++;else{if(_0x5961a0)_0x1d6580['counts']['chatInterfaces'][_0x43ceb2(0x265)]++;else _0x1d6580['counts'][_0x43ceb2(0x2ac)][_0x43ceb2(0x233)]++;}}if(_0x2cb065?.[_0x43ceb2(0x1ea)])return _0x1d6580;a179_0x2ad1cd[_0x43ceb2(0x2a6)](_0x4015e7,{'recursive':!![]}),a179_0x2ad1cd[_0x43ceb2(0x2a6)](getKnowledgeBasesDir(_0x4015e7),{'recursive':!![]}),a179_0x2ad1cd[_0x43ceb2(0x2a6)](getPromptsDir(_0x4015e7),{'recursive':!![]}),a179_0x2ad1cd[_0x43ceb2(0x2a6)](getIntegrationsDir(_0x4015e7),{'recursive':!![]}),a179_0x2ad1cd[_0x43ceb2(0x2a6)](getExperimentalKnowledgeBasesDir(_0x4015e7),{'recursive':!![]}),a179_0x2ad1cd[_0x43ceb2(0x2a6)](getExperimentalArtifactsDir(_0x4015e7),{'recursive':!![]}),a179_0x2ad1cd[_0x43ceb2(0x2a6)](getFormInterfacesDir(_0x4015e7),{'recursive':!![]}),a179_0x2ad1cd['mkdirSync'](getChatInterfacesDir(_0x4015e7),{'recursive':!![]});const _0x44b09f=a179_0x62086b[_0x43ceb2(0x2de)](_0x4015e7,_0x43ceb2(0x1d2));a179_0x2ad1cd[_0x43ceb2(0x227)](_0x44b09f,createAgentConfigContent(_0x5735cb));for(const _0x12798b of _0x54c0f0){if(_0x12798b[_0x43ceb2(0x2bd)])a179_0x2ad1cd[_0x43ceb2(0x2a6)](_0x12798b[_0x43ceb2(0x216)],{'recursive':!![]});else{const _0xc78ba4=a179_0x62086b[_0x43ceb2(0x29e)](_0x12798b[_0x43ceb2(0x216)]);!a179_0x2ad1cd['existsSync'](_0xc78ba4)&&a179_0x2ad1cd[_0x43ceb2(0x2a6)](_0xc78ba4,{'recursive':!![]}),a179_0x2ad1cd['writeFileSync'](_0x12798b[_0x43ceb2(0x216)],_0x12798b['content']);}}for(const _0x527040 of _0x5e654d){_0x527040[_0x43ceb2(0x2bd)]?(a179_0x2ad1cd[_0x43ceb2(0x2bb)](_0x527040['path'],{'recursive':!![],'force':!![]}),this[_0x43ceb2(0x24d)][_0x43ceb2(0x245)](_0x43ceb2(0x1fc)+a179_0x62086b[_0x43ceb2(0x282)](a179_0x62086b[_0x43ceb2(0x29e)](_0x527040[_0x43ceb2(0x216)]))+'/'+a179_0x62086b['basename'](_0x527040[_0x43ceb2(0x216)]))):(a179_0x2ad1cd['rmSync'](_0x527040[_0x43ceb2(0x216)],{'force':!![]}),this[_0x43ceb2(0x24d)][_0x43ceb2(0x245)](_0x43ceb2(0x2e5)+a179_0x62086b[_0x43ceb2(0x282)](a179_0x62086b['dirname'](_0x527040['path']))+'/'+a179_0x62086b[_0x43ceb2(0x282)](_0x527040[_0x43ceb2(0x216)])));}return _0x1d6580;}async[a179_0x29048a(0x226)](_0x4acf48,_0x424441){const _0x1e4685=a179_0x29048a,_0x28fbcb=a179_0x62086b[_0x1e4685(0x2de)](_0x4acf48,_0x1e4685(0x1d2));if(!a179_0x2ad1cd['existsSync'](_0x28fbcb))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1e4685(0x20c)+_0x4acf48,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x1d8374=loadAgentConfig(_0x28fbcb),_0x5b97bb=await this[_0x1e4685(0x275)](_0x1d8374['llm_project']),_0x5324c9=await this[_0x1e4685(0x225)]['getProject'](_0x5b97bb),_0x3d52cd=_0x5324c9['attributes'][_0x1e4685(0x1eb)],_0x2943c4={'projectName':_0x3d52cd,'projectId':_0x5b97bb,'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}}},_0x3c7cc4=[],_0x1779b1=[],_0x559bca=[],_0x2674fa=[],_0x182446=[],_0x43635d=[],_0x1b239a=a179_0x2ad1cd[_0x1e4685(0x262)](_0x4acf48,{'withFileTypes':!![]});for(const _0x13b060 of _0x1b239a){if(!_0x13b060[_0x1e4685(0x2f0)]())continue;if(['knowledge_bases','prompts',_0x1e4685(0x263),'experimental_knowledge_bases',_0x1e4685(0x1f5),_0x1e4685(0x2e1),_0x1e4685(0x235)][_0x1e4685(0x29b)](_0x13b060[_0x1e4685(0x1eb)]))continue;const _0x503956=a179_0x62086b[_0x1e4685(0x2de)](_0x4acf48,_0x13b060['name']);if(isAgentDir(_0x503956)){const _0x4b05b3=a179_0x62086b['join'](_0x503956,_0x1e4685(0x2b3)),_0x21c1b6=a179_0x62086b[_0x1e4685(0x2de)](_0x503956,'prompt.md'),_0x1d20cb=a179_0x62086b[_0x1e4685(0x2de)](_0x503956,_0x1e4685(0x27b)),_0x409153=parseAgentYaml(a179_0x2ad1cd[_0x1e4685(0x255)](_0x4b05b3,_0x1e4685(0x1e1)),_0x4b05b3),_0x9266eb=a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x21c1b6)?a179_0x2ad1cd[_0x1e4685(0x255)](_0x21c1b6,_0x1e4685(0x1e1)):'',_0x3a339e=a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x1d20cb)?a179_0x2ad1cd['readFileSync'](_0x1d20cb,_0x1e4685(0x1e1)):_0x409153[_0x1e4685(0x1d4)];_0x3c7cc4[_0x1e4685(0x204)]({'name':_0x409153[_0x1e4685(0x1eb)],'dir':_0x503956,'yaml':_0x409153,'systemPrompt':_0x9266eb,'starterMessage':_0x3a339e});}}const _0x485d94=getKnowledgeBasesDir(_0x4acf48);if(a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x485d94)){const _0x22b387=a179_0x2ad1cd[_0x1e4685(0x262)](_0x485d94);for(const _0x56323f of _0x22b387){const _0x1b773c=a179_0x62086b['join'](_0x485d94,_0x56323f);if(_0x56323f['endsWith'](_0x1e4685(0x254))){const _0x48bf01=parseKnowledgeBaseYaml(a179_0x2ad1cd[_0x1e4685(0x255)](_0x1b773c,'utf-8'),_0x1b773c);_0x1779b1[_0x1e4685(0x204)]({'name':_0x48bf01[_0x1e4685(0x1eb)],'path':_0x1b773c,'yaml':_0x48bf01});}else{if(_0x56323f[_0x1e4685(0x2d6)](_0x1e4685(0x244))){const _0x191d16=a179_0x2ad1cd[_0x1e4685(0x255)](_0x1b773c,_0x1e4685(0x1e1)),{name:_0x12e9f0,text:_0x2e52eb}=parseTextKnowledgeBaseMd(_0x191d16,_0x56323f);_0x559bca[_0x1e4685(0x204)]({'name':_0x12e9f0,'path':_0x1b773c,'text':_0x2e52eb});}}}}const _0x2eae69=getPromptsDir(_0x4acf48);if(a179_0x2ad1cd['existsSync'](_0x2eae69)){const _0x3013b8=a179_0x2ad1cd[_0x1e4685(0x262)](_0x2eae69)[_0x1e4685(0x2a2)](_0x2f5e04=>_0x2f5e04[_0x1e4685(0x2d6)](_0x1e4685(0x254)));for(const _0xba677c of _0x3013b8){const _0x275ac2=a179_0x62086b[_0x1e4685(0x2de)](_0x2eae69,_0xba677c),_0x52f5c9=parsePromptYaml(a179_0x2ad1cd[_0x1e4685(0x255)](_0x275ac2,'utf-8'),_0x275ac2);_0x2674fa['push']({'name':_0x52f5c9[_0x1e4685(0x1eb)],'path':_0x275ac2,'yaml':_0x52f5c9});}}const _0x4bf938=[],_0x3f5d6b=getIntegrationsDir(_0x4acf48);if(a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x3f5d6b)){const _0x24e8e4=a179_0x2ad1cd[_0x1e4685(0x262)](_0x3f5d6b)[_0x1e4685(0x2a2)](_0x2f60c2=>_0x2f60c2[_0x1e4685(0x2d6)](_0x1e4685(0x254)));for(const _0x2a4771 of _0x24e8e4){const _0x3d096a=a179_0x62086b['join'](_0x3f5d6b,_0x2a4771),_0x96e912=parseIntegrationYaml(a179_0x2ad1cd[_0x1e4685(0x255)](_0x3d096a,_0x1e4685(0x1e1)),_0x3d096a);if(!SAFE_INTEGRATION_TYPES['includes'](_0x96e912['service_type'][_0x1e4685(0x2a4)]())){this[_0x1e4685(0x24d)][_0x1e4685(0x1ee)]('Skipping\x20integration\x20\x27'+_0x96e912[_0x1e4685(0x1eb)]+'\x27\x20('+_0x96e912[_0x1e4685(0x259)]+_0x1e4685(0x21e)+(_0x1e4685(0x264)+SAFE_INTEGRATION_TYPES[_0x1e4685(0x2de)](',\x20')+_0x1e4685(0x2e9))+_0x1e4685(0x298));continue;}_0x4bf938['push']({'name':_0x96e912[_0x1e4685(0x1eb)],'path':_0x3d096a,'yaml':_0x96e912});}}const _0x2f78e0=getExperimentalKnowledgeBasesDir(_0x4acf48);if(a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x2f78e0)){const _0x5bef97=a179_0x2ad1cd['readdirSync'](_0x2f78e0,{'withFileTypes':!![]});for(const _0x3700e9 of _0x5bef97){if(!_0x3700e9[_0x1e4685(0x2f0)]())continue;const _0x2f839d=a179_0x62086b[_0x1e4685(0x2de)](_0x2f78e0,_0x3700e9[_0x1e4685(0x1eb)]),_0x8d7dd=a179_0x62086b['join'](_0x2f839d,_0x3700e9[_0x1e4685(0x1eb)]+_0x1e4685(0x254)),_0x13ae95=a179_0x62086b[_0x1e4685(0x2de)](_0x2f839d,_0x1e4685(0x24e));if(!a179_0x2ad1cd['existsSync'](_0x8d7dd))continue;const _0x54d750=parseExperimentalKnowledgeBaseYaml(a179_0x2ad1cd[_0x1e4685(0x255)](_0x8d7dd,_0x1e4685(0x1e1)),_0x8d7dd),_0x480a17=[];if(a179_0x2ad1cd['existsSync'](_0x13ae95)){const _0x4c0de1=a179_0x2ad1cd[_0x1e4685(0x262)](_0x13ae95,{'withFileTypes':!![]});for(const _0x34b41c of _0x4c0de1){if(!_0x34b41c[_0x1e4685(0x2f0)]())continue;const _0x2af1f7=a179_0x62086b['join'](_0x13ae95,_0x34b41c['name']),_0x356e8b=a179_0x62086b['join'](_0x2af1f7,_0x1e4685(0x22e)),_0x2c2c75=a179_0x62086b['join'](_0x2af1f7,_0x1e4685(0x21c));a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x356e8b)&&a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x2c2c75)&&_0x480a17[_0x1e4685(0x204)]({'name':_0x34b41c[_0x1e4685(0x1eb)],'code':a179_0x2ad1cd[_0x1e4685(0x255)](_0x356e8b,_0x1e4685(0x1e1)),'json_schema':a179_0x2ad1cd[_0x1e4685(0x255)](_0x2c2c75,'utf-8')});}}const _0x1d8951={..._0x54d750,'variables':_0x54d750['variables']||[],'functions':_0x480a17};_0x182446[_0x1e4685(0x204)]({'name':_0x54d750[_0x1e4685(0x1eb)],'dir':_0x2f839d,'def':_0x1d8951});}}const _0x32427d=getExperimentalArtifactsDir(_0x4acf48);if(a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x32427d)){const _0x3275a7=a179_0x2ad1cd[_0x1e4685(0x262)](_0x32427d,{'withFileTypes':!![]});for(const _0x4ea589 of _0x3275a7){if(!_0x4ea589[_0x1e4685(0x2f0)]())continue;const _0x2a6989=a179_0x62086b[_0x1e4685(0x2de)](_0x32427d,_0x4ea589[_0x1e4685(0x1eb)]),_0xf60de7=a179_0x62086b['join'](_0x2a6989,_0x4ea589[_0x1e4685(0x1eb)]+_0x1e4685(0x254)),_0x1d3bb2=a179_0x62086b[_0x1e4685(0x2de)](_0x2a6989,_0x1e4685(0x22e)),_0x404c54=a179_0x62086b[_0x1e4685(0x2de)](_0x2a6989,'files');if(!a179_0x2ad1cd[_0x1e4685(0x1f8)](_0xf60de7)||!a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x1d3bb2))continue;const _0x26ab03=parseExperimentalArtifactYaml(a179_0x2ad1cd[_0x1e4685(0x255)](_0xf60de7,_0x1e4685(0x1e1)),_0xf60de7),_0x9e8b6a=a179_0x2ad1cd[_0x1e4685(0x255)](_0x1d3bb2,_0x1e4685(0x1e1)),_0x2a6c32=[];if(a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x404c54)){const _0x180cbf=a179_0x2ad1cd[_0x1e4685(0x262)](_0x404c54);for(const _0x59df0e of _0x180cbf){const _0x5d4498=a179_0x62086b['join'](_0x404c54,_0x59df0e);a179_0x2ad1cd['statSync'](_0x5d4498)[_0x1e4685(0x2c2)]()&&_0x2a6c32[_0x1e4685(0x204)]({'file_name':_0x59df0e,'text_content':a179_0x2ad1cd[_0x1e4685(0x255)](_0x5d4498,_0x1e4685(0x1e1))});}}const _0x18b493={..._0x26ab03,'code':_0x9e8b6a,'files':_0x2a6c32};_0x43635d[_0x1e4685(0x204)]({'name':_0x26ab03[_0x1e4685(0x1eb)],'dir':_0x2a6989,'def':_0x18b493});}}const _0x42f418=[],_0xb1acfe=getFormInterfacesDir(_0x4acf48);if(a179_0x2ad1cd[_0x1e4685(0x1f8)](_0xb1acfe)){const _0x98dd5e=a179_0x2ad1cd[_0x1e4685(0x262)](_0xb1acfe)[_0x1e4685(0x2a2)](_0x41e9d8=>_0x41e9d8[_0x1e4685(0x2d6)]('.yml'));for(const _0x32ce40 of _0x98dd5e){const _0x2ae4ce=a179_0x62086b[_0x1e4685(0x2de)](_0xb1acfe,_0x32ce40),_0x4c0c6c=parseFormInterfaceYaml(a179_0x2ad1cd['readFileSync'](_0x2ae4ce,'utf-8'),_0x2ae4ce);_0x42f418[_0x1e4685(0x204)]({'name':_0x4c0c6c[_0x1e4685(0x1eb)],'path':_0x2ae4ce,'yaml':_0x4c0c6c});}}const _0x2084e8=[],_0x4e4ed0=getChatInterfacesDir(_0x4acf48);if(a179_0x2ad1cd[_0x1e4685(0x1f8)](_0x4e4ed0)){const _0x29e914=a179_0x2ad1cd[_0x1e4685(0x262)](_0x4e4ed0)[_0x1e4685(0x2a2)](_0x2911e8=>_0x2911e8[_0x1e4685(0x2d6)](_0x1e4685(0x254)));for(const _0x43a58b of _0x29e914){const _0x512340=a179_0x62086b['join'](_0x4e4ed0,_0x43a58b),_0x5d8b75=parseChatInterfaceYaml(a179_0x2ad1cd[_0x1e4685(0x255)](_0x512340,_0x1e4685(0x1e1)),_0x512340);_0x2084e8[_0x1e4685(0x204)]({'name':_0x5d8b75['name'],'path':_0x512340,'yaml':_0x5d8b75});}}const _0xd109af=await this[_0x1e4685(0x225)][_0x1e4685(0x220)](_0x5b97bb),_0x381196=await this[_0x1e4685(0x225)][_0x1e4685(0x281)](_0x5b97bb),_0x45b6df=await this[_0x1e4685(0x225)][_0x1e4685(0x26a)](_0x5b97bb),_0x31ac02=await this['client']['listPrompts'](_0x5b97bb),_0x1319bf=await this['client'][_0x1e4685(0x286)](_0x5b97bb),_0x22c966=await safeListOrEmpty(()=>this[_0x1e4685(0x225)][_0x1e4685(0x1fb)](_0x5b97bb)),_0x5a0109=await safeListOrEmpty(()=>this[_0x1e4685(0x225)][_0x1e4685(0x273)](_0x5b97bb)),_0x2576e3=await safeListOrEmpty(()=>this[_0x1e4685(0x225)][_0x1e4685(0x1d5)](_0x5b97bb)),_0x325814=await safeListOrEmpty(()=>this[_0x1e4685(0x225)][_0x1e4685(0x1e8)](_0x5b97bb)),_0x44a367=await fetchAllToolTargetMaps((_0x520833,_0x30b94a)=>this['client'][_0x1e4685(0x2d7)](_0x520833,_0x30b94a),_0x5b97bb),_0xef923=new Map(),_0x2b9bd0=new Map(),_0x1f3c1e=new Map(),_0x44e03f=new Map(),_0x225fae=new Map(),_0x5a1a4d=new Map(),_0x286294=new Map();for(const _0x2295df of _0xd109af){_0xef923[_0x1e4685(0x2a5)](_0x2295df['attributes'][_0x1e4685(0x1eb)],_0x2295df);}for(const _0x32d81e of _0x381196){_0x2b9bd0[_0x1e4685(0x2a5)](_0x32d81e[_0x1e4685(0x26d)][_0x1e4685(0x1eb)],_0x32d81e);}for(const _0x389361 of _0x45b6df){_0x1f3c1e[_0x1e4685(0x2a5)](_0x389361[_0x1e4685(0x26d)][_0x1e4685(0x1eb)],_0x389361);}for(const _0x4749ad of _0x31ac02){_0x44e03f[_0x1e4685(0x2a5)](_0x4749ad[_0x1e4685(0x26d)]['name'],_0x4749ad);}for(const _0x4da650 of _0x1319bf){_0x225fae['set'](_0x4da650[_0x1e4685(0x26d)]['serviceType'][_0x1e4685(0x2a4)](),_0x4da650);}for(const _0x5691ba of _0x22c966){_0x5a1a4d[_0x1e4685(0x2a5)](_0x5691ba[_0x1e4685(0x26d)]['name'],_0x5691ba);}for(const _0x4eedcc of _0x5a0109){_0x286294[_0x1e4685(0x2a5)](_0x4eedcc['attributes'][_0x1e4685(0x1eb)],_0x4eedcc);}const _0x5b8320=new Map(),_0x34ed60=new Map();for(const _0x5b16c2 of _0x2576e3){_0x5b8320[_0x1e4685(0x2a5)](_0x5b16c2[_0x1e4685(0x26d)][_0x1e4685(0x1eb)],_0x5b16c2);}for(const _0x2c0819 of _0x325814){_0x34ed60[_0x1e4685(0x2a5)](_0x2c0819[_0x1e4685(0x26d)]['name'],_0x2c0819);}const _0x48507d=new Map(),_0x37ccc1=new Map();for(const _0x5322a0 of _0xd109af){_0x48507d[_0x1e4685(0x2a5)](_0x5322a0['attributes'][_0x1e4685(0x1eb)],_0x5322a0['id']),_0x37ccc1[_0x1e4685(0x2a5)](_0x5322a0['id'],_0x5322a0[_0x1e4685(0x26d)]['name']);}const _0x6bf01=new Map(),_0x552ecf=new Map();for(const _0x3944f7 of _0x31ac02){_0x6bf01['set'](_0x3944f7['attributes'][_0x1e4685(0x1eb)],_0x3944f7['id']),_0x552ecf[_0x1e4685(0x2a5)](_0x3944f7['id'],_0x3944f7['attributes'][_0x1e4685(0x1eb)]);}const _0x547e80=_0x44a367[_0x1e4685(0x25f)][_0x1e4685(0x291)]||new Map(),_0x45fb75=_0x44a367[_0x1e4685(0x25f)][_0x1e4685(0x26e)]||new Map(),_0x17c5c7=_0x44a367[_0x1e4685(0x25f)][_0x1e4685(0x208)]||new Map(),_0x5badb8=new Map(),_0x233cb0={'resolveToolTargetName':buildNameResolver({..._0x44a367[_0x1e4685(0x1e3)],'Agent':_0x37ccc1}),'resolvePromptName':async _0x380743=>_0x552ecf[_0x1e4685(0x201)](_0x380743),'onWarning':_0xed9ce=>this['logger'][_0x1e4685(0x1ee)](_0xed9ce)};let _0x1fb1c9=[];const _0x3d48d9={'projectId':_0x5b97bb,'resolveToolTargetId':buildIdResolver({..._0x44a367[_0x1e4685(0x25f)],'Agent':_0x48507d}),'resolvePromptId':async _0x4b96a3=>_0x6bf01['get'](_0x4b96a3),'onWarning':_0x277183=>{const _0x676dfb=_0x1e4685;this[_0x676dfb(0x24d)][_0x676dfb(0x1ee)](_0x277183),_0x1fb1c9[_0x676dfb(0x204)](_0x277183);}},{resolved:_0x31a362,unresolved:_0x234741}=resolveAgentDependencies(_0x3c7cc4,new Set(_0xef923[_0x1e4685(0x2a3)]()));for(const {agent:_0x3db543,missingDeps:_0x2ece87}of _0x234741){_0x2943c4[_0x1e4685(0x29a)][_0x1e4685(0x204)]({'agentName':_0x3db543[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2f3),'error':_0x1e4685(0x2d5)+_0x2ece87[_0x1e4685(0x2de)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x29a)][_0x1e4685(0x217)]++;}for(const _0x2fe862 of _0x1779b1){const _0x462a7b=_0x2b9bd0[_0x1e4685(0x201)](_0x2fe862['yaml'][_0x1e4685(0x1eb)]),_0x353992=a179_0x2ad1cd[_0x1e4685(0x255)](_0x2fe862[_0x1e4685(0x216)],_0x1e4685(0x1e1));if(_0x462a7b){const _0x31c783=apiKnowledgeBaseToYaml(_0x462a7b),_0x428c29=toKnowledgeBaseYamlString(_0x31c783),_0x21ca0c=generateDiff(_0x428c29,_0x353992),_0x5510e5=hasChanges(_0x21ca0c);_0x5510e5?(_0x2943c4['knowledgeBases'][_0x1e4685(0x204)]({'name':_0x2fe862[_0x1e4685(0x23d)]['name'],'action':_0x1e4685(0x265),'id':_0x462a7b['id'],'diff':formatDiffWithColors(_0x21ca0c)}),_0x2943c4['counts'][_0x1e4685(0x2cc)][_0x1e4685(0x265)]++):(_0x2943c4[_0x1e4685(0x2cc)]['push']({'name':_0x2fe862[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x233),'id':_0x462a7b['id']}),_0x2943c4['counts'][_0x1e4685(0x2cc)][_0x1e4685(0x233)]++);}else _0x2943c4[_0x1e4685(0x2cc)][_0x1e4685(0x204)]({'name':_0x2fe862[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc)}),_0x2943c4['counts']['knowledgeBases']['created']++;}for(const _0x32d1ec of _0x559bca){const _0x224186=_0x1f3c1e[_0x1e4685(0x201)](_0x32d1ec['name']),_0x49c4e8=a179_0x2ad1cd['readFileSync'](_0x32d1ec[_0x1e4685(0x216)],_0x1e4685(0x1e1));if(_0x224186){const _0x52f2a0=toTextKnowledgeBaseMd(_0x224186[_0x1e4685(0x26d)][_0x1e4685(0x1eb)],_0x224186['attributes'][_0x1e4685(0x2f2)]),_0x23a184=generateDiff(_0x52f2a0,_0x49c4e8),_0x15ab0e=hasChanges(_0x23a184);_0x15ab0e?(_0x2943c4['textKnowledgeBases'][_0x1e4685(0x204)]({'name':_0x32d1ec[_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0x224186['id'],'diff':formatDiffWithColors(_0x23a184)}),_0x2943c4['counts']['textKnowledgeBases']['updated']++):(_0x2943c4[_0x1e4685(0x25a)][_0x1e4685(0x204)]({'name':_0x32d1ec['name'],'action':'unchanged','id':_0x224186['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x25a)][_0x1e4685(0x233)]++);}else _0x2943c4[_0x1e4685(0x25a)]['push']({'name':_0x32d1ec[_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc)}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x25a)][_0x1e4685(0x2dc)]++;}for(const _0x435ed7 of _0x31a362){const _0x38d546=_0xef923[_0x1e4685(0x201)](_0x435ed7[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x42015e=a179_0x62086b[_0x1e4685(0x2de)](_0x435ed7[_0x1e4685(0x274)],_0x1e4685(0x2b3)),_0x2c6f04=a179_0x2ad1cd[_0x1e4685(0x255)](_0x42015e,_0x1e4685(0x1e1)),_0x1a6b2d=_0x435ed7[_0x1e4685(0x250)],_0xbc72e1=_0x1e4685(0x25e)+_0x1a6b2d+'\x0a\x0a#\x20agent.yml\x0a'+_0x2c6f04;if(_0x38d546){const {yaml:_0x5716fe,systemPrompt:_0x59c2a1}=await agentResponseToDef(_0x38d546,_0x233cb0),_0x2b9d20=toAgentYamlString(_0x5716fe),_0x11b193=_0x1e4685(0x25e)+_0x59c2a1+_0x1e4685(0x2f1)+_0x2b9d20,_0x3cfa08=generateDiff(_0x11b193,_0xbc72e1),_0x1c846b=hasChanges(_0x3cfa08);_0x1c846b?(_0x2943c4[_0x1e4685(0x29a)][_0x1e4685(0x204)]({'agentName':_0x435ed7['yaml'][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'agentId':_0x38d546['id'],'diff':formatDiffWithColors(_0x3cfa08)}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x29a)][_0x1e4685(0x265)]++):(_0x2943c4[_0x1e4685(0x29a)][_0x1e4685(0x204)]({'agentName':_0x435ed7[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x233),'agentId':_0x38d546['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x29a)][_0x1e4685(0x233)]++);}else _0x2943c4[_0x1e4685(0x29a)][_0x1e4685(0x204)]({'agentName':_0x435ed7[_0x1e4685(0x23d)]['name'],'action':_0x1e4685(0x2dc)}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x29a)][_0x1e4685(0x2dc)]++;}for(const _0x595db1 of _0x2674fa){const _0x7b06ee=_0x44e03f['get'](_0x595db1[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x164e44=a179_0x2ad1cd[_0x1e4685(0x255)](_0x595db1[_0x1e4685(0x216)],_0x1e4685(0x1e1));if(_0x7b06ee){const _0x15d984=await apiPromptToYaml(_0x7b06ee,_0x233cb0);if(!_0x15d984){_0x2943c4[_0x1e4685(0x22b)][_0x1e4685(0x204)]({'name':_0x595db1[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0x7b06ee['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x22b)][_0x1e4685(0x265)]++;continue;}const _0x1fec1f=toPromptYamlString(_0x15d984),_0x5d1f5c=generateDiff(_0x1fec1f,_0x164e44),_0x385de5=hasChanges(_0x5d1f5c);_0x385de5?(_0x2943c4['prompts']['push']({'name':_0x595db1['yaml'][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0x7b06ee['id'],'diff':formatDiffWithColors(_0x5d1f5c)}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x22b)]['updated']++):(_0x2943c4[_0x1e4685(0x22b)][_0x1e4685(0x204)]({'name':_0x595db1[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x233),'id':_0x7b06ee['id']}),_0x2943c4[_0x1e4685(0x2b7)]['prompts'][_0x1e4685(0x233)]++);}else _0x2943c4['prompts']['push']({'name':_0x595db1['yaml'][_0x1e4685(0x1eb)],'action':'created'}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x22b)][_0x1e4685(0x2dc)]++;}for(const _0x41b9ee of _0x4bf938){const _0x574245=_0x225fae[_0x1e4685(0x201)](_0x41b9ee[_0x1e4685(0x23d)][_0x1e4685(0x259)]),_0x377313=a179_0x2ad1cd[_0x1e4685(0x255)](_0x41b9ee[_0x1e4685(0x216)],_0x1e4685(0x1e1));if(_0x574245){const _0x39673d=await apiIntegrationToYaml(_0x574245,_0x233cb0),_0x3fdee2=toIntegrationYamlString(_0x39673d),_0x4801ea=generateDiff(_0x3fdee2,_0x377313),_0x18e63d=hasChanges(_0x4801ea);_0x18e63d?(_0x2943c4[_0x1e4685(0x263)][_0x1e4685(0x204)]({'name':_0x41b9ee[_0x1e4685(0x23d)][_0x1e4685(0x259)],'action':_0x1e4685(0x265),'id':_0x574245['id'],'diff':formatDiffWithColors(_0x4801ea)}),_0x2943c4['counts']['integrations'][_0x1e4685(0x265)]++):(_0x2943c4[_0x1e4685(0x263)][_0x1e4685(0x204)]({'name':_0x41b9ee[_0x1e4685(0x23d)]['service_type'],'action':_0x1e4685(0x233),'id':_0x574245['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x263)][_0x1e4685(0x233)]++);}else _0x2943c4[_0x1e4685(0x263)][_0x1e4685(0x204)]({'name':_0x41b9ee[_0x1e4685(0x23d)]['service_type'],'action':'created'}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x263)][_0x1e4685(0x2dc)]++;}for(const _0x282c92 of _0x182446){const _0x413d1f=_0x5a1a4d[_0x1e4685(0x201)](_0x282c92['def'][_0x1e4685(0x1eb)]),_0x185575=toExperimentalKnowledgeBaseYamlString(_0x282c92[_0x1e4685(0x22c)]);let _0x557545=_0x185575;for(const _0x4acae1 of _0x282c92['def'][_0x1e4685(0x24e)]){_0x557545+='\x0a---\x20function:\x20'+_0x4acae1[_0x1e4685(0x1eb)]+_0x1e4685(0x28f)+_0x4acae1[_0x1e4685(0x2ab)]+_0x1e4685(0x1e9)+_0x4acae1[_0x1e4685(0x1eb)]+_0x1e4685(0x28f)+_0x4acae1[_0x1e4685(0x25c)]+'\x0a';}if(_0x413d1f){const _0x4f4920=apiExperimentalKnowledgeBaseToYaml(_0x413d1f),_0x753585=toExperimentalKnowledgeBaseYamlString(_0x4f4920);let _0x19b677=_0x753585;for(const _0x1fdf6d of _0x4f4920[_0x1e4685(0x24e)]){_0x19b677+=_0x1e4685(0x210)+_0x1fdf6d[_0x1e4685(0x1eb)]+'\x20---\x0a'+_0x1fdf6d[_0x1e4685(0x2ab)]+_0x1e4685(0x1e9)+_0x1fdf6d[_0x1e4685(0x1eb)]+_0x1e4685(0x28f)+_0x1fdf6d[_0x1e4685(0x25c)]+'\x0a';}const _0x346b28=generateDiff(_0x19b677,_0x557545),_0x1f10d7=hasChanges(_0x346b28);_0x1f10d7?(_0x2943c4[_0x1e4685(0x2a7)]['push']({'name':_0x282c92[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0x413d1f['id'],'diff':formatDiffWithColors(_0x346b28)}),_0x2943c4['counts'][_0x1e4685(0x2a7)]['updated']++):(_0x2943c4[_0x1e4685(0x2a7)][_0x1e4685(0x204)]({'name':_0x282c92[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x233),'id':_0x413d1f['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2a7)][_0x1e4685(0x233)]++);}else _0x2943c4[_0x1e4685(0x2a7)][_0x1e4685(0x204)]({'name':_0x282c92[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],'action':'created'}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2a7)][_0x1e4685(0x2dc)]++;}for(const _0x2b49a7 of _0x43635d){const _0x1ad404=_0x286294[_0x1e4685(0x201)](_0x2b49a7[_0x1e4685(0x22c)]['name']),_0x5e8112=toExperimentalArtifactYamlString(_0x2b49a7['def']);let _0x19be1c=_0x5e8112+(_0x1e4685(0x285)+_0x2b49a7[_0x1e4685(0x22c)][_0x1e4685(0x2ab)]+'\x0a');for(const _0x5e9119 of _0x2b49a7['def'][_0x1e4685(0x253)]){_0x19be1c+=_0x1e4685(0x272)+_0x5e9119[_0x1e4685(0x2e3)]+_0x1e4685(0x28f)+_0x5e9119['text_content']+'\x0a';}if(_0x1ad404){const _0x39cc52=apiExperimentalArtifactToYaml(_0x1ad404),_0x5ce021=toExperimentalArtifactYamlString(_0x39cc52);let _0x2afa6=_0x5ce021+('\x0a---\x20code\x20---\x0a'+_0x39cc52[_0x1e4685(0x2ab)]+'\x0a');for(const _0x496e9b of _0x39cc52['files']){_0x2afa6+=_0x1e4685(0x272)+_0x496e9b[_0x1e4685(0x2e3)]+'\x20---\x0a'+_0x496e9b['text_content']+'\x0a';}const _0x42ad12=generateDiff(_0x2afa6,_0x19be1c),_0x3ddf80=hasChanges(_0x42ad12);_0x3ddf80?(_0x2943c4[_0x1e4685(0x299)]['push']({'name':_0x2b49a7[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0x1ad404['id'],'diff':formatDiffWithColors(_0x42ad12)}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x299)][_0x1e4685(0x265)]++):(_0x2943c4[_0x1e4685(0x299)][_0x1e4685(0x204)]({'name':_0x2b49a7['def'][_0x1e4685(0x1eb)],'action':'unchanged','id':_0x1ad404['id']}),_0x2943c4['counts'][_0x1e4685(0x299)][_0x1e4685(0x233)]++);}else _0x2943c4[_0x1e4685(0x299)][_0x1e4685(0x204)]({'name':_0x2b49a7[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc)}),_0x2943c4['counts'][_0x1e4685(0x299)]['created']++;}for(const _0x5535d8 of _0x42f418){const _0x27dfbe=_0x5b8320['get'](_0x5535d8[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x313db2=a179_0x2ad1cd['readFileSync'](_0x5535d8['path'],'utf-8');if(_0x27dfbe){const _0x43468c=await apiFormInterfaceToYaml(_0x27dfbe,_0x233cb0),_0x27e56d=toFormInterfaceYamlString(_0x43468c),_0x432bf8=generateDiff(_0x27e56d,_0x313db2),_0x36252f=hasChanges(_0x432bf8);_0x36252f?(_0x2943c4['formInterfaces'][_0x1e4685(0x204)]({'name':_0x5535d8['yaml']['name'],'action':_0x1e4685(0x265),'id':_0x27dfbe['id'],'diff':formatDiffWithColors(_0x432bf8)}),_0x2943c4[_0x1e4685(0x2b7)]['formInterfaces'][_0x1e4685(0x265)]++):(_0x2943c4[_0x1e4685(0x24b)][_0x1e4685(0x204)]({'name':_0x5535d8[_0x1e4685(0x23d)]['name'],'action':_0x1e4685(0x233),'id':_0x27dfbe['id']}),_0x2943c4[_0x1e4685(0x2b7)]['formInterfaces']['unchanged']++);}else _0x2943c4[_0x1e4685(0x24b)][_0x1e4685(0x204)]({'name':_0x5535d8[_0x1e4685(0x23d)]['name'],'action':'created'}),_0x2943c4['counts'][_0x1e4685(0x24b)][_0x1e4685(0x2dc)]++;}for(const _0xaafdcf of _0x2084e8){const _0x185aa4=_0x34ed60['get'](_0xaafdcf[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x15b81f=a179_0x2ad1cd[_0x1e4685(0x255)](_0xaafdcf[_0x1e4685(0x216)],_0x1e4685(0x1e1));if(_0x185aa4){const _0x513b1d=await apiChatInterfaceToYaml(_0x185aa4,_0x233cb0),_0x31a7e8=toChatInterfaceYamlString(_0x513b1d),_0x3aaf80=generateDiff(_0x31a7e8,_0x15b81f),_0x8ed2a0=hasChanges(_0x3aaf80);_0x8ed2a0?(_0x2943c4[_0x1e4685(0x2ac)]['push']({'name':_0xaafdcf[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':'updated','id':_0x185aa4['id'],'diff':formatDiffWithColors(_0x3aaf80)}),_0x2943c4['counts'][_0x1e4685(0x2ac)][_0x1e4685(0x265)]++):(_0x2943c4[_0x1e4685(0x2ac)][_0x1e4685(0x204)]({'name':_0xaafdcf[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':'unchanged','id':_0x185aa4['id']}),_0x2943c4[_0x1e4685(0x2b7)]['chatInterfaces'][_0x1e4685(0x233)]++);}else _0x2943c4[_0x1e4685(0x2ac)][_0x1e4685(0x204)]({'name':_0xaafdcf[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc)}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2ac)][_0x1e4685(0x2dc)]++;}if(_0x424441?.[_0x1e4685(0x1ea)])return _0x2943c4;_0x2943c4['knowledgeBases']=[],_0x2943c4[_0x1e4685(0x25a)]=[],_0x2943c4[_0x1e4685(0x22b)]=[],_0x2943c4['integrations']=[],_0x2943c4[_0x1e4685(0x2a7)]=[],_0x2943c4[_0x1e4685(0x299)]=[],_0x2943c4[_0x1e4685(0x24b)]=[],_0x2943c4[_0x1e4685(0x2ac)]=[];const _0x550e89=_0x2943c4['agents'][_0x1e4685(0x2a2)](_0x2bbf96=>_0x2bbf96[_0x1e4685(0x279)]===_0x1e4685(0x2f3));_0x2943c4[_0x1e4685(0x29a)]=_0x550e89,_0x2943c4[_0x1e4685(0x2b7)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x550e89[_0x1e4685(0x2c0)]},'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 _0x3e7c7e of _0x1779b1){try{const _0x58c084=_0x2b9bd0[_0x1e4685(0x201)](_0x3e7c7e[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x320cd6=yamlKnowledgeBaseToApi(_0x3e7c7e[_0x1e4685(0x23d)],_0x5b97bb);if(_0x58c084)await this[_0x1e4685(0x225)]['updateKnowledgeBase'](_0x58c084['id'],_0x320cd6),_0x547e80[_0x1e4685(0x2a5)](_0x3e7c7e['yaml'][_0x1e4685(0x1eb)],_0x58c084['id']),_0x2943c4[_0x1e4685(0x2cc)][_0x1e4685(0x204)]({'name':_0x3e7c7e[_0x1e4685(0x23d)]['name'],'action':'updated','id':_0x58c084['id']}),_0x2943c4[_0x1e4685(0x2b7)]['knowledgeBases'][_0x1e4685(0x265)]++;else{const _0x2da7fc=await this[_0x1e4685(0x225)]['createKnowledgeBase'](_0x320cd6);_0x547e80[_0x1e4685(0x2a5)](_0x3e7c7e['yaml'][_0x1e4685(0x1eb)],_0x2da7fc['id']),_0x2943c4['knowledgeBases']['push']({'name':_0x3e7c7e[_0x1e4685(0x23d)]['name'],'action':_0x1e4685(0x2dc),'id':_0x2da7fc['id']}),_0x2943c4[_0x1e4685(0x2b7)]['knowledgeBases'][_0x1e4685(0x2dc)]++;}}catch(_0x42788f){_0x2943c4[_0x1e4685(0x2cc)][_0x1e4685(0x204)]({'name':_0x3e7c7e[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2f3),'error':_0x42788f['message']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2cc)][_0x1e4685(0x217)]++;}}for(const _0x19c968 of _0x559bca){try{const _0xdc3d43=_0x1f3c1e[_0x1e4685(0x201)](_0x19c968[_0x1e4685(0x1eb)]),_0x50047b=yamlTextKnowledgeBaseToApi({'name':_0x19c968[_0x1e4685(0x1eb)],'text':_0x19c968[_0x1e4685(0x2f2)]},_0x5b97bb);if(_0xdc3d43)await this[_0x1e4685(0x225)]['updateTextKnowledgeBase'](_0xdc3d43['id'],_0x50047b),_0x45fb75[_0x1e4685(0x2a5)](_0x19c968[_0x1e4685(0x1eb)],_0xdc3d43['id']),_0x2943c4[_0x1e4685(0x25a)][_0x1e4685(0x204)]({'name':_0x19c968[_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0xdc3d43['id']}),_0x2943c4['counts'][_0x1e4685(0x25a)][_0x1e4685(0x265)]++;else{const _0x81bb53=await this[_0x1e4685(0x225)][_0x1e4685(0x287)](_0x50047b);_0x45fb75['set'](_0x19c968[_0x1e4685(0x1eb)],_0x81bb53['id']),_0x2943c4[_0x1e4685(0x25a)][_0x1e4685(0x204)]({'name':_0x19c968[_0x1e4685(0x1eb)],'action':'created','id':_0x81bb53['id']}),_0x2943c4['counts'][_0x1e4685(0x25a)][_0x1e4685(0x2dc)]++;}}catch(_0x215ff8){_0x2943c4[_0x1e4685(0x25a)][_0x1e4685(0x204)]({'name':_0x19c968[_0x1e4685(0x1eb)],'action':'error','error':_0x215ff8[_0x1e4685(0x228)]}),_0x2943c4['counts']['textKnowledgeBases'][_0x1e4685(0x217)]++;}}for(const _0x2f41ec of _0x182446){try{const _0x41191a=_0x5a1a4d['get'](_0x2f41ec[_0x1e4685(0x22c)][_0x1e4685(0x1eb)]),_0x5b21aa=yamlExperimentalKnowledgeBaseToApi(_0x2f41ec[_0x1e4685(0x22c)],_0x5b97bb);if(_0x41191a)await this[_0x1e4685(0x225)][_0x1e4685(0x212)](_0x41191a['id'],_0x5b21aa),_0x17c5c7[_0x1e4685(0x2a5)](_0x2f41ec['def'][_0x1e4685(0x1eb)],_0x41191a['id']),_0x2943c4[_0x1e4685(0x2a7)]['push']({'name':_0x2f41ec['def']['name'],'action':_0x1e4685(0x265),'id':_0x41191a['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2a7)][_0x1e4685(0x265)]++;else{const _0x351eee=await this[_0x1e4685(0x225)][_0x1e4685(0x22f)](_0x5b21aa);_0x17c5c7[_0x1e4685(0x2a5)](_0x2f41ec[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],_0x351eee['id']),_0x2943c4[_0x1e4685(0x2a7)][_0x1e4685(0x204)]({'name':_0x2f41ec[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc),'id':_0x351eee['id']}),_0x2943c4[_0x1e4685(0x2b7)]['experimentalKnowledgeBases'][_0x1e4685(0x2dc)]++;}}catch(_0x383c26){_0x2943c4['experimentalKnowledgeBases'][_0x1e4685(0x204)]({'name':_0x2f41ec[_0x1e4685(0x22c)]['name'],'action':'error','error':_0x383c26[_0x1e4685(0x228)]}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2a7)][_0x1e4685(0x217)]++;}}for(const _0x4f7868 of _0x43635d){try{const _0x5a1a54=_0x286294[_0x1e4685(0x201)](_0x4f7868[_0x1e4685(0x22c)][_0x1e4685(0x1eb)]),_0x205304=yamlExperimentalArtifactToApi(_0x4f7868['def'],_0x5b97bb);if(_0x5a1a54)await this['client'][_0x1e4685(0x2b1)](_0x5a1a54['id'],_0x205304),_0x5badb8[_0x1e4685(0x2a5)](_0x4f7868['def'][_0x1e4685(0x1eb)],_0x5a1a54['id']),_0x2943c4[_0x1e4685(0x299)][_0x1e4685(0x204)]({'name':_0x4f7868[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0x5a1a54['id']}),_0x2943c4[_0x1e4685(0x2b7)]['experimentalArtifacts'][_0x1e4685(0x265)]++;else{const _0x2856f1=await this['client']['createExperimentalArtifact'](_0x205304);_0x5badb8[_0x1e4685(0x2a5)](_0x4f7868[_0x1e4685(0x22c)][_0x1e4685(0x1eb)],_0x2856f1['id']),_0x2943c4[_0x1e4685(0x299)]['push']({'name':_0x4f7868['def'][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc),'id':_0x2856f1['id']}),_0x2943c4[_0x1e4685(0x2b7)]['experimentalArtifacts'][_0x1e4685(0x2dc)]++;}}catch(_0x252760){_0x2943c4[_0x1e4685(0x299)]['push']({'name':_0x4f7868['def']['name'],'action':'error','error':_0x252760[_0x1e4685(0x228)]}),_0x2943c4['counts'][_0x1e4685(0x299)][_0x1e4685(0x217)]++;}}for(const _0x4a745d of _0x31a362){_0x1fb1c9=[];try{const _0x2cd403=_0xef923[_0x1e4685(0x201)](_0x4a745d[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x13c784=await agentDefToRequest(_0x4a745d[_0x1e4685(0x23d)],_0x4a745d[_0x1e4685(0x250)],_0x4a745d[_0x1e4685(0x2da)],_0x3d48d9);if(_0x2cd403)await this[_0x1e4685(0x225)][_0x1e4685(0x2cb)](_0x2cd403['id'],_0x13c784),_0x48507d[_0x1e4685(0x2a5)](_0x4a745d[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],_0x2cd403['id']),_0x2943c4['agents'][_0x1e4685(0x204)]({'agentName':_0x4a745d[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'agentId':_0x2cd403['id'],'warnings':_0x1fb1c9[_0x1e4685(0x2c0)]>0x0?_0x1fb1c9:undefined}),_0x2943c4['counts'][_0x1e4685(0x29a)][_0x1e4685(0x265)]++;else{const _0x3bbc13=await this[_0x1e4685(0x225)][_0x1e4685(0x2d8)](_0x13c784);_0x48507d[_0x1e4685(0x2a5)](_0x4a745d['yaml']['name'],_0x3bbc13['id']),_0x2943c4[_0x1e4685(0x29a)][_0x1e4685(0x204)]({'agentName':_0x4a745d[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc),'agentId':_0x3bbc13['id'],'warnings':_0x1fb1c9[_0x1e4685(0x2c0)]>0x0?_0x1fb1c9:undefined}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x29a)]['created']++;}}catch(_0x4590b4){_0x2943c4[_0x1e4685(0x29a)][_0x1e4685(0x204)]({'agentName':_0x4a745d[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2f3),'error':_0x4590b4['message'],'warnings':_0x1fb1c9[_0x1e4685(0x2c0)]>0x0?_0x1fb1c9:undefined}),_0x2943c4['counts'][_0x1e4685(0x29a)][_0x1e4685(0x217)]++;}}for(const _0x1c5416 of _0x2674fa){try{const _0x362c78=_0x44e03f[_0x1e4685(0x201)](_0x1c5416[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x6323bf=await yamlPromptToApi(_0x1c5416[_0x1e4685(0x23d)],_0x5b97bb,_0x3d48d9);if(!_0x6323bf){_0x2943c4[_0x1e4685(0x22b)][_0x1e4685(0x204)]({'name':_0x1c5416[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2f3),'error':_0x1e4685(0x1da)}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x22b)][_0x1e4685(0x217)]++;continue;}if(_0x362c78)await this[_0x1e4685(0x225)][_0x1e4685(0x1fe)](_0x362c78['id'],_0x6323bf),_0x6bf01[_0x1e4685(0x2a5)](_0x1c5416[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],_0x362c78['id']),_0x2943c4[_0x1e4685(0x22b)][_0x1e4685(0x204)]({'name':_0x1c5416['yaml']['name'],'action':_0x1e4685(0x265),'id':_0x362c78['id']}),_0x2943c4[_0x1e4685(0x2b7)]['prompts'][_0x1e4685(0x265)]++;else{const _0x39c294=await this[_0x1e4685(0x225)][_0x1e4685(0x207)](_0x6323bf);_0x6bf01[_0x1e4685(0x2a5)](_0x1c5416[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],_0x39c294['id']),_0x2943c4['prompts'][_0x1e4685(0x204)]({'name':_0x1c5416[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc),'id':_0x39c294['id']}),_0x2943c4['counts'][_0x1e4685(0x22b)][_0x1e4685(0x2dc)]++;}}catch(_0xc8959e){_0x2943c4[_0x1e4685(0x22b)][_0x1e4685(0x204)]({'name':_0x1c5416[_0x1e4685(0x23d)]['name'],'action':'error','error':_0xc8959e[_0x1e4685(0x228)]}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x22b)]['errors']++;}}for(const _0x1f80f4 of _0x4bf938){try{const _0xe64ccb=_0x225fae['get'](_0x1f80f4[_0x1e4685(0x23d)]['service_type']),_0x3ca9af=await yamlIntegrationToApi(_0x1f80f4[_0x1e4685(0x23d)],_0x5b97bb,_0x3d48d9);if(_0xe64ccb){await this['client'][_0x1e4685(0x1d8)](_0xe64ccb['id']);const _0x3acf1e=await this[_0x1e4685(0x225)]['createIntegration'](_0x3ca9af);_0x2943c4['integrations'][_0x1e4685(0x204)]({'name':_0x1f80f4['yaml']['service_type'],'action':'updated','id':_0x3acf1e['id']}),_0x2943c4['counts'][_0x1e4685(0x263)][_0x1e4685(0x265)]++;}else{const _0x5a5ad9=await this[_0x1e4685(0x225)][_0x1e4685(0x25b)](_0x3ca9af);_0x2943c4[_0x1e4685(0x263)][_0x1e4685(0x204)]({'name':_0x1f80f4[_0x1e4685(0x23d)]['service_type'],'action':_0x1e4685(0x2dc),'id':_0x5a5ad9['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x263)]['created']++;}}catch(_0x2f75c8){_0x2943c4[_0x1e4685(0x263)][_0x1e4685(0x204)]({'name':_0x1f80f4[_0x1e4685(0x23d)][_0x1e4685(0x259)],'action':_0x1e4685(0x2f3),'error':_0x2f75c8[_0x1e4685(0x228)]}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x263)]['errors']++;}}for(const _0x162cba of _0x42f418){try{const _0x107ce0=_0x5b8320[_0x1e4685(0x201)](_0x162cba[_0x1e4685(0x23d)][_0x1e4685(0x1eb)]),_0x5f0259=await yamlFormInterfaceToApi(_0x162cba[_0x1e4685(0x23d)],_0x5b97bb,_0x3d48d9);if(!_0x5f0259){_0x2943c4[_0x1e4685(0x24b)][_0x1e4685(0x204)]({'name':_0x162cba['yaml'][_0x1e4685(0x1eb)],'action':'error','error':_0x1e4685(0x2c8)}),_0x2943c4[_0x1e4685(0x2b7)]['formInterfaces']['errors']++;continue;}if(_0x107ce0){const _0x2a8344=await this[_0x1e4685(0x225)][_0x1e4685(0x22d)](_0x107ce0['id'],_0x5f0259);_0x2943c4['formInterfaces']['push']({'name':_0x162cba[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':'updated','id':_0x2a8344['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x24b)][_0x1e4685(0x265)]++;}else{const _0x1d4e75=await this[_0x1e4685(0x225)][_0x1e4685(0x243)](_0x5f0259);_0x2943c4[_0x1e4685(0x24b)][_0x1e4685(0x204)]({'name':_0x162cba['yaml'][_0x1e4685(0x1eb)],'action':_0x1e4685(0x2dc),'id':_0x1d4e75['id']}),_0x2943c4['counts'][_0x1e4685(0x24b)][_0x1e4685(0x2dc)]++;}}catch(_0x43da87){_0x2943c4[_0x1e4685(0x24b)][_0x1e4685(0x204)]({'name':_0x162cba[_0x1e4685(0x23d)]['name'],'action':_0x1e4685(0x2f3),'error':_0x43da87[_0x1e4685(0x228)]}),_0x2943c4[_0x1e4685(0x2b7)]['formInterfaces'][_0x1e4685(0x217)]++;}}for(const _0x5e3e34 of _0x2084e8){try{const _0x1d97cd=_0x34ed60[_0x1e4685(0x201)](_0x5e3e34[_0x1e4685(0x23d)]['name']),_0x563c1a=await yamlChatInterfaceToApi(_0x5e3e34[_0x1e4685(0x23d)],_0x5b97bb,_0x3d48d9);if(_0x1d97cd){const _0x4e2549=await this[_0x1e4685(0x225)][_0x1e4685(0x2e7)](_0x1d97cd['id'],_0x563c1a);_0x2943c4['chatInterfaces'][_0x1e4685(0x204)]({'name':_0x5e3e34[_0x1e4685(0x23d)][_0x1e4685(0x1eb)],'action':_0x1e4685(0x265),'id':_0x4e2549['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2ac)][_0x1e4685(0x265)]++;}else{const _0x41684a=await this['client'][_0x1e4685(0x2d9)](_0x563c1a);_0x2943c4[_0x1e4685(0x2ac)][_0x1e4685(0x204)]({'name':_0x5e3e34[_0x1e4685(0x23d)]['name'],'action':_0x1e4685(0x2dc),'id':_0x41684a['id']}),_0x2943c4[_0x1e4685(0x2b7)][_0x1e4685(0x2ac)][_0x1e4685(0x2dc)]++;}}catch(_0xa8991d){_0x2943c4['chatInterfaces'][_0x1e4685(0x204)]({'name':_0x5e3e34[_0x1e4685(0x23d)]['name'],'action':'error','error':_0xa8991d['message']}),_0x2943c4['counts']['chatInterfaces'][_0x1e4685(0x217)]++;}}return _0x2943c4;}async[a179_0x29048a(0x1de)](_0x16239d,_0x376371,_0x5993fa,_0x4b7ff0){const _0x2c7573=a179_0x29048a,{projectId:_0x5a27be,project:_0x1472fb}=await this[_0x2c7573(0x292)](_0x16239d),_0x25da07=_0x1472fb[_0x2c7573(0x26d)]['name'],_0x3b0603=await this[_0x2c7573(0x225)][_0x2c7573(0x220)](_0x5a27be),_0x36b4b8=_0x3b0603['find'](_0x4b25bc=>_0x4b25bc[_0x2c7573(0x26d)][_0x2c7573(0x1eb)]===_0x376371);if(!_0x36b4b8)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x2c7573(0x209)+_0x376371,undefined,{'helpText':'Available\x20agents:\x20'+_0x3b0603[_0x2c7573(0x26b)](_0x1bcc6e=>_0x1bcc6e[_0x2c7573(0x26d)][_0x2c7573(0x1eb)])[_0x2c7573(0x2de)](',\x20')});let _0x122064;if(_0x5993fa)_0x122064=_0x5993fa;else{const _0x2fc688=a179_0x62086b['join'](process[_0x2c7573(0x28a)](),'agents'),_0x43421a=getSanitizedPathWithMigration(_0x2fc688,_0x25da07);_0x43421a[_0x2c7573(0x2dd)]&&this[_0x2c7573(0x24d)][_0x2c7573(0x245)]('Renamed\x20folder:\x20'+a179_0x62086b[_0x2c7573(0x282)](_0x43421a[_0x2c7573(0x261)])+_0x2c7573(0x1dd)+a179_0x62086b[_0x2c7573(0x282)](_0x43421a[_0x2c7573(0x216)])),_0x122064=_0x43421a['path'];}const _0xebf8b=getSanitizedPathWithMigration(_0x122064,_0x376371);_0xebf8b['renamed']&&this['logger'][_0x2c7573(0x245)](_0x2c7573(0x1e7)+a179_0x62086b['basename'](_0xebf8b[_0x2c7573(0x261)])+_0x2c7573(0x1dd)+a179_0x62086b['basename'](_0xebf8b[_0x2c7573(0x216)]));const _0x599e98=_0xebf8b[_0x2c7573(0x216)],_0x54dcf6=new Map(),_0x11ec92=new Map(),_0x2cf9b0=await this['client'][_0x2c7573(0x281)](_0x5a27be),_0xea0c97=await this[_0x2c7573(0x225)][_0x2c7573(0x26a)](_0x5a27be),_0x44acc0=await safeListOrEmpty(()=>this[_0x2c7573(0x225)][_0x2c7573(0x1fb)](_0x5a27be)),_0x1b7ba4=new Map(),_0x4c306a=new Map();for(const _0x18c075 of _0x2cf9b0){_0x54dcf6[_0x2c7573(0x2a5)](_0x18c075['id'],_0x18c075[_0x2c7573(0x26d)][_0x2c7573(0x1eb)]);}for(const _0x397ac2 of _0xea0c97){_0x1b7ba4['set'](_0x397ac2['id'],_0x397ac2[_0x2c7573(0x26d)][_0x2c7573(0x1eb)]);}for(const _0x555e28 of _0x44acc0){_0x4c306a[_0x2c7573(0x2a5)](_0x555e28['id'],_0x555e28[_0x2c7573(0x26d)][_0x2c7573(0x1eb)]);}for(const _0x15ab8 of _0x3b0603){_0x11ec92['set'](_0x15ab8['id'],_0x15ab8[_0x2c7573(0x26d)]['name']);}const _0xeeafba={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x54dcf6,'TextKnowledgeBase':_0x1b7ba4,'Agent':_0x11ec92,'ExperimentalKnowledgeBase':_0x4c306a}),'resolvePromptName':async()=>undefined,'onWarning':_0x2b613c=>this[_0x2c7573(0x24d)][_0x2c7573(0x1ee)](_0x2b613c)},_0x212b2a=a179_0x62086b['join'](_0x599e98,_0x2c7573(0x231)),_0x4ab9f1=a179_0x62086b[_0x2c7573(0x2de)](_0x599e98,'agent.yml'),_0xcecc2a=a179_0x62086b[_0x2c7573(0x2de)](_0x599e98,_0x2c7573(0x27b)),_0x484f80=!a179_0x2ad1cd[_0x2c7573(0x1f8)](_0x4ab9f1);if(_0x4b7ff0?.['dryRun'])return{'agentName':_0x376371,'outputPath':_0x599e98,'isNew':_0x484f80,'hasChanges':!![]};a179_0x2ad1cd[_0x2c7573(0x2a6)](_0x122064,{'recursive':!![]}),a179_0x2ad1cd[_0x2c7573(0x2a6)](_0x599e98,{'recursive':!![]});const _0x2f65fa=a179_0x62086b[_0x2c7573(0x2de)](_0x122064,_0x2c7573(0x1d2));!a179_0x2ad1cd[_0x2c7573(0x1f8)](_0x2f65fa)&&a179_0x2ad1cd[_0x2c7573(0x227)](_0x2f65fa,createAgentConfigContent(_0x16239d));const {yaml:_0x541350,systemPrompt:_0x49d755,starterMessage:_0x3e3101}=await agentResponseToDef(_0x36b4b8,_0xeeafba);let _0x276b1a=_0x484f80;if(!_0x484f80){const _0x1d8394=a179_0x2ad1cd[_0x2c7573(0x1f8)](_0x212b2a)?a179_0x2ad1cd['readFileSync'](_0x212b2a,'utf-8'):'',_0x54c8fb=a179_0x2ad1cd[_0x2c7573(0x255)](_0x4ab9f1,_0x2c7573(0x1e1));_0x276b1a=_0x1d8394!==_0x49d755||_0x54c8fb!==toAgentYamlString(_0x541350);}a179_0x2ad1cd['writeFileSync'](_0x212b2a,_0x49d755),a179_0x2ad1cd[_0x2c7573(0x227)](_0x4ab9f1,toAgentYamlString(_0x541350));if(_0x3e3101&&_0x3e3101[_0x2c7573(0x29b)]('\x0a'))a179_0x2ad1cd['writeFileSync'](_0xcecc2a,_0x3e3101);else a179_0x2ad1cd[_0x2c7573(0x1f8)](_0xcecc2a)&&a179_0x2ad1cd[_0x2c7573(0x2c3)](_0xcecc2a);return{'agentName':_0x376371,'outputPath':_0x599e98,'isNew':_0x484f80,'hasChanges':_0x276b1a};}async[a179_0x29048a(0x20b)](_0x3a4c5a,_0x13e680){const _0x32e31f=a179_0x29048a;let _0x1d1209;isAgentYamlPath(_0x3a4c5a)?_0x1d1209=getAgentDirFromYamlPath(_0x3a4c5a):_0x1d1209=_0x3a4c5a;const {config:_0xb95b03}=findAgentConfig(_0x1d1209),_0x4d9a87=await this[_0x32e31f(0x275)](_0xb95b03[_0x32e31f(0x24c)]),_0x16e90c=a179_0x62086b[_0x32e31f(0x2de)](_0x1d1209,_0x32e31f(0x2b3)),_0x240c24=a179_0x62086b['join'](_0x1d1209,_0x32e31f(0x231)),_0x3a62d4=a179_0x62086b[_0x32e31f(0x2de)](_0x1d1209,_0x32e31f(0x27b));if(!a179_0x2ad1cd['existsSync'](_0x16e90c))throw new SDKError(ErrorCode['NOT_FOUND'],_0x32e31f(0x1f9)+_0x1d1209,undefined,{'helpText':_0x32e31f(0x268)});const _0x9bf583=parseAgentYaml(a179_0x2ad1cd[_0x32e31f(0x255)](_0x16e90c,_0x32e31f(0x1e1)),_0x16e90c),_0x2a1bf4=a179_0x2ad1cd['existsSync'](_0x240c24)?a179_0x2ad1cd['readFileSync'](_0x240c24,_0x32e31f(0x1e1)):'',_0x4ff553=a179_0x2ad1cd[_0x32e31f(0x1f8)](_0x3a62d4)?a179_0x2ad1cd[_0x32e31f(0x255)](_0x3a62d4,_0x32e31f(0x1e1)):_0x9bf583['starter_message'];if(_0x13e680?.[_0x32e31f(0x1ea)])return{'agentName':_0x9bf583[_0x32e31f(0x1eb)],'action':'created','projectId':_0x4d9a87};const _0x64edcd=await this['client']['listAgentsFull'](_0x4d9a87),_0x300452=await fetchAllToolTargetMaps((_0x30d197,_0x466ace)=>this['client'][_0x32e31f(0x2d7)](_0x30d197,_0x466ace),_0x4d9a87),_0x3756a0=new Map();for(const _0x114c8f of _0x64edcd){_0x3756a0['set'](_0x114c8f[_0x32e31f(0x26d)][_0x32e31f(0x1eb)],_0x114c8f['id']);}const _0x3c56c1=[],_0x35e21b={'projectId':_0x4d9a87,'resolveToolTargetId':buildIdResolver({..._0x300452[_0x32e31f(0x25f)],'Agent':_0x3756a0}),'resolvePromptId':async()=>undefined,'onWarning':_0x4c8773=>{const _0x177c67=_0x32e31f;this[_0x177c67(0x24d)][_0x177c67(0x1ee)](_0x4c8773),_0x3c56c1[_0x177c67(0x204)](_0x4c8773);}};try{const _0x372bec=_0x64edcd[_0x32e31f(0x27e)](_0x515c52=>_0x515c52['attributes'][_0x32e31f(0x1eb)]===_0x9bf583['name']),_0x48098=await agentDefToRequest(_0x9bf583,_0x2a1bf4,_0x4ff553,_0x35e21b);if(_0x372bec)return await this[_0x32e31f(0x225)][_0x32e31f(0x2cb)](_0x372bec['id'],_0x48098),{'agentName':_0x9bf583[_0x32e31f(0x1eb)],'action':_0x32e31f(0x265),'projectId':_0x4d9a87,'agentId':_0x372bec['id'],'warnings':_0x3c56c1['length']>0x0?_0x3c56c1:undefined};else{const _0x22ac33=await this[_0x32e31f(0x225)]['createAgentResponse'](_0x48098);return{'agentName':_0x9bf583['name'],'action':_0x32e31f(0x2dc),'projectId':_0x4d9a87,'agentId':_0x22ac33['id'],'warnings':_0x3c56c1['length']>0x0?_0x3c56c1:undefined};}}catch(_0x5caef2){return{'agentName':_0x9bf583[_0x32e31f(0x1eb)],'action':_0x32e31f(0x2f3),'projectId':_0x4d9a87,'error':_0x5caef2[_0x32e31f(0x228)],'warnings':_0x3c56c1[_0x32e31f(0x2c0)]>0x0?_0x3c56c1:undefined};}}async[a179_0x29048a(0x2d4)](_0x5bdcb9,_0x16f989,_0x525d22){const _0x22bf14=a179_0x29048a,_0x5019bd=a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x5bdcb9)&&a179_0x2ad1cd['existsSync'](a179_0x62086b[_0x22bf14(0x2de)](_0x5bdcb9,'tdx.json'));let _0x4ef99b;const _0x261098=[],_0x456891=[],_0x48194d=[],_0x491e2d=[],_0x14aa87=[],_0x51e2a6=[],_0x5ccc34=[],_0x33e8c2=[],_0x2e63fd=[];if(_0x5019bd){const _0x8cc045=loadAgentConfig(a179_0x62086b['join'](_0x5bdcb9,_0x22bf14(0x1d2)));_0x4ef99b=_0x8cc045[_0x22bf14(0x24c)];const _0xb7a632=a179_0x2ad1cd[_0x22bf14(0x262)](_0x5bdcb9,{'withFileTypes':!![]});for(const _0x250021 of _0xb7a632){if(!_0x250021[_0x22bf14(0x2f0)]())continue;if([_0x22bf14(0x1f0),_0x22bf14(0x1f6),_0x22bf14(0x1f5),_0x22bf14(0x22b),_0x22bf14(0x263),_0x22bf14(0x2e1),'chat_interfaces'][_0x22bf14(0x29b)](_0x250021[_0x22bf14(0x1eb)]))continue;const _0x589df0=a179_0x62086b[_0x22bf14(0x2de)](_0x5bdcb9,_0x250021[_0x22bf14(0x1eb)]);if(isAgentDir(_0x589df0)){const _0x35003c=a179_0x62086b['join'](_0x589df0,_0x22bf14(0x2b3)),_0x12a5b7=a179_0x62086b[_0x22bf14(0x2de)](_0x589df0,'prompt.md'),_0x2bda9b=a179_0x62086b[_0x22bf14(0x2de)](_0x589df0,'starter_message.md'),_0x2e617b=parseAgentYaml(a179_0x2ad1cd['readFileSync'](_0x35003c,_0x22bf14(0x1e1)),_0x35003c),_0x13511d=a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x12a5b7)?a179_0x2ad1cd[_0x22bf14(0x255)](_0x12a5b7,_0x22bf14(0x1e1)):'',_0x4fd3a9=a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x2bda9b)?a179_0x2ad1cd[_0x22bf14(0x255)](_0x2bda9b,'utf-8'):_0x2e617b[_0x22bf14(0x1d4)];_0x261098[_0x22bf14(0x204)]({'name':_0x2e617b[_0x22bf14(0x1eb)],'dir':_0x589df0,'yaml':_0x2e617b,'systemPrompt':_0x13511d,'starterMessage':_0x4fd3a9});}}const _0x25f094=getKnowledgeBasesDir(_0x5bdcb9);if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x25f094)){const _0x391d47=a179_0x2ad1cd[_0x22bf14(0x262)](_0x25f094);for(const _0x176d49 of _0x391d47){const _0x5b2c40=a179_0x62086b['join'](_0x25f094,_0x176d49);if(_0x176d49['endsWith'](_0x22bf14(0x254))){const _0x538bc9=parseKnowledgeBaseYaml(a179_0x2ad1cd[_0x22bf14(0x255)](_0x5b2c40,'utf-8'),_0x5b2c40);_0x456891[_0x22bf14(0x204)]({'name':_0x538bc9['name'],'path':_0x5b2c40,'yaml':_0x538bc9});}else{if(_0x176d49['endsWith']('.md')){const _0x82e291=a179_0x2ad1cd['readFileSync'](_0x5b2c40,_0x22bf14(0x1e1)),{name:_0x34c26a,text:_0x3f2da4}=parseTextKnowledgeBaseMd(_0x82e291,_0x176d49);_0x48194d['push']({'name':_0x34c26a,'path':_0x5b2c40,'text':_0x3f2da4});}}}}const _0x5220df=getPromptsDir(_0x5bdcb9);if(a179_0x2ad1cd['existsSync'](_0x5220df)){const _0x537cc3=a179_0x2ad1cd['readdirSync'](_0x5220df)['filter'](_0x286b43=>_0x286b43[_0x22bf14(0x2d6)](_0x22bf14(0x254)));for(const _0x599913 of _0x537cc3){const _0x3de93b=a179_0x62086b[_0x22bf14(0x2de)](_0x5220df,_0x599913),_0xa5df5f=parsePromptYaml(a179_0x2ad1cd[_0x22bf14(0x255)](_0x3de93b,_0x22bf14(0x1e1)),_0x3de93b);_0x491e2d[_0x22bf14(0x204)]({'name':_0xa5df5f['name'],'path':_0x3de93b,'yaml':_0xa5df5f});}}const _0x4d6757=getIntegrationsDir(_0x5bdcb9);if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x4d6757)){const _0x51f01a=a179_0x2ad1cd['readdirSync'](_0x4d6757)['filter'](_0x22aba6=>_0x22aba6['endsWith'](_0x22bf14(0x254)));for(const _0x5c775f of _0x51f01a){const _0x564ef1=a179_0x62086b[_0x22bf14(0x2de)](_0x4d6757,_0x5c775f),_0x3a573a=parseIntegrationYaml(a179_0x2ad1cd[_0x22bf14(0x255)](_0x564ef1,_0x22bf14(0x1e1)),_0x564ef1);SAFE_INTEGRATION_TYPES[_0x22bf14(0x29b)](_0x3a573a[_0x22bf14(0x259)][_0x22bf14(0x2a4)]())?_0x14aa87['push']({'name':_0x3a573a[_0x22bf14(0x1eb)],'path':_0x564ef1,'yaml':_0x3a573a}):this[_0x22bf14(0x24d)][_0x22bf14(0x1ee)](_0x22bf14(0x2cd)+_0x3a573a[_0x22bf14(0x1eb)]+_0x22bf14(0x1f2)+_0x3a573a[_0x22bf14(0x259)]+_0x22bf14(0x21e)+(_0x22bf14(0x264)+SAFE_INTEGRATION_TYPES[_0x22bf14(0x2de)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0xdfe060=getExperimentalKnowledgeBasesDir(_0x5bdcb9);if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0xdfe060)){const _0x1d189e=a179_0x2ad1cd['readdirSync'](_0xdfe060,{'withFileTypes':!![]});for(const _0x5c0292 of _0x1d189e){if(!_0x5c0292[_0x22bf14(0x2f0)]())continue;const _0xaed1d8=a179_0x62086b['join'](_0xdfe060,_0x5c0292['name']),_0x3c5d79=a179_0x62086b[_0x22bf14(0x2de)](_0xaed1d8,_0x5c0292[_0x22bf14(0x1eb)]+_0x22bf14(0x254));if(a179_0x2ad1cd['existsSync'](_0x3c5d79)){const _0x58f980=parseExperimentalKnowledgeBaseYaml(a179_0x2ad1cd[_0x22bf14(0x255)](_0x3c5d79,_0x22bf14(0x1e1)),_0x3c5d79),_0x45bf38=a179_0x62086b['join'](_0xaed1d8,_0x22bf14(0x24e)),_0x253a49=[];if(a179_0x2ad1cd['existsSync'](_0x45bf38)){const _0x4b0ada=a179_0x2ad1cd[_0x22bf14(0x262)](_0x45bf38,{'withFileTypes':!![]});for(const _0x2bd46c of _0x4b0ada){if(!_0x2bd46c[_0x22bf14(0x2f0)]())continue;const _0x3b5c37=a179_0x62086b[_0x22bf14(0x2de)](_0x45bf38,_0x2bd46c[_0x22bf14(0x1eb)]),_0x3d72be=a179_0x62086b[_0x22bf14(0x2de)](_0x3b5c37,_0x22bf14(0x22e)),_0x1ce6d4=a179_0x62086b[_0x22bf14(0x2de)](_0x3b5c37,_0x22bf14(0x21c));if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x3d72be)&&a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x1ce6d4)){const _0x94c6c9=a179_0x2ad1cd['readFileSync'](_0x3d72be,_0x22bf14(0x1e1)),_0x4429b0=a179_0x2ad1cd[_0x22bf14(0x255)](_0x1ce6d4,_0x22bf14(0x1e1));_0x253a49[_0x22bf14(0x204)]({'name':_0x2bd46c[_0x22bf14(0x1eb)],'code':_0x94c6c9,'json_schema':_0x4429b0});}}}const _0x1f4831={..._0x58f980,'functions':_0x253a49};_0x51e2a6['push']({'name':_0x58f980[_0x22bf14(0x1eb)],'path':_0xaed1d8,'def':_0x1f4831});}}}const _0x268575=getExperimentalArtifactsDir(_0x5bdcb9);if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x268575)){const _0x597a5e=a179_0x2ad1cd[_0x22bf14(0x262)](_0x268575,{'withFileTypes':!![]});for(const _0x1dce14 of _0x597a5e){if(!_0x1dce14[_0x22bf14(0x2f0)]())continue;const _0x556fdf=a179_0x62086b[_0x22bf14(0x2de)](_0x268575,_0x1dce14['name']),_0x2b6715=a179_0x62086b[_0x22bf14(0x2de)](_0x556fdf,_0x1dce14[_0x22bf14(0x1eb)]+'.yml');if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x2b6715)){const _0x38ef4d=parseExperimentalArtifactYaml(a179_0x2ad1cd[_0x22bf14(0x255)](_0x2b6715,_0x22bf14(0x1e1)),_0x2b6715),_0x357e19=a179_0x62086b['join'](_0x556fdf,_0x22bf14(0x22e)),_0x26788c=a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x357e19)?a179_0x2ad1cd[_0x22bf14(0x255)](_0x357e19,_0x22bf14(0x1e1)):'',_0xf78170=a179_0x62086b['join'](_0x556fdf,'files'),_0x1ca858=[];if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0xf78170)){const _0x46c9c8=a179_0x2ad1cd[_0x22bf14(0x262)](_0xf78170);for(const _0x6c5b9d of _0x46c9c8){const _0x433678=a179_0x62086b[_0x22bf14(0x2de)](_0xf78170,_0x6c5b9d);if(a179_0x2ad1cd[_0x22bf14(0x23e)](_0x433678)[_0x22bf14(0x2c2)]()){const _0x22fb72=a179_0x2ad1cd[_0x22bf14(0x255)](_0x433678,_0x22bf14(0x1e1));_0x1ca858[_0x22bf14(0x204)]({'file_name':_0x6c5b9d,'text_content':_0x22fb72});}}}const _0xc68dc5={..._0x38ef4d,'code':_0x26788c,'files':_0x1ca858};_0x5ccc34[_0x22bf14(0x204)]({'name':_0x38ef4d[_0x22bf14(0x1eb)],'path':_0x556fdf,'def':_0xc68dc5});}}}const _0x2276ae=getFormInterfacesDir(_0x5bdcb9);if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x2276ae)){const _0x21e4ba=a179_0x2ad1cd[_0x22bf14(0x262)](_0x2276ae)['filter'](_0x18ea08=>_0x18ea08[_0x22bf14(0x2d6)](_0x22bf14(0x254)));for(const _0x57329e of _0x21e4ba){const _0x1ed6d6=a179_0x62086b[_0x22bf14(0x2de)](_0x2276ae,_0x57329e),_0x564b24=parseFormInterfaceYaml(a179_0x2ad1cd[_0x22bf14(0x255)](_0x1ed6d6,_0x22bf14(0x1e1)),_0x1ed6d6);_0x33e8c2['push']({'name':_0x564b24[_0x22bf14(0x1eb)],'path':_0x1ed6d6,'yaml':_0x564b24});}}const _0x42b1ee=getChatInterfacesDir(_0x5bdcb9);if(a179_0x2ad1cd[_0x22bf14(0x1f8)](_0x42b1ee)){const _0x3dc0db=a179_0x2ad1cd[_0x22bf14(0x262)](_0x42b1ee)[_0x22bf14(0x2a2)](_0x498bf6=>_0x498bf6[_0x22bf14(0x2d6)](_0x22bf14(0x254)));for(const _0xb315c9 of _0x3dc0db){const _0x2c9645=a179_0x62086b[_0x22bf14(0x2de)](_0x42b1ee,_0xb315c9),_0x2ed7b2=parseChatInterfaceYaml(a179_0x2ad1cd['readFileSync'](_0x2c9645,_0x22bf14(0x1e1)),_0x2c9645);_0x2e63fd['push']({'name':_0x2ed7b2['name'],'path':_0x2c9645,'yaml':_0x2ed7b2});}}}else{const _0x5a7398=await this[_0x22bf14(0x275)](_0x5bdcb9),_0x31f620=await this['client'][_0x22bf14(0x271)](_0x5a7398);_0x4ef99b=_0x31f620[_0x22bf14(0x26d)][_0x22bf14(0x1eb)];const _0x590a2d=await this[_0x22bf14(0x225)]['listAgentsFull'](_0x5a7398),_0x2346ac=await this[_0x22bf14(0x225)][_0x22bf14(0x281)](_0x5a7398),_0x383e2f=await this['client'][_0x22bf14(0x26a)](_0x5a7398),_0x13fea5=await this[_0x22bf14(0x225)][_0x22bf14(0x293)](_0x5a7398),_0x5e37a1=await this['client'][_0x22bf14(0x286)](_0x5a7398),_0x204e18=await safeListOrEmpty(()=>this[_0x22bf14(0x225)][_0x22bf14(0x1fb)](_0x5a7398)),_0x2a783=await safeListOrEmpty(()=>this[_0x22bf14(0x225)][_0x22bf14(0x273)](_0x5a7398)),_0x5e3ba2=new Map(),_0x2d2236=new Map(),_0x48a438=new Map(),_0x52d9ef=new Map(),_0xc184fc=new Map(),_0x2392e7=new Map();for(const _0x114118 of _0x2346ac){_0x5e3ba2[_0x22bf14(0x2a5)](_0x114118['id'],_0x114118[_0x22bf14(0x26d)]['name']);}for(const _0x3e7021 of _0x383e2f){_0x2d2236[_0x22bf14(0x2a5)](_0x3e7021['id'],_0x3e7021[_0x22bf14(0x26d)][_0x22bf14(0x1eb)]);}for(const _0x235927 of _0x590a2d){_0x48a438[_0x22bf14(0x2a5)](_0x235927['id'],_0x235927[_0x22bf14(0x26d)][_0x22bf14(0x1eb)]);}for(const _0x20d18e of _0x13fea5){_0x52d9ef[_0x22bf14(0x2a5)](_0x20d18e['id'],_0x20d18e[_0x22bf14(0x26d)]['name']);}for(const _0x5274a9 of _0x204e18){_0xc184fc['set'](_0x5274a9['id'],_0x5274a9[_0x22bf14(0x26d)]['name']);}for(const _0x3dbcab of _0x2a783){_0x2392e7[_0x22bf14(0x2a5)](_0x3dbcab['id'],_0x3dbcab[_0x22bf14(0x26d)]['name']);}const _0x5cc5bd={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5e3ba2,'TextKnowledgeBase':_0x2d2236,'Agent':_0x48a438,'ExperimentalKnowledgeBase':_0xc184fc}),'resolvePromptName':async _0x11a01f=>_0x52d9ef[_0x22bf14(0x201)](_0x11a01f),'onWarning':_0x148219=>this[_0x22bf14(0x24d)][_0x22bf14(0x1ee)](_0x148219)};for(const _0x39b7b0 of _0x590a2d){const _0x4f61e3=await agentResponseToDef(_0x39b7b0,_0x5cc5bd),{yaml:_0x4007ff,systemPrompt:_0x44ab31,starterMessage:_0x4b0f6e}=_0x4f61e3;_0x261098[_0x22bf14(0x204)]({'name':_0x4007ff[_0x22bf14(0x1eb)],'dir':'','yaml':_0x4007ff,'systemPrompt':_0x44ab31,'starterMessage':_0x4b0f6e});}for(const _0x5a53db of _0x2346ac){const _0x244776=apiKnowledgeBaseToYaml(_0x5a53db);_0x456891['push']({'name':_0x244776[_0x22bf14(0x1eb)],'path':'','yaml':_0x244776});}for(const _0x495ed4 of _0x383e2f){_0x48194d['push']({'name':_0x495ed4[_0x22bf14(0x26d)][_0x22bf14(0x1eb)],'path':'','text':_0x495ed4['attributes']['text']});}for(const _0x107875 of _0x13fea5){const _0x125812=await apiPromptToYaml(_0x107875,_0x5cc5bd);_0x125812&&_0x491e2d[_0x22bf14(0x204)]({'name':_0x125812[_0x22bf14(0x1eb)],'path':'','yaml':_0x125812});}for(const _0x45c639 of _0x5e37a1){if(!_0x45c639[_0x22bf14(0x26d)]['isManaged']&&SAFE_INTEGRATION_TYPES['includes'](_0x45c639[_0x22bf14(0x26d)][_0x22bf14(0x222)][_0x22bf14(0x2a4)]())){const _0x28fe63=await apiIntegrationToYaml(_0x45c639,_0x5cc5bd);_0x14aa87[_0x22bf14(0x204)]({'name':_0x45c639[_0x22bf14(0x26d)][_0x22bf14(0x222)][_0x22bf14(0x2a4)](),'path':'','yaml':_0x28fe63});}}for(const _0x328786 of _0x204e18){const _0x319184=apiExperimentalKnowledgeBaseToYaml(_0x328786);_0x51e2a6['push']({'name':_0x319184[_0x22bf14(0x1eb)],'path':'','def':_0x319184});}for(const _0x363233 of _0x2a783){const _0x24809c=apiExperimentalArtifactToYaml(_0x363233);_0x5ccc34[_0x22bf14(0x204)]({'name':_0x24809c[_0x22bf14(0x1eb)],'path':'','def':_0x24809c});}const _0x310820=await safeListOrEmpty(()=>this[_0x22bf14(0x225)][_0x22bf14(0x1d5)](_0x5a7398));for(const _0xad1d16 of _0x310820){const _0x406fa6=await apiFormInterfaceToYaml(_0xad1d16,_0x5cc5bd);_0x33e8c2['push']({'name':_0x406fa6[_0x22bf14(0x1eb)],'path':'','yaml':_0x406fa6});}const _0x537c98=await safeListOrEmpty(()=>this[_0x22bf14(0x225)][_0x22bf14(0x1e8)](_0x5a7398));for(const _0x4b3f9b of _0x537c98){if(_0x4b3f9b[_0x22bf14(0x26d)][_0x22bf14(0x2b8)])continue;const _0xde77f5=await apiChatInterfaceToYaml(_0x4b3f9b,_0x5cc5bd);_0x2e63fd[_0x22bf14(0x204)]({'name':_0xde77f5[_0x22bf14(0x1eb)],'path':'','yaml':_0xde77f5});}}const _0x3ddb94={'sourceProjectName':_0x4ef99b,'newProjectName':_0x16f989,'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}}},_0x5238dd=await this[_0x22bf14(0x225)]['listProjects'](),_0x447174=_0x5238dd['find'](_0x4c31ad=>_0x4c31ad[_0x22bf14(0x26d)][_0x22bf14(0x1eb)]===_0x16f989);if(_0x447174)throw new SDKError(ErrorCode[_0x22bf14(0x25d)],_0x22bf14(0x2ee)+_0x16f989+'\x22\x20already\x20exists',undefined,{'helpText':_0x22bf14(0x1e0)});if(_0x525d22?.[_0x22bf14(0x1ea)])return _0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x29a)][_0x22bf14(0x2dc)]=_0x261098[_0x22bf14(0x2c0)],_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x2cc)]['created']=_0x456891[_0x22bf14(0x2c0)],_0x3ddb94['counts']['textKnowledgeBases'][_0x22bf14(0x2dc)]=_0x48194d[_0x22bf14(0x2c0)],_0x3ddb94[_0x22bf14(0x2b7)]['experimentalKnowledgeBases']['created']=_0x51e2a6['length'],_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x299)][_0x22bf14(0x2dc)]=_0x5ccc34['length'],_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x22b)]['created']=_0x491e2d[_0x22bf14(0x2c0)],_0x3ddb94[_0x22bf14(0x2b7)]['integrations']['created']=_0x14aa87['length'],_0x3ddb94;const _0xcb819=await this[_0x22bf14(0x225)][_0x22bf14(0x2e2)]({'name':_0x16f989}),_0x26f8e7=_0xcb819['id'];_0x3ddb94[_0x22bf14(0x1e2)]=_0x26f8e7;const _0x5e5da0=new Map(),_0x5a9563=new Map(),_0x5d010a=new Map(),_0x27ff43=new Map(),_0xe417f8=new Map(),_0x47fc5a=new Map(),_0x90ff80=new Map(),_0x16d963=new Map(),_0x2f33b7=new Set(),_0x5dc2e8=new Set();for(const _0x5dd400 of _0x261098){for(const _0x2a3571 of _0x5dd400[_0x22bf14(0x23d)]['tools']||[]){if(_0x2a3571[_0x22bf14(0x256)]===_0x22bf14(0x20f)&&_0x2a3571[_0x22bf14(0x1d9)]){const _0x5ccb6a=parseRef(_0x2a3571[_0x22bf14(0x1d9)]);if(_0x5ccb6a)_0x2f33b7[_0x22bf14(0x1e6)](_0x5ccb6a[_0x22bf14(0x1eb)]);}else{if(_0x2a3571[_0x22bf14(0x256)]===_0x22bf14(0x238)&&_0x2a3571['target']){const _0x2a0520=parseRef(_0x2a3571[_0x22bf14(0x1d9)]);if(_0x2a0520)_0x5dc2e8[_0x22bf14(0x1e6)](_0x2a0520[_0x22bf14(0x1eb)]);}}}}for(const _0x3bf10a of _0x2f33b7){try{const _0x420390=await this[_0x22bf14(0x225)][_0x22bf14(0x24f)]({'projectId':_0x26f8e7,'name':_0x3bf10a});_0xe417f8[_0x22bf14(0x2a5)](_0x3bf10a,_0x420390['id']),_0x3ddb94[_0x22bf14(0x2e6)][_0x22bf14(0x204)]({'name':_0x3bf10a,'action':_0x22bf14(0x2dc),'id':_0x420390['id']}),_0x3ddb94[_0x22bf14(0x2b7)]['imageGenerators'][_0x22bf14(0x2dc)]++;}catch(_0x1fa060){_0x3ddb94[_0x22bf14(0x2e6)][_0x22bf14(0x204)]({'name':_0x3bf10a,'action':_0x22bf14(0x2f3),'error':_0x1fa060[_0x22bf14(0x228)]}),_0x3ddb94[_0x22bf14(0x2b7)]['imageGenerators'][_0x22bf14(0x217)]++;}}for(const _0x5644cf of _0x5dc2e8){try{const _0x51d019=await this['client'][_0x22bf14(0x2c5)]({'projectId':_0x26f8e7,'name':_0x5644cf});_0x47fc5a[_0x22bf14(0x2a5)](_0x5644cf,_0x51d019['id']),_0x3ddb94[_0x22bf14(0x249)][_0x22bf14(0x204)]({'name':_0x5644cf,'action':'created','id':_0x51d019['id']}),_0x3ddb94['counts'][_0x22bf14(0x249)][_0x22bf14(0x2dc)]++;}catch(_0x59fb1d){_0x3ddb94[_0x22bf14(0x249)][_0x22bf14(0x204)]({'name':_0x5644cf,'action':'error','error':_0x59fb1d[_0x22bf14(0x228)]}),_0x3ddb94['counts'][_0x22bf14(0x249)][_0x22bf14(0x217)]++;}}const _0x15eae7=await fetchAllToolTargetMaps((_0x32829c,_0x24257d)=>this[_0x22bf14(0x225)][_0x22bf14(0x2d7)](_0x32829c,_0x24257d),_0x26f8e7);let _0x3c6941=[];const _0x36364a={'projectId':_0x26f8e7,'resolveToolTargetId':buildIdResolver({..._0x15eae7['nameToId'],'KnowledgeBase':_0x5e5da0,'TextKnowledgeBase':_0x5a9563,'ExperimentalKnowledgeBase':_0x90ff80,'Agent':_0x5d010a,'WebSearchTool':_0x47fc5a,'ImageGenerator':_0xe417f8}),'resolvePromptId':async _0x8db800=>_0x27ff43[_0x22bf14(0x201)](_0x8db800),'onWarning':_0x5171f4=>{const _0xe861bf=_0x22bf14;this['logger'][_0xe861bf(0x1ee)](_0x5171f4),_0x3c6941[_0xe861bf(0x204)](_0x5171f4);}};for(const _0x488649 of _0x456891){try{const _0x1cf5fa=yamlKnowledgeBaseToApi(_0x488649[_0x22bf14(0x23d)],_0x26f8e7),_0x284abb=await this[_0x22bf14(0x225)][_0x22bf14(0x1df)](_0x1cf5fa);_0x5e5da0[_0x22bf14(0x2a5)](_0x488649[_0x22bf14(0x23d)]['name'],_0x284abb['id']),_0x3ddb94[_0x22bf14(0x2cc)][_0x22bf14(0x204)]({'name':_0x488649[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':_0x22bf14(0x2dc),'id':_0x284abb['id']}),_0x3ddb94['counts'][_0x22bf14(0x2cc)][_0x22bf14(0x2dc)]++;}catch(_0x437dee){_0x3ddb94[_0x22bf14(0x2cc)][_0x22bf14(0x204)]({'name':_0x488649[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':_0x22bf14(0x2f3),'error':_0x437dee['message']}),_0x3ddb94['counts'][_0x22bf14(0x2cc)][_0x22bf14(0x217)]++;}}for(const _0x2e860d of _0x48194d){try{const _0x3d1785=yamlTextKnowledgeBaseToApi({'name':_0x2e860d[_0x22bf14(0x1eb)],'text':_0x2e860d[_0x22bf14(0x2f2)]},_0x26f8e7),_0x44b8e3=await this[_0x22bf14(0x225)][_0x22bf14(0x287)](_0x3d1785);_0x5a9563[_0x22bf14(0x2a5)](_0x2e860d[_0x22bf14(0x1eb)],_0x44b8e3['id']),_0x3ddb94[_0x22bf14(0x25a)][_0x22bf14(0x204)]({'name':_0x2e860d['name'],'action':_0x22bf14(0x2dc),'id':_0x44b8e3['id']}),_0x3ddb94['counts']['textKnowledgeBases'][_0x22bf14(0x2dc)]++;}catch(_0x3aa287){_0x3ddb94[_0x22bf14(0x25a)][_0x22bf14(0x204)]({'name':_0x2e860d[_0x22bf14(0x1eb)],'action':'error','error':_0x3aa287[_0x22bf14(0x228)]}),_0x3ddb94[_0x22bf14(0x2b7)]['textKnowledgeBases'][_0x22bf14(0x217)]++;}}for(const _0x1d7171 of _0x5ccc34){try{const _0xfdba2d=yamlExperimentalArtifactToApi(_0x1d7171[_0x22bf14(0x22c)],_0x26f8e7),_0x5e6658=await this[_0x22bf14(0x225)]['createExperimentalArtifact'](_0xfdba2d);_0x16d963[_0x22bf14(0x2a5)](_0x1d7171[_0x22bf14(0x22c)][_0x22bf14(0x1eb)],_0x5e6658['id']),_0x3ddb94[_0x22bf14(0x299)][_0x22bf14(0x204)]({'name':_0x1d7171[_0x22bf14(0x22c)][_0x22bf14(0x1eb)],'action':'created','id':_0x5e6658['id']}),_0x3ddb94['counts'][_0x22bf14(0x299)][_0x22bf14(0x2dc)]++;}catch(_0x21ca3f){_0x3ddb94['experimentalArtifacts'][_0x22bf14(0x204)]({'name':_0x1d7171[_0x22bf14(0x22c)][_0x22bf14(0x1eb)],'action':_0x22bf14(0x2f3),'error':_0x21ca3f[_0x22bf14(0x228)]}),_0x3ddb94[_0x22bf14(0x2b7)]['experimentalArtifacts'][_0x22bf14(0x217)]++;}}for(const _0x1b7688 of _0x51e2a6){try{const _0x34e7a3=yamlExperimentalKnowledgeBaseToApi(_0x1b7688[_0x22bf14(0x22c)],_0x26f8e7),_0x4b1a8b=await this[_0x22bf14(0x225)][_0x22bf14(0x22f)](_0x34e7a3);_0x90ff80[_0x22bf14(0x2a5)](_0x1b7688['def'][_0x22bf14(0x1eb)],_0x4b1a8b['id']),_0x3ddb94[_0x22bf14(0x2a7)]['push']({'name':_0x1b7688[_0x22bf14(0x22c)]['name'],'action':_0x22bf14(0x2dc),'id':_0x4b1a8b['id']}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x2a7)][_0x22bf14(0x2dc)]++;}catch(_0x177da7){_0x3ddb94['experimentalKnowledgeBases']['push']({'name':_0x1b7688[_0x22bf14(0x22c)]['name'],'action':'error','error':_0x177da7[_0x22bf14(0x228)]}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x2a7)][_0x22bf14(0x217)]++;}}const _0x5ede00=[..._0x261098][_0x22bf14(0x246)]((_0x33c9b7,_0x35ea85)=>{const _0x3840f7=_0x22bf14,_0x2cf377=_0x33c9b7['yaml'][_0x3840f7(0x2d2)]?.['some'](_0x1e4bdd=>_0x1e4bdd['type']===_0x3840f7(0x242))??![],_0x17c7bf=_0x35ea85['yaml']['tools']?.[_0x3840f7(0x1e4)](_0x97d4c9=>_0x97d4c9[_0x3840f7(0x256)]===_0x3840f7(0x242))??![];if(_0x2cf377&&!_0x17c7bf)return 0x1;if(!_0x2cf377&&_0x17c7bf)return-0x1;return 0x0;});for(const _0x104d03 of _0x5ede00){_0x3c6941=[];try{const _0x55bb7e=_0x104d03[_0x22bf14(0x23d)]['tools']?.[_0x22bf14(0x2a2)](_0x157969=>{const _0x885e8=_0x22bf14;if(_0x157969['type']==='agent'&&_0x157969[_0x885e8(0x1d9)]){const _0x526a42=parseRef(_0x157969[_0x885e8(0x1d9)]);return _0x526a42?.[_0x885e8(0x1eb)]===_0x104d03[_0x885e8(0x23d)][_0x885e8(0x1eb)];}return![];})??[];if(_0x55bb7e[_0x22bf14(0x2c0)]>0x0){const _0x5bd78d=_0x22bf14(0x241)+_0x104d03[_0x22bf14(0x23d)]['name']+_0x22bf14(0x23b)+_0x22bf14(0x221);this[_0x22bf14(0x24d)][_0x22bf14(0x1ee)](_0x5bd78d),_0x3c6941['push'](_0x5bd78d);}const _0x1450da=await agentDefToRequest(_0x104d03[_0x22bf14(0x23d)],_0x104d03[_0x22bf14(0x250)],_0x104d03[_0x22bf14(0x2da)],_0x36364a),_0x2b546e=await this[_0x22bf14(0x225)][_0x22bf14(0x2d8)](_0x1450da);_0x5d010a[_0x22bf14(0x2a5)](_0x104d03['yaml']['name'],_0x2b546e['id']),_0x3ddb94[_0x22bf14(0x29a)]['push']({'agentName':_0x104d03[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':'created','agentId':_0x2b546e['id'],'warnings':_0x3c6941[_0x22bf14(0x2c0)]>0x0?_0x3c6941:undefined}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x29a)]['created']++;}catch(_0x41635f){_0x3ddb94[_0x22bf14(0x29a)][_0x22bf14(0x204)]({'agentName':_0x104d03[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':'error','error':_0x41635f[_0x22bf14(0x228)],'warnings':_0x3c6941['length']>0x0?_0x3c6941:undefined}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x29a)][_0x22bf14(0x217)]++;}}for(const _0x4ff2cd of _0x491e2d){try{const _0x3b6be6=await yamlPromptToApi(_0x4ff2cd[_0x22bf14(0x23d)],_0x26f8e7,_0x36364a);if(!_0x3b6be6){_0x3ddb94[_0x22bf14(0x22b)]['push']({'name':_0x4ff2cd['yaml'][_0x22bf14(0x1eb)],'action':'error','error':_0x22bf14(0x1da)}),_0x3ddb94['counts']['prompts'][_0x22bf14(0x217)]++;continue;}const _0x3a6b31=await this[_0x22bf14(0x225)][_0x22bf14(0x207)](_0x3b6be6);_0x27ff43[_0x22bf14(0x2a5)](_0x4ff2cd[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],_0x3a6b31['id']),_0x3ddb94[_0x22bf14(0x22b)][_0x22bf14(0x204)]({'name':_0x4ff2cd[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':_0x22bf14(0x2dc),'id':_0x3a6b31['id']}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x22b)]['created']++;}catch(_0x22a68d){_0x3ddb94[_0x22bf14(0x22b)][_0x22bf14(0x204)]({'name':_0x4ff2cd[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':_0x22bf14(0x2f3),'error':_0x22a68d[_0x22bf14(0x228)]}),_0x3ddb94[_0x22bf14(0x2b7)]['prompts'][_0x22bf14(0x217)]++;}}for(const _0x27f866 of _0x14aa87){try{const _0x166483=await yamlIntegrationToApi(_0x27f866[_0x22bf14(0x23d)],_0x26f8e7,_0x36364a),_0x2f90c9=await this['client'][_0x22bf14(0x25b)](_0x166483);_0x3ddb94[_0x22bf14(0x263)]['push']({'name':_0x27f866[_0x22bf14(0x23d)]['service_type'],'action':_0x22bf14(0x2dc),'id':_0x2f90c9['id']}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x263)][_0x22bf14(0x2dc)]++;}catch(_0x452ad5){_0x3ddb94[_0x22bf14(0x263)][_0x22bf14(0x204)]({'name':_0x27f866['yaml'][_0x22bf14(0x259)],'action':_0x22bf14(0x2f3),'error':_0x452ad5['message']}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x263)][_0x22bf14(0x217)]++;}}for(const _0x4d87fc of _0x33e8c2){try{const _0x4753d2=await yamlFormInterfaceToApi(_0x4d87fc[_0x22bf14(0x23d)],_0x26f8e7,_0x36364a);if(!_0x4753d2){_0x3ddb94[_0x22bf14(0x24b)][_0x22bf14(0x204)]({'name':_0x4d87fc['yaml']['name'],'action':'error','error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x3ddb94['counts'][_0x22bf14(0x24b)]['errors']++;continue;}const _0x2a23a2=await this[_0x22bf14(0x225)][_0x22bf14(0x243)](_0x4753d2);_0x3ddb94[_0x22bf14(0x24b)][_0x22bf14(0x204)]({'name':_0x4d87fc[_0x22bf14(0x23d)]['name'],'action':'created','id':_0x2a23a2['id']}),_0x3ddb94['counts'][_0x22bf14(0x24b)][_0x22bf14(0x2dc)]++;}catch(_0xe0a28f){_0x3ddb94[_0x22bf14(0x24b)][_0x22bf14(0x204)]({'name':_0x4d87fc['yaml'][_0x22bf14(0x1eb)],'action':_0x22bf14(0x2f3),'error':_0xe0a28f[_0x22bf14(0x228)]}),_0x3ddb94['counts'][_0x22bf14(0x24b)]['errors']++;}}for(const _0x1fa907 of _0x2e63fd){try{const _0x1f1ccc=await yamlChatInterfaceToApi(_0x1fa907['yaml'],_0x26f8e7,_0x36364a),_0x41cfa5=await this[_0x22bf14(0x225)]['createChatInterface'](_0x1f1ccc);_0x3ddb94[_0x22bf14(0x2ac)][_0x22bf14(0x204)]({'name':_0x1fa907[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':'created','id':_0x41cfa5['id']}),_0x3ddb94[_0x22bf14(0x2b7)][_0x22bf14(0x2ac)]['created']++;}catch(_0x251262){_0x3ddb94[_0x22bf14(0x2ac)]['push']({'name':_0x1fa907[_0x22bf14(0x23d)][_0x22bf14(0x1eb)],'action':_0x22bf14(0x2f3),'error':_0x251262[_0x22bf14(0x228)]}),_0x3ddb94['counts'][_0x22bf14(0x2ac)][_0x22bf14(0x217)]++;}}return _0x3ddb94;}}
1
+ const a181_0x20204d=a181_0x42be;(function(_0x427ebb,_0x33840d){const _0x1658b6=a181_0x42be,_0x2a867b=_0x427ebb();while(!![]){try{const _0x293415=parseInt(_0x1658b6(0x1a8))/0x1+-parseInt(_0x1658b6(0x1bd))/0x2+-parseInt(_0x1658b6(0x154))/0x3*(parseInt(_0x1658b6(0x1a5))/0x4)+parseInt(_0x1658b6(0x146))/0x5*(-parseInt(_0x1658b6(0x159))/0x6)+-parseInt(_0x1658b6(0x228))/0x7+-parseInt(_0x1658b6(0x13d))/0x8+parseInt(_0x1658b6(0x18b))/0x9;if(_0x293415===_0x33840d)break;else _0x2a867b['push'](_0x2a867b['shift']());}catch(_0x1de440){_0x2a867b['push'](_0x2a867b['shift']());}}}(a181_0x6f39,0x7acc1));import{LLMApiClient}from'../client/llm-api-client.js';import*as a181_0x4ca2ec from'node:fs';import*as a181_0xdd0961 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a181_0x6f39(){const _0x58c2c0=['updateExperimentalArtifact','project.json','updateChatInterface','readFileSync','agents.json','chats','writeFileSync','medium','28138239FpGnta','createProject','template','web_search','minimal','Renamed\x20chat\x20interface\x20file:\x20','webhookCorsOrigins','isDirectory','readdirSync','getDefaultProjectName','split','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Renamed\x20form\x20interface\x20file:\x20','listFormInterfaces','file_name','temperature','unchanged','agents','version','imageGenerators','listChatInterfaces','yaml','size','set','\x27.\x20This\x20should\x20not\x20happen.','ExperimentalKnowledgeBase','2707996SdSrux','agent.yml\x20not\x20found\x20in\x20','listWebSearchTools','127932xPUfly','\x0a\x0a#\x20agent.yml\x0a','Output\x20directory\x20already\x20exists:\x20','agentsFull','cloneProject','Removed\x20deleted\x20file:\x20','toLowerCase','experimental_artifacts','systemPrompt','getChatLog','existsSync','dirname','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','experimentalArtifacts','image_gen','service_type','1.0','add','\x20attempts\x20due\x20to\x20name\x20conflicts.','Agent\x20not\x20found:\x20','rmSync','1212282VPiRCE','knowledgeBases','Renamed\x20prompt\x20file:\x20','text_content','listIntegrations','getProject','cwd','listProjects','attributes','getOrCreateDefaultProject','LLM_PROJECT_NOT_FOUND','integrations.json','Project\x20not\x20found:\x20','createChatInterface','Agent\x20reference\x20not\x20found','setDefaultAgent','textKnowledgeBases','createFormInterface','projectName','project','length','dryRun','Multiple\x20agents\x20found\x20with\x20name\x20\x27','listAgentsFull','localeCompare','createExperimentalArtifact','createIntegration','AGENT_NOT_FOUND','formInterfaces','updateKnowledgeBase','resolveAgentId','.yml','Renamed\x20folder:\x20','context','listPrompts','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','join','listAgents','Unresolved\x20dependencies:\x20','error','prompt.md','createAgent','pullProject','createImageGenerator','filter','tools','history','logger','Renamed\x20experimental\x20artifact\x20directory:\x20','(dry-run)','INVALID_ARGUMENT','Skipping\x20integration\x20\x27','chat_generic','includes','\x20---\x0a','listKnowledgeBases','clearDefaultAgent','slackMessageMode','newProjectId','toISOString','updateAgentResponse','\x0a---\x20code\x20---\x0a','updateFormInterface','\x0a---\x20schema:\x20','description','tdx_default_','basename','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','endsWith','Renamed\x20text\x20KB\x20file:\x20','updateAgent','\x20in\x20project\x20','functions','createKnowledgeBase','resolveProjectName','push','dry-run-','agent','Removed\x20deleted\x20directory:\x20','warn','json_schema.json','chatInfo','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','counts','oldPath','updatePrompt','Invalid\x20agent\x20reference\x20format:\x20','updateExperimentalKnowledgeBase','unlinkSync','createPrompt','.md','conflict','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','listTextKnowledgeBases','tables','map','experimentalKnowledgeBases','deleteIntegration','site','client','mkdirSync','parse','starterMessage','\x0a---\x20function:\x20','event','find','3272430PjYIHn','NOT_FOUND','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','prompts.json','Unable\x20to\x20create\x20project\x20after\x20','total','Only\x20safe\x20types\x20(','promptId','tdx.json','none','json_schema','starter_message','type','models','Could\x20not\x20resolve\x20agent\x20reference','\x27\x20(','jsonSchemaHint','setCurrentProject','Renamed\x20KB\x20file:\x20','updateTextKnowledgeBase','agent.yml','modelType','action','restoreProject','chat_interfaces','agentId','has','sort','Renamed\x20agent\x20folder:\x20','text','low','KnowledgeBase','chat_agent_console','stringify','profile','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','Project\x20\x22','utf-8','files','status','pushAgent','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','message','name','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','maxToolIterations','isManaged','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','isDir','statSync','projectId','isFile',')\x20can\x20be\x20cloned.','target','listExperimentalKnowledgeBases','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','duplicate','6081520zHomOq','path','idToName','No\x20tdx.json\x20found\x20in\x20','currentProjectId','errors','chatIgnoreManagedActions','starter_message.md','knowledge_bases','15uAwQRq','getBackupMetadata','createTextKnowledgeBase','chat_parent_segment','chatInterfaces','integrations','sdk.llm','form_interfaces','createAgentResponse',')\x20can\x20be\x20pushed.\x20','loadJsonFile','#\x20prompt.md\x0a','createExperimentalKnowledgeBase','startChat','3ilNCUJ','getCurrentProject','experimental_knowledge_bases','listExperimentalArtifacts','getAgent','481212EUMFvn','renamed','INTERNAL','code.js','prompts','info','outputs','metadata','new','webSearchTools','):\x20','\x20→\x20','nameToId','Unsupported\x20backup\x20version:\x20','pullAgent','created','tdx_','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','Backup\x20folder\x20not\x20found:\x20','variables','high','resolveProjectId','get','projects','dir','listToolTargets','---\x20schema:\x20','ALREADY_EXISTS','getChatInfo','updated','llm_project','some','_reasoning_','serviceType','Available\x20agents:\x20','exportedFrom','reasoningEffort','Renamed\x20experimental\x20KB\x20directory:\x20','code','pushProject','---\x20file:\x20','def'];a181_0x6f39=function(){return _0x58c2c0;};return a181_0x6f39();}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';function a181_0x42be(_0x34b7b3,_0xf1bdbc){_0x34b7b3=_0x34b7b3-0x115;const _0x6f3943=a181_0x6f39();let _0x42be38=_0x6f3943[_0x34b7b3];return _0x42be38;}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=[a181_0x20204d(0x1f1),a181_0x20204d(0x124),a181_0x20204d(0x149)];async function safeListOrEmpty(_0x19f884){try{return await _0x19f884();}catch(_0x5208da){if(_0x5208da instanceof HTTPClientError&&_0x5208da['status']===0x194)return[];throw _0x5208da;}}export class LLMSDK{[a181_0x20204d(0x141)];[a181_0x20204d(0x221)];[a181_0x20204d(0x1de)];[a181_0x20204d(0x1ec)]=Logger['of'](a181_0x20204d(0x14c));constructor(_0x43c918){const _0x228889=a181_0x20204d;this['client']=new LLMApiClient(_0x43c918),this[_0x228889(0x1de)]=_0x43c918;}['getDefaultProjectName'](){const _0xe1191b=a181_0x20204d,_0x1e79fa=getSanitizedUsername();return _0xe1191b(0x1fe)+_0x1e79fa;}async[a181_0x20204d(0x115)](_0x20e737){const _0x1dd3a7=a181_0x20204d,{projectId:_0x3dfdc2}=await this[_0x1dd3a7(0x208)](_0x20e737);this[_0x1dd3a7(0x141)]=_0x3dfdc2;}[a181_0x20204d(0x155)](){const _0x2030ac=a181_0x20204d;return this[_0x2030ac(0x141)];}async[a181_0x20204d(0x1cc)](_0x241944){const _0x4a4109=a181_0x20204d,_0x20169b=this[_0x4a4109(0x1de)][_0x4a4109(0x126)];let _0x35f297,_0x14cd5a;if(_0x241944['includes']('/')){const _0x25749f=_0x241944[_0x4a4109(0x195)]('/');if(_0x25749f[_0x4a4109(0x1d1)]!==0x2)throw new SDKError(ErrorCode[_0x4a4109(0x1ef)],_0x4a4109(0x214)+_0x241944,undefined,{'helpText':_0x4a4109(0x130)});const [_0x17fbdb,_0x437de1]=_0x25749f;_0x35f297=await this[_0x4a4109(0x16e)](_0x17fbdb),_0x14cd5a=_0x437de1;}else _0x35f297=this[_0x4a4109(0x141)]||(await this[_0x4a4109(0x1c6)]())['id'],_0x14cd5a=_0x241944;const _0x2d4cc2=await this['resolveAgentId'](_0x14cd5a,_0x35f297),_0x1edb8d=await this[_0x4a4109(0x221)][_0x4a4109(0x158)](_0x2d4cc2);writeCachedLLMAgent(_0x1edb8d[_0x4a4109(0x1c5)][_0x4a4109(0x12f)],_0x2d4cc2,_0x35f297,_0x20169b);}['getDefaultAgent'](){const _0x44ebea=a181_0x20204d,_0x4f4e55=this[_0x44ebea(0x1de)][_0x44ebea(0x126)];return readCachedLLMAgent(_0x4f4e55)||undefined;}[a181_0x20204d(0x1f5)](){const _0x4d6399=a181_0x20204d,_0x18992f=this[_0x4d6399(0x1de)][_0x4d6399(0x126)];clearCachedLLMAgent(_0x18992f);}async[a181_0x20204d(0x235)](){const _0x1e4e0d=a181_0x20204d,_0x4a3331=await this[_0x1e4e0d(0x221)]['getUserSettings']();return toModelInfos(_0x4a3331);}async[a181_0x20204d(0x18c)](_0x20460f){const _0x22504d=a181_0x20204d;return await this[_0x22504d(0x221)][_0x22504d(0x18c)](_0x20460f);}async['deleteProject'](_0x19a249){const _0xab7444=a181_0x20204d,{projectId:_0x120d25}=await this[_0xab7444(0x208)](_0x19a249);await this['client']['deleteProject'](_0x120d25);}async[a181_0x20204d(0x170)](_0x311cb4=0x32){const _0x122688=a181_0x20204d;return await this[_0x122688(0x221)][_0x122688(0x1c4)](_0x311cb4);}async[a181_0x20204d(0x1c6)](_0x1aff7c){const _0x46f2ab=a181_0x20204d,_0x7013a8=_0x1aff7c||this[_0x46f2ab(0x194)](),_0x1040da=this[_0x46f2ab(0x1de)]['profile'];if(!_0x1aff7c){const _0x25973e=readCachedLLMProject(_0x1040da);if(_0x25973e&&_0x25973e['name']===_0x7013a8)try{const _0x2bb90=await this[_0x46f2ab(0x221)][_0x46f2ab(0x1c2)](_0x25973e['id']);if(_0x2bb90[_0x46f2ab(0x1c5)][_0x46f2ab(0x12f)]===_0x7013a8)return _0x2bb90;}catch{}}const _0x4a6b72=await this['client'][_0x46f2ab(0x1c4)](),_0x2a21a6=_0x4a6b72['find'](_0x4591ad=>_0x4591ad[_0x46f2ab(0x1c5)]['name']===_0x7013a8);if(_0x2a21a6)return!_0x1aff7c&&writeCachedLLMProject(_0x7013a8,_0x2a21a6['id'],_0x1040da),_0x2a21a6;const _0x327353=await this[_0x46f2ab(0x221)]['createProject']({'name':_0x7013a8,'description':_0x46f2ab(0x127)+getSanitizedUsername()+')'});return!_0x1aff7c&&writeCachedLLMProject(_0x7013a8,_0x327353['id'],_0x1040da),_0x327353;}async[a181_0x20204d(0x16e)](_0xaa61a2){const _0x24c734=a181_0x20204d,_0x3f68bf=await this[_0x24c734(0x221)]['listProjects'](),_0x29fcef=_0x3f68bf[_0x24c734(0x1e9)](_0x36cb37=>_0x36cb37[_0x24c734(0x1c5)][_0x24c734(0x12f)]===_0xaa61a2);if(_0x29fcef['length']===0x0)throw new SDKError(ErrorCode[_0x24c734(0x1c7)],'Project\x20not\x20found:\x20'+_0xaa61a2,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x29fcef[_0x24c734(0x1d1)]>0x1)throw new SDKError(ErrorCode[_0x24c734(0x15b)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0xaa61a2+'\x27.\x20This\x20should\x20not\x20happen.');return _0x29fcef[0x0]['id'];}async[a181_0x20204d(0x208)](_0x570952){const _0x3e2f1b=a181_0x20204d,_0x1c4a0c=await this['client'][_0x3e2f1b(0x1c4)](),_0x965a74=_0x1c4a0c['find'](_0x290c7c=>_0x290c7c[_0x3e2f1b(0x1c5)][_0x3e2f1b(0x12f)]===_0x570952);if(_0x965a74)return{'projectId':_0x965a74['id'],'project':_0x965a74};throw new SDKError(ErrorCode[_0x3e2f1b(0x1c7)],_0x3e2f1b(0x1c9)+_0x570952,undefined,{'helpText':_0x3e2f1b(0x1e0)});}async['getOrCreateDefaultAgent'](_0x285f4a='claude-4.5-sonnet',_0x483a7b=0x0,_0x3f9769){const _0x128a31=a181_0x20204d,_0x3b62ec=0xa;let _0x4aff53=0x0,_0x14c212;while(_0x4aff53<_0x3b62ec){try{const _0x549720=await this[_0x128a31(0x1c6)](_0x14c212),_0x3e2d2b=_0x549720['id'],_0x2dd11f=[_0x128a31(0x231),_0x128a31(0x18f),_0x128a31(0x122),_0x128a31(0x18a),_0x128a31(0x16d)],_0x320f4c=_0x483a7b===0x0?'tdx_'+_0x285f4a:_0x128a31(0x169)+_0x285f4a+_0x128a31(0x179)+_0x2dd11f[_0x483a7b],_0x51c919=await this[_0x128a31(0x221)][_0x128a31(0x1e2)](_0x3e2d2b),_0x8f3be5=_0x51c919['find'](_0x26f26b=>_0x26f26b[_0x128a31(0x1c5)][_0x128a31(0x12f)]===_0x320f4c);if(_0x8f3be5)return _0x8f3be5;const _0xa12c08=_0x483a7b>0x0?0x1:_0x3f9769;return await this['client'][_0x128a31(0x1e6)]({'name':_0x320f4c,'projectId':_0x3e2d2b,'modelType':_0x285f4a,'systemPrompt':'','temperature':_0xa12c08,'reasoningEffort':_0x483a7b>0x0?_0x483a7b:undefined});}catch(_0x2ca635){if(_0x2ca635 instanceof HTTPClientError){const _0x5174bc=_0x2ca635[_0x128a31(0x12b)];if(_0x5174bc>=0x190&&_0x5174bc<0x1f4){if(_0x5174bc===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x2ca635);else{if(_0x5174bc===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],_0x128a31(0x201),_0x2ca635);}throw _0x2ca635;}}if(errorContains(_0x2ca635,'already\x20exists',_0x128a31(0x13c),_0x128a31(0x219))){_0x4aff53++;if(_0x4aff53>=_0x3b62ec)throw new SDKError(ErrorCode[_0x128a31(0x174)],_0x128a31(0x22c)+_0x3b62ec+_0x128a31(0x1ba),_0x2ca635);const _0x17b136=this[_0x128a31(0x194)]();_0x14c212=_0x17b136+'_'+generateRandomHex();continue;}throw _0x2ca635;}}throw new SDKError(ErrorCode[_0x128a31(0x15b)],_0x128a31(0x13b));}async[a181_0x20204d(0x1db)](_0x411240,_0x2bc624){const _0x4d0eab=a181_0x20204d,_0xc495dc=_0x2bc624||this[_0x4d0eab(0x141)],_0x49f0d9=await this[_0x4d0eab(0x221)][_0x4d0eab(0x1e2)](_0xc495dc),_0x1462dd=_0x49f0d9['filter'](_0x1f4aad=>_0x1f4aad[_0x4d0eab(0x1c5)][_0x4d0eab(0x12f)]===_0x411240);if(_0x1462dd['length']===0x0){const _0x511cf3=_0xc495dc?_0x4d0eab(0x205)+_0xc495dc:'';throw new SDKError(ErrorCode[_0x4d0eab(0x1d8)],_0x4d0eab(0x1bb)+_0x411240+_0x511cf3,undefined,{'helpText':_0xc495dc?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x1462dd[_0x4d0eab(0x1d1)]>0x1)throw new SDKError(ErrorCode[_0x4d0eab(0x15b)],_0x4d0eab(0x1d3)+_0x411240+_0x4d0eab(0x1a3));return _0x1462dd[0x0]['id'];}async[a181_0x20204d(0x19c)](_0x23178b){const _0x19f1ae=a181_0x20204d,_0x2d71e0=_0x23178b||this['currentProjectId'];return await this[_0x19f1ae(0x221)][_0x19f1ae(0x1e2)](_0x2d71e0);}async[a181_0x20204d(0x1ab)](_0x10449b){const _0x102b67=a181_0x20204d;return await this[_0x102b67(0x221)]['listAgentsFull'](_0x10449b);}async[a181_0x20204d(0x20b)](_0xf50a42){const _0x202e5a=a181_0x20204d;return await this['client'][_0x202e5a(0x158)](_0xf50a42);}async[a181_0x20204d(0x1e6)](_0x39b639){const _0x43e28e=a181_0x20204d;return await this[_0x43e28e(0x221)][_0x43e28e(0x1e6)](_0x39b639);}async[a181_0x20204d(0x204)](_0x2ba23d,_0x4aff04){const _0x5547e0=a181_0x20204d;return await this[_0x5547e0(0x221)][_0x5547e0(0x204)](_0x2ba23d,_0x4aff04);}async['deleteAgent'](_0x24ec95){await this['client']['deleteAgent'](_0x24ec95);}async[a181_0x20204d(0x153)](_0x4a488c){const _0x1861e0=a181_0x20204d;return await this[_0x1861e0(0x221)][_0x1861e0(0x153)]({'agentId':_0x4a488c});}async*['chat'](_0x2cc70c,_0x24995e){const _0x2997a7=a181_0x20204d;let _0x3ee5d2=_0x24995e?.['chatId'];const _0x195578=_0x24995e?.[_0x2997a7(0x11d)];if(!_0x3ee5d2){if(!_0x195578)throw new Error(_0x2997a7(0x16a));const _0x39cba9=await this[_0x2997a7(0x221)][_0x2997a7(0x153)]({'agentId':_0x195578});_0x3ee5d2=_0x39cba9['id'],yield{'type':_0x2997a7(0x160),'data':{'chatId':_0x3ee5d2,'agentId':_0x195578,'projectId':_0x39cba9[_0x2997a7(0x1c5)][_0x2997a7(0x136)]}};}for await(const _0x1d276 of this[_0x2997a7(0x221)]['continueChat'](_0x3ee5d2,_0x2cc70c,_0x24995e?.['signal'])){yield{'type':_0x2997a7(0x226),'data':_0x1d276};}}async[a181_0x20204d(0x188)](_0x4291e1=0x32){const _0x413ede=a181_0x20204d;return await this[_0x413ede(0x221)]['listChats'](_0x4291e1);}async[a181_0x20204d(0x1eb)](_0x261df2){return await this['client']['getChatHistory'](_0x261df2);}async[a181_0x20204d(0x1b1)](_0xab9648){const _0x5acba4=a181_0x20204d;return await this[_0x5acba4(0x221)][_0x5acba4(0x1b1)](_0xab9648);}async[a181_0x20204d(0x20f)](_0x380ae7){const _0x27a2aa=a181_0x20204d;return await this[_0x27a2aa(0x221)][_0x27a2aa(0x175)](_0x380ae7);}async['backupProject'](_0x3c096d,_0x3f024d,_0x397466){const _0x38acaf=a181_0x20204d,_0x559922=_0x397466?.['dryRun']??![],{projectId:_0x48ef18,project:_0x3ffe16}=await this[_0x38acaf(0x208)](_0x3c096d),_0x49a539=_0x3ffe16[_0x38acaf(0x1c5)][_0x38acaf(0x12f)],_0x1aaf77=_0x3f024d||_0x49a539+'.llm';if(a181_0x4ca2ec[_0x38acaf(0x1b2)](_0x1aaf77)&&!_0x559922)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x38acaf(0x1aa)+_0x1aaf77,undefined,{'helpText':_0x38acaf(0x133)});const _0xfcac1=await this[_0x38acaf(0x221)][_0x38acaf(0x1d4)](_0x48ef18),_0x1f403e=await this[_0x38acaf(0x221)]['listKnowledgeBases'](_0x48ef18),_0x21b3e9=await this[_0x38acaf(0x221)][_0x38acaf(0x1df)](_0x48ef18),_0x72ec13=await this['client'][_0x38acaf(0x1c1)](_0x48ef18);if(!_0x559922){a181_0x4ca2ec[_0x38acaf(0x222)](_0x1aaf77,{'recursive':!![]});const _0x125a21={'version':_0x38acaf(0x1b8),'exportedAt':new Date()[_0x38acaf(0x1f8)](),'exportedFrom':{'site':this[_0x38acaf(0x1de)][_0x38acaf(0x220)],'projectId':_0x48ef18,'projectName':_0x49a539},'project':_0x3ffe16};a181_0x4ca2ec['writeFileSync'](a181_0xdd0961[_0x38acaf(0x1e1)](_0x1aaf77,_0x38acaf(0x184)),JSON[_0x38acaf(0x125)](_0x125a21,null,0x2)),a181_0x4ca2ec[_0x38acaf(0x189)](a181_0xdd0961['join'](_0x1aaf77,_0x38acaf(0x187)),JSON[_0x38acaf(0x125)](_0xfcac1,null,0x2)),a181_0x4ca2ec[_0x38acaf(0x189)](a181_0xdd0961[_0x38acaf(0x1e1)](_0x1aaf77,'knowledgebases.json'),JSON['stringify'](_0x1f403e,null,0x2)),a181_0x4ca2ec['writeFileSync'](a181_0xdd0961[_0x38acaf(0x1e1)](_0x1aaf77,_0x38acaf(0x22b)),JSON['stringify'](_0x21b3e9,null,0x2)),a181_0x4ca2ec[_0x38acaf(0x189)](a181_0xdd0961['join'](_0x1aaf77,_0x38acaf(0x1c8)),JSON['stringify'](_0x72ec13,null,0x2));}return{'projectName':_0x49a539,'outputDir':_0x1aaf77,'counts':{'agents':_0xfcac1[_0x38acaf(0x1d1)],'knowledgeBases':_0x1f403e['length'],'prompts':_0x21b3e9['length'],'integrations':_0x72ec13[_0x38acaf(0x1d1)]}};}async[a181_0x20204d(0x11b)](_0x2830be,_0x58abf0){const _0x5bbe01=a181_0x20204d,_0x4c5444=_0x58abf0?.[_0x5bbe01(0x1d2)]??![],_0x52c6dc=this[_0x5bbe01(0x147)](_0x2830be),_0x763dbc=_0x52c6dc[_0x5bbe01(0x17c)]['site'],_0x5ac851=this[_0x5bbe01(0x1de)][_0x5bbe01(0x220)],_0x252f72=_0x763dbc!==_0x5ac851?_0x763dbc:undefined,_0x15e493=this['loadJsonFile'](a181_0xdd0961[_0x5bbe01(0x1e1)](_0x2830be,_0x5bbe01(0x187)),[]),_0x187cfe=this[_0x5bbe01(0x150)](a181_0xdd0961[_0x5bbe01(0x1e1)](_0x2830be,'knowledgebases.json'),[]),_0x3b82cd=this[_0x5bbe01(0x150)](a181_0xdd0961[_0x5bbe01(0x1e1)](_0x2830be,_0x5bbe01(0x22b)),[]),_0x322200=this[_0x5bbe01(0x150)](a181_0xdd0961['join'](_0x2830be,_0x5bbe01(0x1c8)),[]),_0x3c334c=_0x58abf0?.[_0x5bbe01(0x12f)]||_0x52c6dc[_0x5bbe01(0x17c)][_0x5bbe01(0x1cf)];if(_0x4c5444){const _0x1e8f93=new Map(),_0x442181=[..._0x15e493],_0x53315e=_0x15e493['length']+0x1;let _0x4c07ef=0x0;while(_0x442181['length']>0x0&&_0x4c07ef<_0x53315e){_0x4c07ef++;const _0x495a1e=[];for(const _0x31fddf of _0x442181){canCreateAgent(_0x31fddf,_0x1e8f93)?_0x1e8f93[_0x5bbe01(0x1a2)](_0x31fddf['id'],_0x5bbe01(0x20a)+_0x31fddf['id']):_0x495a1e[_0x5bbe01(0x209)](_0x31fddf);}if(_0x495a1e[_0x5bbe01(0x1d1)]===_0x442181[_0x5bbe01(0x1d1)])throw new SDKError(ErrorCode['INTERNAL'],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x5bbe01(0x1b4)});_0x442181[_0x5bbe01(0x1d1)]=0x0,_0x442181[_0x5bbe01(0x209)](..._0x495a1e);}const _0x25a6dd=_0x3b82cd[_0x5bbe01(0x1e9)](_0x444fa3=>_0x1e8f93[_0x5bbe01(0x11e)](_0x444fa3[_0x5bbe01(0x1c5)]['agentId']))[_0x5bbe01(0x1d1)];return{'projectName':_0x3c334c,'projectId':_0x5bbe01(0x1ee),'counts':{'agents':_0x15e493[_0x5bbe01(0x1d1)],'knowledgeBases':_0x187cfe[_0x5bbe01(0x1d1)],'prompts':_0x25a6dd,'integrations':_0x322200[_0x5bbe01(0x1d1)]},'sourceSite':_0x252f72};}const _0x57def5=await this[_0x5bbe01(0x221)]['createProject']({'name':_0x3c334c,'description':_0x52c6dc[_0x5bbe01(0x1d0)]['attributes'][_0x5bbe01(0x1fd)]}),_0x4325dd=_0x57def5['id'],_0x2962eb=new Map(),_0x38e0b4=new Map(),_0x2a61bc=new Map();for(const _0x144096 of _0x187cfe){const _0x27f733=await this[_0x5bbe01(0x221)][_0x5bbe01(0x207)]({'projectId':_0x4325dd,'name':_0x144096[_0x5bbe01(0x1c5)][_0x5bbe01(0x12f)],'tdDatabaseName':_0x144096[_0x5bbe01(0x1c5)]['tdDatabaseName'],'tables':_0x144096[_0x5bbe01(0x1c5)][_0x5bbe01(0x21c)]});_0x2962eb[_0x5bbe01(0x1a2)](_0x144096['id'],_0x27f733['id']);}const _0x57de8b=[..._0x15e493],_0x43007c=_0x15e493[_0x5bbe01(0x1d1)]+0x1;let _0x16d83a=0x0;while(_0x57de8b[_0x5bbe01(0x1d1)]>0x0&&_0x16d83a<_0x43007c){_0x16d83a++;const _0x1382cc=[];for(const _0xb78883 of _0x57de8b){if(canCreateAgent(_0xb78883,_0x38e0b4)){const _0x3ca4e3=remapToolIds(_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x1ea)],_0x2962eb,_0x38e0b4),_0x5b6a5d=remapVariableIds(_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x16c)],_0x2962eb),_0x120fb6=await this['client']['createAgentResponse']({'name':_0xb78883[_0x5bbe01(0x1c5)]['name'],'projectId':_0x4325dd,'systemPrompt':_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x1b0)],'starterMessage':_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x224)],'modelType':migrateModelType(_0xb78883['attributes'][_0x5bbe01(0x119)]),'maxToolIterations':_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x131)],'temperature':_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x19a)],'reasoningEffort':_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x17d)],'outputs':_0xb78883[_0x5bbe01(0x1c5)][_0x5bbe01(0x15f)],'tools':_0x3ca4e3,'variables':_0x5b6a5d});_0x38e0b4['set'](_0xb78883['id'],_0x120fb6['id']);}else _0x1382cc[_0x5bbe01(0x209)](_0xb78883);}if(_0x1382cc['length']===_0x57de8b[_0x5bbe01(0x1d1)])throw new SDKError(ErrorCode[_0x5bbe01(0x15b)],_0x5bbe01(0x21a),undefined,{'helpText':_0x5bbe01(0x1b4)});_0x57de8b[_0x5bbe01(0x1d1)]=0x0,_0x57de8b['push'](..._0x1382cc);}for(const _0x2edd93 of _0x3b82cd){const _0x2ce090=_0x38e0b4[_0x5bbe01(0x16f)](_0x2edd93[_0x5bbe01(0x1c5)][_0x5bbe01(0x11d)]);if(!_0x2ce090)continue;const _0x1cc844=await this[_0x5bbe01(0x221)][_0x5bbe01(0x217)]({'projectId':_0x4325dd,'agentId':_0x2ce090,'name':_0x2edd93[_0x5bbe01(0x1c5)][_0x5bbe01(0x12f)],'systemPrompt':_0x2edd93[_0x5bbe01(0x1c5)][_0x5bbe01(0x1b0)],'template':_0x2edd93[_0x5bbe01(0x1c5)][_0x5bbe01(0x18d)],'jsonSchemaHint':_0x2edd93[_0x5bbe01(0x1c5)][_0x5bbe01(0x238)]});_0x2a61bc['set'](_0x2edd93['id'],_0x1cc844['id']);}for(const _0x118e32 of _0x322200){const _0x362170=_0x118e32[_0x5bbe01(0x1c5)]['actions']['map'](_0x2a80b2=>({..._0x2a80b2,'promptId':_0x2a61bc[_0x5bbe01(0x16f)](_0x2a80b2[_0x5bbe01(0x22f)])||_0x2a80b2['promptId']}));await this['client'][_0x5bbe01(0x1d7)]({'projectId':_0x4325dd,'serviceType':_0x118e32[_0x5bbe01(0x1c5)][_0x5bbe01(0x17a)],'actions':_0x362170,'slackMessageMode':_0x118e32['attributes'][_0x5bbe01(0x1f6)],'chatIgnoreManagedActions':_0x118e32[_0x5bbe01(0x1c5)][_0x5bbe01(0x143)],'chatWelcomeMessage':_0x118e32[_0x5bbe01(0x1c5)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x118e32[_0x5bbe01(0x1c5)][_0x5bbe01(0x191)]});}return{'projectName':_0x3c334c,'projectId':_0x4325dd,'counts':{'agents':_0x38e0b4[_0x5bbe01(0x1a1)],'knowledgeBases':_0x2962eb[_0x5bbe01(0x1a1)],'prompts':_0x2a61bc[_0x5bbe01(0x1a1)],'integrations':_0x322200['length']},'sourceSite':_0x252f72};}[a181_0x20204d(0x150)](_0x62493,_0x477d09){const _0x12c0ff=a181_0x20204d;if(!a181_0x4ca2ec[_0x12c0ff(0x1b2)](_0x62493))return _0x477d09;return JSON['parse'](a181_0x4ca2ec['readFileSync'](_0x62493,_0x12c0ff(0x129)));}['getBackupMetadata'](_0x3dc3e7){const _0x9c00fc=a181_0x20204d;if(!a181_0x4ca2ec[_0x9c00fc(0x1b2)](_0x3dc3e7))throw new SDKError(ErrorCode['NOT_FOUND'],_0x9c00fc(0x16b)+_0x3dc3e7,undefined,{'helpText':_0x9c00fc(0x210)});const _0x4d5bc9=a181_0xdd0961['join'](_0x3dc3e7,_0x9c00fc(0x184));if(!a181_0x4ca2ec['existsSync'](_0x4d5bc9))throw new SDKError(ErrorCode[_0x9c00fc(0x1ef)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x3dc3e7,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x233ce2=JSON[_0x9c00fc(0x223)](a181_0x4ca2ec['readFileSync'](_0x4d5bc9,_0x9c00fc(0x129)));if(!isSupportedBackupVersion(_0x233ce2[_0x9c00fc(0x19d)]))throw new SDKError(ErrorCode[_0x9c00fc(0x1ef)],_0x9c00fc(0x166)+_0x233ce2['version'],undefined,{'helpText':_0x9c00fc(0x22a)});return _0x233ce2;}async[a181_0x20204d(0x1e7)](_0x482ac6,_0x1aff44,_0xfe292a){const _0x3ef1d5=a181_0x20204d,{projectId:_0x1b9c7a,project:_0x14be40}=await this[_0x3ef1d5(0x208)](_0x482ac6),_0xadce89=_0x14be40[_0x3ef1d5(0x1c5)]['name'];let _0x909af4;if(_0x1aff44)_0x909af4=_0x1aff44;else{const _0x5bc8fd=a181_0xdd0961[_0x3ef1d5(0x1e1)](process[_0x3ef1d5(0x1c3)](),_0x3ef1d5(0x19c)),_0x3ccfa8=getSanitizedPathWithMigration(_0x5bc8fd,_0xadce89);_0x3ccfa8['renamed']&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x1dd)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x3ccfa8[_0x3ef1d5(0x212)])+_0x3ef1d5(0x164)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x3ccfa8['path'])),_0x909af4=_0x3ccfa8[_0x3ef1d5(0x13e)];}const _0x2d3085=await this[_0x3ef1d5(0x221)][_0x3ef1d5(0x1d4)](_0x1b9c7a),_0x458648=await this[_0x3ef1d5(0x221)][_0x3ef1d5(0x1f4)](_0x1b9c7a),_0xcacfec=await this[_0x3ef1d5(0x221)][_0x3ef1d5(0x21b)](_0x1b9c7a),_0xa48a9c=await safeListOrEmpty(()=>this[_0x3ef1d5(0x221)]['listImageGenerators'](_0x1b9c7a)),_0x211a39=await safeListOrEmpty(()=>this[_0x3ef1d5(0x221)][_0x3ef1d5(0x1a7)](_0x1b9c7a)),_0x247ed9=await this['client'][_0x3ef1d5(0x1df)](_0x1b9c7a),_0x20bdc1=await this[_0x3ef1d5(0x221)][_0x3ef1d5(0x1c1)](_0x1b9c7a),_0x38c0db=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x1b9c7a)),_0x3cd57b=await safeListOrEmpty(()=>this[_0x3ef1d5(0x221)][_0x3ef1d5(0x157)](_0x1b9c7a)),_0x15bb70=await safeListOrEmpty(()=>this[_0x3ef1d5(0x221)][_0x3ef1d5(0x198)](_0x1b9c7a)),_0xd5cf04=await safeListOrEmpty(()=>this['client'][_0x3ef1d5(0x19f)](_0x1b9c7a)),_0xcd7875=_0x20bdc1[_0x3ef1d5(0x1e9)](_0x577252=>!_0x577252[_0x3ef1d5(0x1c5)]['isManaged']&&SAFE_INTEGRATION_TYPES['includes'](_0x577252[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x17a)]['toLowerCase']())),_0x34fd5f=new Map(),_0x24bcd3=new Map(),_0x313730=new Map(),_0x27bca4=new Map(),_0x23cb9d=new Map(),_0x33f31c=new Map(),_0x3c8302=new Map();for(const _0x5e2d13 of _0x2d3085){_0x34fd5f[_0x3ef1d5(0x1a2)](_0x5e2d13['id'],_0x5e2d13[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)]);}for(const _0x7c70ca of _0x458648){_0x24bcd3[_0x3ef1d5(0x1a2)](_0x7c70ca['id'],_0x7c70ca[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)]);}for(const _0x363f98 of _0xcacfec){_0x313730[_0x3ef1d5(0x1a2)](_0x363f98['id'],_0x363f98['attributes'][_0x3ef1d5(0x12f)]);}for(const _0xd6dff1 of _0xa48a9c){_0x27bca4[_0x3ef1d5(0x1a2)](_0xd6dff1['id'],_0xd6dff1[_0x3ef1d5(0x1c5)]['name']);}for(const _0x3ec2a4 of _0x211a39){_0x23cb9d['set'](_0x3ec2a4['id'],_0x3ec2a4[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)]);}for(const _0x1b8aeb of _0x247ed9){_0x33f31c[_0x3ef1d5(0x1a2)](_0x1b8aeb['id'],_0x1b8aeb[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)]);}for(const _0xf3bca3 of _0x38c0db){_0x3c8302[_0x3ef1d5(0x1a2)](_0xf3bca3['id'],_0xf3bca3[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)]);}const _0x17efca={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x24bcd3,'TextKnowledgeBase':_0x313730,'Agent':_0x34fd5f,'WebSearchTool':_0x23cb9d,'ImageGenerator':_0x27bca4,'ExperimentalKnowledgeBase':_0x3c8302}),'resolvePromptName':async _0x1755a6=>_0x33f31c['get'](_0x1755a6),'onWarning':_0x2c5538=>this['logger'][_0x3ef1d5(0x20d)](_0x2c5538)},_0x47fe0b={'projectName':_0xadce89,'outputDir':_0x909af4,'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}}},_0x210683=[],_0x18d933=[];for(const _0x366954 of _0x2d3085){const _0x3503c5=getSanitizedPathWithMigration(_0x909af4,_0x366954[_0x3ef1d5(0x1c5)]['name']);_0x3503c5['renamed']&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x120)+a181_0xdd0961['basename'](_0x3503c5['oldPath'])+'\x20→\x20'+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x3503c5[_0x3ef1d5(0x13e)]));const _0x432127=_0x3503c5[_0x3ef1d5(0x13e)],_0x583958=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x432127,_0x3ef1d5(0x1e5)),_0x42d8cd=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x432127,_0x3ef1d5(0x118)),_0x87f6ee=a181_0xdd0961['join'](_0x432127,'starter_message.md'),{yaml:_0x3e0ab7,systemPrompt:_0x4f9c78,starterMessage:_0x255a96}=await agentResponseToDef(_0x366954,_0x17efca),_0x4734ac=toAgentYamlString(_0x3e0ab7),_0x43f710=!a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x42d8cd);let _0x37a1d9=_0x43f710,_0x38c183;if(!_0x43f710){const _0x583637=a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x583958)?a181_0x4ca2ec['readFileSync'](_0x583958,'utf-8'):'',_0x5e780b=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x42d8cd,_0x3ef1d5(0x129)),_0x38a149=_0x3ef1d5(0x151)+_0x583637+_0x3ef1d5(0x1a9)+_0x5e780b,_0x5bc2b3=_0x3ef1d5(0x151)+_0x4f9c78+_0x3ef1d5(0x1a9)+_0x4734ac,_0xfa7bc1=generateDiff(_0x38a149,_0x5bc2b3);_0x37a1d9=hasChanges(_0xfa7bc1),_0x37a1d9&&(_0x38c183=formatDiffWithColors(_0xfa7bc1));}_0x210683[_0x3ef1d5(0x209)]({'path':_0x432127,'content':'','isDir':!![]}),_0x210683[_0x3ef1d5(0x209)]({'path':_0x583958,'content':_0x4f9c78}),_0x210683[_0x3ef1d5(0x209)]({'path':_0x42d8cd,'content':_0x4734ac});_0x255a96&&_0x255a96[_0x3ef1d5(0x1f2)]('\x0a')&&_0x210683[_0x3ef1d5(0x209)]({'path':_0x87f6ee,'content':_0x255a96});_0x47fe0b[_0x3ef1d5(0x19c)][_0x3ef1d5(0x209)]({'agentName':_0x366954[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],'outputPath':_0x432127,'isNew':_0x43f710,'hasChanges':_0x37a1d9,'diff':_0x38c183}),_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x19c)][_0x3ef1d5(0x22d)]++;if(_0x43f710)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x19c)][_0x3ef1d5(0x161)]++;else{if(_0x37a1d9)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x19c)]['updated']++;else _0x47fe0b[_0x3ef1d5(0x211)]['agents'][_0x3ef1d5(0x19b)]++;}}for(const _0x26723f of _0x458648){if(_0x26723f[_0x3ef1d5(0x1c5)]['isManaged'])continue;const _0x399334=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x909af4),_0x26723f[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],_0x3ef1d5(0x1dc));_0x399334[_0x3ef1d5(0x15a)]&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x116)+a181_0xdd0961['basename'](_0x399334[_0x3ef1d5(0x212)])+_0x3ef1d5(0x164)+a181_0xdd0961['basename'](_0x399334[_0x3ef1d5(0x13e)]));const _0x520444=_0x399334[_0x3ef1d5(0x13e)],_0x5b7072=apiKnowledgeBaseToYaml(_0x26723f),_0x6f0bf0=toKnowledgeBaseYamlString(_0x5b7072),_0x26f2d9=!a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x520444);let _0x152555=_0x26f2d9,_0x40c574;if(!_0x26f2d9){const _0x26e688=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x520444,_0x3ef1d5(0x129)),_0x108ca7=generateDiff(_0x26e688,_0x6f0bf0);_0x152555=hasChanges(_0x108ca7),_0x152555&&(_0x40c574=formatDiffWithColors(_0x108ca7));}_0x210683[_0x3ef1d5(0x209)]({'path':_0x520444,'content':_0x6f0bf0}),_0x47fe0b['knowledgeBases'][_0x3ef1d5(0x209)]({'name':_0x26723f['attributes'][_0x3ef1d5(0x12f)],'outputPath':_0x520444,'isNew':_0x26f2d9,'hasChanges':_0x152555,'diff':_0x40c574}),_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1be)]['total']++;if(_0x26f2d9)_0x47fe0b[_0x3ef1d5(0x211)]['knowledgeBases'][_0x3ef1d5(0x161)]++;else{if(_0x152555)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1be)][_0x3ef1d5(0x176)]++;else _0x47fe0b['counts'][_0x3ef1d5(0x1be)]['unchanged']++;}}for(const _0x4386d0 of _0xcacfec){if(_0x4386d0['attributes'][_0x3ef1d5(0x132)])continue;const _0x47699b=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x909af4),_0x4386d0[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],_0x3ef1d5(0x218));_0x47699b[_0x3ef1d5(0x15a)]&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x203)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x47699b[_0x3ef1d5(0x212)])+_0x3ef1d5(0x164)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x47699b[_0x3ef1d5(0x13e)]));const _0x4625d6=_0x47699b[_0x3ef1d5(0x13e)],_0x533351=toTextKnowledgeBaseMd(_0x4386d0['attributes']['name'],_0x4386d0[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x121)]),_0x5e5bec=!a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x4625d6);let _0x2a02d9=_0x5e5bec,_0x43a94b;if(!_0x5e5bec){const _0x2b2c7f=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x4625d6,'utf-8'),_0x5683b0=generateDiff(_0x2b2c7f,_0x533351);_0x2a02d9=hasChanges(_0x5683b0),_0x2a02d9&&(_0x43a94b=formatDiffWithColors(_0x5683b0));}_0x210683['push']({'path':_0x4625d6,'content':_0x533351}),_0x47fe0b[_0x3ef1d5(0x1cd)][_0x3ef1d5(0x209)]({'name':_0x4386d0[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],'outputPath':_0x4625d6,'isNew':_0x5e5bec,'hasChanges':_0x2a02d9,'diff':_0x43a94b}),_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1cd)][_0x3ef1d5(0x22d)]++;if(_0x5e5bec)_0x47fe0b['counts'][_0x3ef1d5(0x1cd)][_0x3ef1d5(0x161)]++;else{if(_0x2a02d9)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1cd)]['updated']++;else _0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1cd)][_0x3ef1d5(0x19b)]++;}}for(const _0xf74be6 of _0x247ed9){if(_0xf74be6['attributes'][_0x3ef1d5(0x132)])continue;const _0x54b25b=getSanitizedPathWithMigration(getPromptsDir(_0x909af4),_0xf74be6[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],_0x3ef1d5(0x1dc));_0x54b25b[_0x3ef1d5(0x15a)]&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x1bf)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x54b25b[_0x3ef1d5(0x212)])+'\x20→\x20'+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x54b25b[_0x3ef1d5(0x13e)]));const _0x50c1d0=_0x54b25b['path'],_0x4d19d9=await apiPromptToYaml(_0xf74be6,_0x17efca);if(!_0x4d19d9)continue;const _0x570936=toPromptYamlString(_0x4d19d9),_0x4d6245=!a181_0x4ca2ec['existsSync'](_0x50c1d0);let _0x59397b=_0x4d6245,_0x295218;if(!_0x4d6245){const _0x59dffc=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x50c1d0,'utf-8'),_0x13b9e6=generateDiff(_0x59dffc,_0x570936);_0x59397b=hasChanges(_0x13b9e6),_0x59397b&&(_0x295218=formatDiffWithColors(_0x13b9e6));}_0x210683[_0x3ef1d5(0x209)]({'path':_0x50c1d0,'content':_0x570936}),_0x47fe0b[_0x3ef1d5(0x15d)][_0x3ef1d5(0x209)]({'name':_0xf74be6[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],'outputPath':_0x50c1d0,'isNew':_0x4d6245,'hasChanges':_0x59397b,'diff':_0x295218}),_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x15d)][_0x3ef1d5(0x22d)]++;if(_0x4d6245)_0x47fe0b['counts'][_0x3ef1d5(0x15d)][_0x3ef1d5(0x161)]++;else{if(_0x59397b)_0x47fe0b['counts'][_0x3ef1d5(0x15d)]['updated']++;else _0x47fe0b['counts'][_0x3ef1d5(0x15d)][_0x3ef1d5(0x19b)]++;}}for(const _0x3f38f2 of _0xcd7875){const _0x2fe0b4=_0x3f38f2['attributes'][_0x3ef1d5(0x17a)][_0x3ef1d5(0x1ae)](),_0x8eb1b1=getSanitizedPathWithMigration(getIntegrationsDir(_0x909af4),_0x2fe0b4,_0x3ef1d5(0x1dc));_0x8eb1b1[_0x3ef1d5(0x15a)]&&this[_0x3ef1d5(0x1ec)]['info']('Renamed\x20integration\x20file:\x20'+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x8eb1b1[_0x3ef1d5(0x212)])+_0x3ef1d5(0x164)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x8eb1b1[_0x3ef1d5(0x13e)]));const _0x5d95e0=_0x8eb1b1[_0x3ef1d5(0x13e)],_0x30ba63=await apiIntegrationToYaml(_0x3f38f2,_0x17efca),_0x518397=toIntegrationYamlString(_0x30ba63),_0x59f58b=!a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x5d95e0);let _0x2f7342=_0x59f58b,_0x388a3d;if(!_0x59f58b){const _0x31393f=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x5d95e0,'utf-8'),_0x19a2d9=generateDiff(_0x31393f,_0x518397);_0x2f7342=hasChanges(_0x19a2d9),_0x2f7342&&(_0x388a3d=formatDiffWithColors(_0x19a2d9));}_0x210683['push']({'path':_0x5d95e0,'content':_0x518397}),_0x47fe0b[_0x3ef1d5(0x14b)][_0x3ef1d5(0x209)]({'name':_0x2fe0b4,'outputPath':_0x5d95e0,'isNew':_0x59f58b,'hasChanges':_0x2f7342,'diff':_0x388a3d}),_0x47fe0b['counts'][_0x3ef1d5(0x14b)][_0x3ef1d5(0x22d)]++;if(_0x59f58b)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x14b)][_0x3ef1d5(0x161)]++;else{if(_0x2f7342)_0x47fe0b[_0x3ef1d5(0x211)]['integrations'][_0x3ef1d5(0x176)]++;else _0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x14b)]['unchanged']++;}}for(const _0x4cbacf of _0x38c0db){if(_0x4cbacf[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x132)])continue;const _0x4a160a=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x909af4),_0x4cbacf[_0x3ef1d5(0x1c5)]['name']);_0x4a160a[_0x3ef1d5(0x15a)]&&this['logger'][_0x3ef1d5(0x15e)](_0x3ef1d5(0x17e)+a181_0xdd0961['basename'](_0x4a160a[_0x3ef1d5(0x212)])+'\x20→\x20'+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x4a160a[_0x3ef1d5(0x13e)]));const _0x2dc0c3=_0x4a160a[_0x3ef1d5(0x13e)],_0x2fe07d=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x2dc0c3,sanitizeForFilesystem(_0x4cbacf[_0x3ef1d5(0x1c5)]['name'])+_0x3ef1d5(0x1dc)),_0x13ad34=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x2dc0c3,'functions'),_0x46700c=apiExperimentalKnowledgeBaseToYaml(_0x4cbacf),_0x22201d=toExperimentalKnowledgeBaseYamlString(_0x46700c),_0x1d13e0=!a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x2dc0c3);let _0x20b834=_0x1d13e0,_0x10c852,_0x4dec8e=_0x22201d;const _0x31fc52=[..._0x46700c['functions']]['sort']((_0x1969c1,_0x37e35b)=>_0x1969c1[_0x3ef1d5(0x12f)][_0x3ef1d5(0x1d5)](_0x37e35b[_0x3ef1d5(0x12f)]));for(const _0x144702 of _0x31fc52){_0x4dec8e+='\x0a---\x20function:\x20'+_0x144702[_0x3ef1d5(0x12f)]+_0x3ef1d5(0x1f3)+_0x144702[_0x3ef1d5(0x17f)]+'\x0a---\x20schema:\x20'+_0x144702['name']+_0x3ef1d5(0x1f3)+_0x144702[_0x3ef1d5(0x232)]+'\x0a';}if(!_0x1d13e0){let _0x45b10d='';a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x2fe07d)&&(_0x45b10d=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x2fe07d,_0x3ef1d5(0x129)));if(a181_0x4ca2ec['existsSync'](_0x13ad34)){const _0x2c10e9=a181_0x4ca2ec[_0x3ef1d5(0x193)](_0x13ad34,{'withFileTypes':!![]}),_0x5bec05=_0x2c10e9['filter'](_0x4b7bb4=>_0x4b7bb4[_0x3ef1d5(0x192)]())[_0x3ef1d5(0x11f)]((_0x325f7a,_0x2e7b52)=>_0x325f7a[_0x3ef1d5(0x12f)][_0x3ef1d5(0x1d5)](_0x2e7b52['name']));for(const _0x34b9f4 of _0x5bec05){const _0xfe38c6=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x13ad34,_0x34b9f4[_0x3ef1d5(0x12f)],_0x3ef1d5(0x15c)),_0x162a2e=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x13ad34,_0x34b9f4[_0x3ef1d5(0x12f)],_0x3ef1d5(0x20e));a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0xfe38c6)&&(_0x45b10d+=_0x3ef1d5(0x225)+_0x34b9f4[_0x3ef1d5(0x12f)]+_0x3ef1d5(0x1f3)+a181_0x4ca2ec['readFileSync'](_0xfe38c6,_0x3ef1d5(0x129))+'\x0a'),a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x162a2e)&&(_0x45b10d+=_0x3ef1d5(0x173)+_0x34b9f4['name']+_0x3ef1d5(0x1f3)+a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x162a2e,'utf-8')+'\x0a');}}const _0xcf30f9=generateDiff(_0x45b10d,_0x4dec8e);_0x20b834=hasChanges(_0xcf30f9),_0x20b834&&(_0x10c852=formatDiffWithColors(_0xcf30f9));}_0x210683[_0x3ef1d5(0x209)]({'path':_0x2dc0c3,'content':'','isDir':!![]}),_0x210683[_0x3ef1d5(0x209)]({'path':_0x2fe07d,'content':_0x22201d}),_0x210683['push']({'path':_0x13ad34,'content':'','isDir':!![]});for(const _0x5c4b08 of _0x46700c[_0x3ef1d5(0x206)]){const _0x3f7113=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x13ad34,sanitizeForFilesystem(_0x5c4b08['name'])),_0x59e60d=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x3f7113,'code.js'),_0x4c0e0b=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x3f7113,_0x3ef1d5(0x20e));_0x210683[_0x3ef1d5(0x209)]({'path':_0x3f7113,'content':'','isDir':!![]}),_0x210683[_0x3ef1d5(0x209)]({'path':_0x59e60d,'content':_0x5c4b08[_0x3ef1d5(0x17f)]}),_0x210683[_0x3ef1d5(0x209)]({'path':_0x4c0e0b,'content':_0x5c4b08['json_schema']});}if(a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x13ad34)){const _0x550520=a181_0x4ca2ec[_0x3ef1d5(0x193)](_0x13ad34,{'withFileTypes':!![]}),_0x58f761=new Set(_0x46700c[_0x3ef1d5(0x206)][_0x3ef1d5(0x21d)](_0x4aed1d=>sanitizeForFilesystem(_0x4aed1d[_0x3ef1d5(0x12f)])));for(const _0x571776 of _0x550520){if(_0x571776[_0x3ef1d5(0x192)]()&&!_0x58f761[_0x3ef1d5(0x11e)](_0x571776[_0x3ef1d5(0x12f)])){const _0x1d6acb=a181_0xdd0961['join'](_0x13ad34,_0x571776[_0x3ef1d5(0x12f)]);_0x18d933[_0x3ef1d5(0x209)]({'path':_0x1d6acb,'isDir':!![]});}}}_0x47fe0b[_0x3ef1d5(0x21e)][_0x3ef1d5(0x209)]({'name':_0x4cbacf['attributes'][_0x3ef1d5(0x12f)],'outputPath':_0x2dc0c3,'isNew':_0x1d13e0,'hasChanges':_0x20b834,'diff':_0x10c852}),_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x21e)][_0x3ef1d5(0x22d)]++;if(_0x1d13e0)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x21e)][_0x3ef1d5(0x161)]++;else{if(_0x20b834)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x21e)][_0x3ef1d5(0x176)]++;else _0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x21e)][_0x3ef1d5(0x19b)]++;}}for(const _0x167e24 of _0x3cd57b){if(_0x167e24['attributes']['isManaged'])continue;const _0x3c340d=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x909af4),_0x167e24['attributes']['name']);_0x3c340d[_0x3ef1d5(0x15a)]&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x1ed)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x3c340d[_0x3ef1d5(0x212)])+_0x3ef1d5(0x164)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x3c340d['path']));const _0x5955cf=_0x3c340d[_0x3ef1d5(0x13e)],_0x1b9a61=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x5955cf,sanitizeForFilesystem(_0x167e24[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)])+_0x3ef1d5(0x1dc)),_0x50b35b=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x5955cf,'code.js'),_0x2076f8=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x5955cf,'files'),_0x248236=apiExperimentalArtifactToYaml(_0x167e24),_0x22ab54=toExperimentalArtifactYamlString(_0x248236),_0xcd9156=!a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x5955cf);let _0x1c3561=_0xcd9156,_0x416a07,_0x4c5f7c=_0x22ab54+(_0x3ef1d5(0x1fa)+_0x248236['code']+'\x0a');const _0x1b011b=[..._0x248236[_0x3ef1d5(0x12a)]][_0x3ef1d5(0x11f)]((_0xf53b9e,_0x5c35c3)=>_0xf53b9e['file_name'][_0x3ef1d5(0x1d5)](_0x5c35c3['file_name']));for(const _0x1299cc of _0x1b011b){_0x4c5f7c+='---\x20file:\x20'+_0x1299cc[_0x3ef1d5(0x199)]+_0x3ef1d5(0x1f3)+_0x1299cc[_0x3ef1d5(0x1c0)]+'\x0a';}if(!_0xcd9156){let _0x24254f='';a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x1b9a61)&&(_0x24254f=a181_0x4ca2ec['readFileSync'](_0x1b9a61,_0x3ef1d5(0x129)));a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x50b35b)&&(_0x24254f+=_0x3ef1d5(0x1fa)+a181_0x4ca2ec['readFileSync'](_0x50b35b,_0x3ef1d5(0x129))+'\x0a');if(a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x2076f8)){const _0x24f007=a181_0x4ca2ec['readdirSync'](_0x2076f8),_0x2800d2=_0x24f007[_0x3ef1d5(0x1e9)](_0x5c7415=>{const _0x2765b3=_0x3ef1d5,_0x183ce8=a181_0xdd0961['join'](_0x2076f8,_0x5c7415);return a181_0x4ca2ec[_0x2765b3(0x135)](_0x183ce8)[_0x2765b3(0x137)]();})['sort']((_0x5037fb,_0x265c9e)=>_0x5037fb['localeCompare'](_0x265c9e));for(const _0x30e34b of _0x2800d2){const _0x38040a=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x2076f8,_0x30e34b);_0x24254f+=_0x3ef1d5(0x181)+_0x30e34b+_0x3ef1d5(0x1f3)+a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x38040a,'utf-8')+'\x0a';}}const _0x5b5fc2=generateDiff(_0x24254f,_0x4c5f7c);_0x1c3561=hasChanges(_0x5b5fc2),_0x1c3561&&(_0x416a07=formatDiffWithColors(_0x5b5fc2));}_0x210683[_0x3ef1d5(0x209)]({'path':_0x5955cf,'content':'','isDir':!![]}),_0x210683[_0x3ef1d5(0x209)]({'path':_0x1b9a61,'content':_0x22ab54}),_0x210683['push']({'path':_0x50b35b,'content':_0x248236[_0x3ef1d5(0x17f)]});if(_0x248236[_0x3ef1d5(0x12a)][_0x3ef1d5(0x1d1)]>0x0){_0x210683[_0x3ef1d5(0x209)]({'path':_0x2076f8,'content':'','isDir':!![]});for(const _0x41540c of _0x248236[_0x3ef1d5(0x12a)]){const _0x4b4edd=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x2076f8,_0x41540c[_0x3ef1d5(0x199)]);_0x210683[_0x3ef1d5(0x209)]({'path':_0x4b4edd,'content':_0x41540c[_0x3ef1d5(0x1c0)]});}}if(a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x2076f8)){const _0x3e7071=a181_0x4ca2ec[_0x3ef1d5(0x193)](_0x2076f8),_0x350ad4=new Set(_0x248236[_0x3ef1d5(0x12a)][_0x3ef1d5(0x21d)](_0x544f1a=>_0x544f1a[_0x3ef1d5(0x199)]));for(const _0x234338 of _0x3e7071){const _0x43fcb1=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x2076f8,_0x234338);a181_0x4ca2ec[_0x3ef1d5(0x135)](_0x43fcb1)[_0x3ef1d5(0x137)]()&&!_0x350ad4[_0x3ef1d5(0x11e)](_0x234338)&&_0x18d933['push']({'path':_0x43fcb1});}}_0x47fe0b[_0x3ef1d5(0x1b5)]['push']({'name':_0x167e24['attributes']['name'],'outputPath':_0x5955cf,'isNew':_0xcd9156,'hasChanges':_0x1c3561,'diff':_0x416a07}),_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1b5)][_0x3ef1d5(0x22d)]++;if(_0xcd9156)_0x47fe0b['counts'][_0x3ef1d5(0x1b5)][_0x3ef1d5(0x161)]++;else{if(_0x1c3561)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1b5)][_0x3ef1d5(0x176)]++;else _0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1b5)][_0x3ef1d5(0x19b)]++;}}for(const _0x59a427 of _0x15bb70){const _0x2a6bd5=getSanitizedPathWithMigration(getFormInterfacesDir(_0x909af4),_0x59a427[_0x3ef1d5(0x1c5)]['name'],_0x3ef1d5(0x1dc));_0x2a6bd5[_0x3ef1d5(0x15a)]&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x197)+a181_0xdd0961['basename'](_0x2a6bd5[_0x3ef1d5(0x212)])+_0x3ef1d5(0x164)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x2a6bd5[_0x3ef1d5(0x13e)]));const _0x5bc0fd=_0x2a6bd5[_0x3ef1d5(0x13e)],_0x94ec85=await apiFormInterfaceToYaml(_0x59a427,_0x17efca),_0x2272dc=toFormInterfaceYamlString(_0x94ec85),_0x3d3c2d=!a181_0x4ca2ec[_0x3ef1d5(0x1b2)](_0x5bc0fd);let _0x150d2c=_0x3d3c2d,_0x3033c9;if(!_0x3d3c2d){const _0x490cff=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x5bc0fd,_0x3ef1d5(0x129)),_0x5d110e=generateDiff(_0x490cff,_0x2272dc);_0x150d2c=hasChanges(_0x5d110e),_0x150d2c&&(_0x3033c9=formatDiffWithColors(_0x5d110e));}_0x210683[_0x3ef1d5(0x209)]({'path':_0x5bc0fd,'content':_0x2272dc}),_0x47fe0b[_0x3ef1d5(0x1d9)]['push']({'name':_0x59a427[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],'outputPath':_0x5bc0fd,'isNew':_0x3d3c2d,'hasChanges':_0x150d2c,'diff':_0x3033c9}),_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1d9)][_0x3ef1d5(0x22d)]++;if(_0x3d3c2d)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1d9)][_0x3ef1d5(0x161)]++;else{if(_0x150d2c)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x1d9)][_0x3ef1d5(0x176)]++;else _0x47fe0b[_0x3ef1d5(0x211)]['formInterfaces'][_0x3ef1d5(0x19b)]++;}}for(const _0x4a0a6f of _0xd5cf04){if(_0x4a0a6f[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x132)])continue;const _0x2e0c5f=getSanitizedPathWithMigration(getChatInterfacesDir(_0x909af4),_0x4a0a6f[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],'.yml');_0x2e0c5f['renamed']&&this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x190)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x2e0c5f[_0x3ef1d5(0x212)])+_0x3ef1d5(0x164)+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x2e0c5f[_0x3ef1d5(0x13e)]));const _0x4e22c5=_0x2e0c5f[_0x3ef1d5(0x13e)],_0x3d5847=await apiChatInterfaceToYaml(_0x4a0a6f,_0x17efca),_0x9ba6e3=toChatInterfaceYamlString(_0x3d5847),_0x2858fc=!a181_0x4ca2ec['existsSync'](_0x4e22c5);let _0x4af43c=_0x2858fc,_0x739fcf;if(!_0x2858fc){const _0x59164a=a181_0x4ca2ec[_0x3ef1d5(0x186)](_0x4e22c5,_0x3ef1d5(0x129)),_0x3636be=generateDiff(_0x59164a,_0x9ba6e3);_0x4af43c=hasChanges(_0x3636be),_0x4af43c&&(_0x739fcf=formatDiffWithColors(_0x3636be));}_0x210683[_0x3ef1d5(0x209)]({'path':_0x4e22c5,'content':_0x9ba6e3}),_0x47fe0b['chatInterfaces'][_0x3ef1d5(0x209)]({'name':_0x4a0a6f[_0x3ef1d5(0x1c5)][_0x3ef1d5(0x12f)],'outputPath':_0x4e22c5,'isNew':_0x2858fc,'hasChanges':_0x4af43c,'diff':_0x739fcf}),_0x47fe0b['counts'][_0x3ef1d5(0x14a)][_0x3ef1d5(0x22d)]++;if(_0x2858fc)_0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x14a)]['new']++;else{if(_0x4af43c)_0x47fe0b['counts'][_0x3ef1d5(0x14a)]['updated']++;else _0x47fe0b[_0x3ef1d5(0x211)][_0x3ef1d5(0x14a)]['unchanged']++;}}if(_0xfe292a?.[_0x3ef1d5(0x1d2)])return _0x47fe0b;a181_0x4ca2ec[_0x3ef1d5(0x222)](_0x909af4,{'recursive':!![]}),a181_0x4ca2ec[_0x3ef1d5(0x222)](getKnowledgeBasesDir(_0x909af4),{'recursive':!![]}),a181_0x4ca2ec[_0x3ef1d5(0x222)](getPromptsDir(_0x909af4),{'recursive':!![]}),a181_0x4ca2ec['mkdirSync'](getIntegrationsDir(_0x909af4),{'recursive':!![]}),a181_0x4ca2ec['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x909af4),{'recursive':!![]}),a181_0x4ca2ec['mkdirSync'](getExperimentalArtifactsDir(_0x909af4),{'recursive':!![]}),a181_0x4ca2ec[_0x3ef1d5(0x222)](getFormInterfacesDir(_0x909af4),{'recursive':!![]}),a181_0x4ca2ec[_0x3ef1d5(0x222)](getChatInterfacesDir(_0x909af4),{'recursive':!![]});const _0x386530=a181_0xdd0961[_0x3ef1d5(0x1e1)](_0x909af4,_0x3ef1d5(0x230));a181_0x4ca2ec[_0x3ef1d5(0x189)](_0x386530,createAgentConfigContent(_0xadce89));for(const _0xb48c54 of _0x210683){if(_0xb48c54[_0x3ef1d5(0x134)])a181_0x4ca2ec[_0x3ef1d5(0x222)](_0xb48c54[_0x3ef1d5(0x13e)],{'recursive':!![]});else{const _0x56271d=a181_0xdd0961[_0x3ef1d5(0x1b3)](_0xb48c54['path']);!a181_0x4ca2ec['existsSync'](_0x56271d)&&a181_0x4ca2ec['mkdirSync'](_0x56271d,{'recursive':!![]}),a181_0x4ca2ec[_0x3ef1d5(0x189)](_0xb48c54[_0x3ef1d5(0x13e)],_0xb48c54['content']);}}for(const _0x5c0d65 of _0x18d933){_0x5c0d65['isDir']?(a181_0x4ca2ec[_0x3ef1d5(0x1bc)](_0x5c0d65[_0x3ef1d5(0x13e)],{'recursive':!![],'force':!![]}),this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x20c)+a181_0xdd0961[_0x3ef1d5(0x1ff)](a181_0xdd0961[_0x3ef1d5(0x1b3)](_0x5c0d65[_0x3ef1d5(0x13e)]))+'/'+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x5c0d65[_0x3ef1d5(0x13e)]))):(a181_0x4ca2ec[_0x3ef1d5(0x1bc)](_0x5c0d65[_0x3ef1d5(0x13e)],{'force':!![]}),this[_0x3ef1d5(0x1ec)][_0x3ef1d5(0x15e)](_0x3ef1d5(0x1ad)+a181_0xdd0961['basename'](a181_0xdd0961['dirname'](_0x5c0d65[_0x3ef1d5(0x13e)]))+'/'+a181_0xdd0961[_0x3ef1d5(0x1ff)](_0x5c0d65[_0x3ef1d5(0x13e)])));}return _0x47fe0b;}async[a181_0x20204d(0x180)](_0x2f0c24,_0x44dc9e){const _0x588b09=a181_0x20204d,_0x38019d=a181_0xdd0961['join'](_0x2f0c24,'tdx.json');if(!a181_0x4ca2ec['existsSync'](_0x38019d))throw new SDKError(ErrorCode[_0x588b09(0x1ef)],_0x588b09(0x140)+_0x2f0c24,undefined,{'helpText':_0x588b09(0x200)});const _0x47eb73=loadAgentConfig(_0x38019d),_0x1c9a70=await this[_0x588b09(0x16e)](_0x47eb73[_0x588b09(0x177)]),_0x56ff3a=await this[_0x588b09(0x221)][_0x588b09(0x1c2)](_0x1c9a70),_0x38904c=_0x56ff3a[_0x588b09(0x1c5)]['name'],_0x4e6bfa={'projectName':_0x38904c,'projectId':_0x1c9a70,'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}}},_0x400687=[],_0x44986d=[],_0x7d51eb=[],_0x5119ce=[],_0x2807d5=[],_0x4dc8c2=[],_0x5e67de=a181_0x4ca2ec[_0x588b09(0x193)](_0x2f0c24,{'withFileTypes':!![]});for(const _0x44f687 of _0x5e67de){if(!_0x44f687['isDirectory']())continue;if([_0x588b09(0x145),_0x588b09(0x15d),_0x588b09(0x14b),'experimental_knowledge_bases',_0x588b09(0x1af),_0x588b09(0x14d),_0x588b09(0x11c)][_0x588b09(0x1f2)](_0x44f687[_0x588b09(0x12f)]))continue;const _0x253f79=a181_0xdd0961[_0x588b09(0x1e1)](_0x2f0c24,_0x44f687[_0x588b09(0x12f)]);if(isAgentDir(_0x253f79)){const _0x25dd4d=a181_0xdd0961[_0x588b09(0x1e1)](_0x253f79,_0x588b09(0x118)),_0x28b6d6=a181_0xdd0961['join'](_0x253f79,_0x588b09(0x1e5)),_0x53ca2d=a181_0xdd0961[_0x588b09(0x1e1)](_0x253f79,_0x588b09(0x144)),_0x2f82bd=parseAgentYaml(a181_0x4ca2ec[_0x588b09(0x186)](_0x25dd4d,_0x588b09(0x129)),_0x25dd4d),_0x4e2475=a181_0x4ca2ec[_0x588b09(0x1b2)](_0x28b6d6)?a181_0x4ca2ec['readFileSync'](_0x28b6d6,'utf-8'):'',_0x56ecc7=a181_0x4ca2ec[_0x588b09(0x1b2)](_0x53ca2d)?a181_0x4ca2ec[_0x588b09(0x186)](_0x53ca2d,_0x588b09(0x129)):_0x2f82bd[_0x588b09(0x233)];_0x400687[_0x588b09(0x209)]({'name':_0x2f82bd[_0x588b09(0x12f)],'dir':_0x253f79,'yaml':_0x2f82bd,'systemPrompt':_0x4e2475,'starterMessage':_0x56ecc7});}}const _0x14fbc2=getKnowledgeBasesDir(_0x2f0c24);if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0x14fbc2)){const _0x192321=a181_0x4ca2ec['readdirSync'](_0x14fbc2);for(const _0x44ff3d of _0x192321){const _0x1fb532=a181_0xdd0961[_0x588b09(0x1e1)](_0x14fbc2,_0x44ff3d);if(_0x44ff3d[_0x588b09(0x202)](_0x588b09(0x1dc))){const _0x5bbb00=parseKnowledgeBaseYaml(a181_0x4ca2ec[_0x588b09(0x186)](_0x1fb532,_0x588b09(0x129)),_0x1fb532);_0x44986d['push']({'name':_0x5bbb00[_0x588b09(0x12f)],'path':_0x1fb532,'yaml':_0x5bbb00});}else{if(_0x44ff3d[_0x588b09(0x202)](_0x588b09(0x218))){const _0x272571=a181_0x4ca2ec[_0x588b09(0x186)](_0x1fb532,_0x588b09(0x129)),{name:_0x3ed1b8,text:_0x55ea38}=parseTextKnowledgeBaseMd(_0x272571,_0x44ff3d);_0x7d51eb['push']({'name':_0x3ed1b8,'path':_0x1fb532,'text':_0x55ea38});}}}}const _0xb3c8fc=getPromptsDir(_0x2f0c24);if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0xb3c8fc)){const _0x9c5039=a181_0x4ca2ec[_0x588b09(0x193)](_0xb3c8fc)[_0x588b09(0x1e9)](_0x154f98=>_0x154f98[_0x588b09(0x202)](_0x588b09(0x1dc)));for(const _0xb45d06 of _0x9c5039){const _0x2dead3=a181_0xdd0961[_0x588b09(0x1e1)](_0xb3c8fc,_0xb45d06),_0x58a883=parsePromptYaml(a181_0x4ca2ec['readFileSync'](_0x2dead3,'utf-8'),_0x2dead3);_0x5119ce[_0x588b09(0x209)]({'name':_0x58a883[_0x588b09(0x12f)],'path':_0x2dead3,'yaml':_0x58a883});}}const _0x5870f2=[],_0x4197a8=getIntegrationsDir(_0x2f0c24);if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0x4197a8)){const _0xc46be7=a181_0x4ca2ec[_0x588b09(0x193)](_0x4197a8)[_0x588b09(0x1e9)](_0x29d25a=>_0x29d25a['endsWith'](_0x588b09(0x1dc)));for(const _0x5f1a9a of _0xc46be7){const _0x268be9=a181_0xdd0961[_0x588b09(0x1e1)](_0x4197a8,_0x5f1a9a),_0x9399df=parseIntegrationYaml(a181_0x4ca2ec[_0x588b09(0x186)](_0x268be9,_0x588b09(0x129)),_0x268be9);if(!SAFE_INTEGRATION_TYPES[_0x588b09(0x1f2)](_0x9399df[_0x588b09(0x1b7)][_0x588b09(0x1ae)]())){this[_0x588b09(0x1ec)][_0x588b09(0x20d)](_0x588b09(0x1f0)+_0x9399df[_0x588b09(0x12f)]+'\x27\x20('+_0x9399df[_0x588b09(0x1b7)]+_0x588b09(0x163)+(_0x588b09(0x22e)+SAFE_INTEGRATION_TYPES[_0x588b09(0x1e1)](',\x20')+_0x588b09(0x14f))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x5870f2[_0x588b09(0x209)]({'name':_0x9399df[_0x588b09(0x12f)],'path':_0x268be9,'yaml':_0x9399df});}}const _0x1264fb=getExperimentalKnowledgeBasesDir(_0x2f0c24);if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0x1264fb)){const _0x17b814=a181_0x4ca2ec['readdirSync'](_0x1264fb,{'withFileTypes':!![]});for(const _0x43ade6 of _0x17b814){if(!_0x43ade6[_0x588b09(0x192)]())continue;const _0x5d675e=a181_0xdd0961['join'](_0x1264fb,_0x43ade6[_0x588b09(0x12f)]),_0x7dfed=a181_0xdd0961[_0x588b09(0x1e1)](_0x5d675e,_0x43ade6[_0x588b09(0x12f)]+_0x588b09(0x1dc)),_0xfa07dc=a181_0xdd0961['join'](_0x5d675e,_0x588b09(0x206));if(!a181_0x4ca2ec[_0x588b09(0x1b2)](_0x7dfed))continue;const _0x1b74f3=parseExperimentalKnowledgeBaseYaml(a181_0x4ca2ec[_0x588b09(0x186)](_0x7dfed,_0x588b09(0x129)),_0x7dfed),_0xf5a04e=[];if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0xfa07dc)){const _0x3999bc=a181_0x4ca2ec[_0x588b09(0x193)](_0xfa07dc,{'withFileTypes':!![]});for(const _0x552f49 of _0x3999bc){if(!_0x552f49[_0x588b09(0x192)]())continue;const _0x2663ea=a181_0xdd0961[_0x588b09(0x1e1)](_0xfa07dc,_0x552f49[_0x588b09(0x12f)]),_0x51ce79=a181_0xdd0961['join'](_0x2663ea,_0x588b09(0x15c)),_0x247ab8=a181_0xdd0961[_0x588b09(0x1e1)](_0x2663ea,'json_schema.json');a181_0x4ca2ec['existsSync'](_0x51ce79)&&a181_0x4ca2ec[_0x588b09(0x1b2)](_0x247ab8)&&_0xf5a04e[_0x588b09(0x209)]({'name':_0x552f49[_0x588b09(0x12f)],'code':a181_0x4ca2ec[_0x588b09(0x186)](_0x51ce79,_0x588b09(0x129)),'json_schema':a181_0x4ca2ec['readFileSync'](_0x247ab8,_0x588b09(0x129))});}}const _0x28b7b3={..._0x1b74f3,'variables':_0x1b74f3['variables']||[],'functions':_0xf5a04e};_0x2807d5[_0x588b09(0x209)]({'name':_0x1b74f3[_0x588b09(0x12f)],'dir':_0x5d675e,'def':_0x28b7b3});}}const _0x3f611e=getExperimentalArtifactsDir(_0x2f0c24);if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0x3f611e)){const _0x4d6e1c=a181_0x4ca2ec[_0x588b09(0x193)](_0x3f611e,{'withFileTypes':!![]});for(const _0x46f191 of _0x4d6e1c){if(!_0x46f191[_0x588b09(0x192)]())continue;const _0x4eb335=a181_0xdd0961[_0x588b09(0x1e1)](_0x3f611e,_0x46f191[_0x588b09(0x12f)]),_0x44baa1=a181_0xdd0961[_0x588b09(0x1e1)](_0x4eb335,_0x46f191['name']+'.yml'),_0x54a13e=a181_0xdd0961[_0x588b09(0x1e1)](_0x4eb335,'code.js'),_0x7bae6c=a181_0xdd0961[_0x588b09(0x1e1)](_0x4eb335,_0x588b09(0x12a));if(!a181_0x4ca2ec[_0x588b09(0x1b2)](_0x44baa1)||!a181_0x4ca2ec[_0x588b09(0x1b2)](_0x54a13e))continue;const _0x3c8536=parseExperimentalArtifactYaml(a181_0x4ca2ec[_0x588b09(0x186)](_0x44baa1,_0x588b09(0x129)),_0x44baa1),_0x3d324f=a181_0x4ca2ec['readFileSync'](_0x54a13e,_0x588b09(0x129)),_0x227569=[];if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0x7bae6c)){const _0x5c2191=a181_0x4ca2ec[_0x588b09(0x193)](_0x7bae6c);for(const _0x236599 of _0x5c2191){const _0x558205=a181_0xdd0961[_0x588b09(0x1e1)](_0x7bae6c,_0x236599);a181_0x4ca2ec[_0x588b09(0x135)](_0x558205)['isFile']()&&_0x227569[_0x588b09(0x209)]({'file_name':_0x236599,'text_content':a181_0x4ca2ec[_0x588b09(0x186)](_0x558205,_0x588b09(0x129))});}}const _0x4ca98d={..._0x3c8536,'code':_0x3d324f,'files':_0x227569};_0x4dc8c2[_0x588b09(0x209)]({'name':_0x3c8536[_0x588b09(0x12f)],'dir':_0x4eb335,'def':_0x4ca98d});}}const _0xa7906c=[],_0x2adda3=getFormInterfacesDir(_0x2f0c24);if(a181_0x4ca2ec[_0x588b09(0x1b2)](_0x2adda3)){const _0x16c57b=a181_0x4ca2ec['readdirSync'](_0x2adda3)[_0x588b09(0x1e9)](_0x3d32bb=>_0x3d32bb[_0x588b09(0x202)](_0x588b09(0x1dc)));for(const _0x4390d1 of _0x16c57b){const _0xa594f9=a181_0xdd0961[_0x588b09(0x1e1)](_0x2adda3,_0x4390d1),_0x22a238=parseFormInterfaceYaml(a181_0x4ca2ec[_0x588b09(0x186)](_0xa594f9,_0x588b09(0x129)),_0xa594f9);_0xa7906c[_0x588b09(0x209)]({'name':_0x22a238[_0x588b09(0x12f)],'path':_0xa594f9,'yaml':_0x22a238});}}const _0x2fa1ef=[],_0x1ca633=getChatInterfacesDir(_0x2f0c24);if(a181_0x4ca2ec['existsSync'](_0x1ca633)){const _0x3561c9=a181_0x4ca2ec[_0x588b09(0x193)](_0x1ca633)['filter'](_0x16d859=>_0x16d859[_0x588b09(0x202)](_0x588b09(0x1dc)));for(const _0x870b9c of _0x3561c9){const _0x2d8cde=a181_0xdd0961[_0x588b09(0x1e1)](_0x1ca633,_0x870b9c),_0x370793=parseChatInterfaceYaml(a181_0x4ca2ec[_0x588b09(0x186)](_0x2d8cde,_0x588b09(0x129)),_0x2d8cde);_0x2fa1ef['push']({'name':_0x370793[_0x588b09(0x12f)],'path':_0x2d8cde,'yaml':_0x370793});}}const _0x4136a7=await this['client'][_0x588b09(0x1d4)](_0x1c9a70),_0x139d5e=await this[_0x588b09(0x221)][_0x588b09(0x1f4)](_0x1c9a70),_0x15eaa8=await this[_0x588b09(0x221)]['listTextKnowledgeBases'](_0x1c9a70),_0x4c498d=await this[_0x588b09(0x221)][_0x588b09(0x1df)](_0x1c9a70),_0x2f63fd=await this['client'][_0x588b09(0x1c1)](_0x1c9a70),_0x4a95f6=await safeListOrEmpty(()=>this[_0x588b09(0x221)][_0x588b09(0x13a)](_0x1c9a70)),_0x1331d4=await safeListOrEmpty(()=>this[_0x588b09(0x221)][_0x588b09(0x157)](_0x1c9a70)),_0x5921ed=await safeListOrEmpty(()=>this[_0x588b09(0x221)][_0x588b09(0x198)](_0x1c9a70)),_0x3a2f2e=await safeListOrEmpty(()=>this[_0x588b09(0x221)][_0x588b09(0x19f)](_0x1c9a70)),_0x3922e8=await fetchAllToolTargetMaps((_0x2c9eba,_0x432afd)=>this[_0x588b09(0x221)][_0x588b09(0x172)](_0x2c9eba,_0x432afd),_0x1c9a70),_0x32770a=new Map(),_0x528aad=new Map(),_0x4467a7=new Map(),_0x145337=new Map(),_0x159c17=new Map(),_0x3111ab=new Map(),_0x5b03a9=new Map();for(const _0x3752f9 of _0x4136a7){_0x32770a[_0x588b09(0x1a2)](_0x3752f9['attributes'][_0x588b09(0x12f)],_0x3752f9);}for(const _0x13d53a of _0x139d5e){_0x528aad[_0x588b09(0x1a2)](_0x13d53a[_0x588b09(0x1c5)][_0x588b09(0x12f)],_0x13d53a);}for(const _0x4f4518 of _0x15eaa8){_0x4467a7['set'](_0x4f4518[_0x588b09(0x1c5)]['name'],_0x4f4518);}for(const _0x5a5b19 of _0x4c498d){_0x145337[_0x588b09(0x1a2)](_0x5a5b19[_0x588b09(0x1c5)]['name'],_0x5a5b19);}for(const _0x15c1a3 of _0x2f63fd){_0x159c17[_0x588b09(0x1a2)](_0x15c1a3['attributes'][_0x588b09(0x17a)][_0x588b09(0x1ae)](),_0x15c1a3);}for(const _0x3747c4 of _0x4a95f6){_0x3111ab['set'](_0x3747c4[_0x588b09(0x1c5)]['name'],_0x3747c4);}for(const _0x1f53a4 of _0x1331d4){_0x5b03a9[_0x588b09(0x1a2)](_0x1f53a4[_0x588b09(0x1c5)][_0x588b09(0x12f)],_0x1f53a4);}const _0x479892=new Map(),_0x5a4298=new Map();for(const _0x257b7b of _0x5921ed){_0x479892[_0x588b09(0x1a2)](_0x257b7b[_0x588b09(0x1c5)]['name'],_0x257b7b);}for(const _0x4fa365 of _0x3a2f2e){_0x5a4298[_0x588b09(0x1a2)](_0x4fa365[_0x588b09(0x1c5)][_0x588b09(0x12f)],_0x4fa365);}const _0x211fff=new Map(),_0x539abb=new Map();for(const _0x262965 of _0x4136a7){_0x211fff['set'](_0x262965[_0x588b09(0x1c5)]['name'],_0x262965['id']),_0x539abb[_0x588b09(0x1a2)](_0x262965['id'],_0x262965[_0x588b09(0x1c5)][_0x588b09(0x12f)]);}const _0xfe17e3=new Map(),_0x4177ee=new Map();for(const _0x436580 of _0x4c498d){_0xfe17e3[_0x588b09(0x1a2)](_0x436580[_0x588b09(0x1c5)][_0x588b09(0x12f)],_0x436580['id']),_0x4177ee[_0x588b09(0x1a2)](_0x436580['id'],_0x436580[_0x588b09(0x1c5)]['name']);}const _0x5494b5=_0x3922e8['nameToId'][_0x588b09(0x123)]||new Map(),_0x18c940=_0x3922e8['nameToId']['TextKnowledgeBase']||new Map(),_0x5a54d5=_0x3922e8[_0x588b09(0x165)][_0x588b09(0x1a4)]||new Map(),_0x4b657f=new Map(),_0x1c703e={'resolveToolTargetName':buildNameResolver({..._0x3922e8[_0x588b09(0x13f)],'Agent':_0x539abb}),'resolvePromptName':async _0x2f34e6=>_0x4177ee[_0x588b09(0x16f)](_0x2f34e6),'onWarning':_0x58ae34=>this[_0x588b09(0x1ec)][_0x588b09(0x20d)](_0x58ae34)};let _0x26de41=[];const _0x5e02d9={'projectId':_0x1c9a70,'resolveToolTargetId':buildIdResolver({..._0x3922e8['nameToId'],'Agent':_0x211fff}),'resolvePromptId':async _0x196716=>_0xfe17e3[_0x588b09(0x16f)](_0x196716),'onWarning':_0x384ac9=>{const _0x1c5f11=_0x588b09;this[_0x1c5f11(0x1ec)][_0x1c5f11(0x20d)](_0x384ac9),_0x26de41['push'](_0x384ac9);}},{resolved:_0x33fc4b,unresolved:_0x376a57}=resolveAgentDependencies(_0x400687,new Set(_0x32770a['keys']()));for(const {agent:_0x4c6726,missingDeps:_0x1b6547}of _0x376a57){_0x4e6bfa[_0x588b09(0x19c)]['push']({'agentName':_0x4c6726['yaml']['name'],'action':_0x588b09(0x1e4),'error':_0x588b09(0x1e3)+_0x1b6547[_0x588b09(0x1e1)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x19c)][_0x588b09(0x142)]++;}for(const _0x5c19f5 of _0x44986d){const _0x423767=_0x528aad[_0x588b09(0x16f)](_0x5c19f5[_0x588b09(0x1a0)][_0x588b09(0x12f)]),_0x2ce9ba=a181_0x4ca2ec['readFileSync'](_0x5c19f5[_0x588b09(0x13e)],_0x588b09(0x129));if(_0x423767){const _0x1f1af7=apiKnowledgeBaseToYaml(_0x423767),_0x46357a=toKnowledgeBaseYamlString(_0x1f1af7),_0x4533f1=generateDiff(_0x46357a,_0x2ce9ba),_0x20334a=hasChanges(_0x4533f1);_0x20334a?(_0x4e6bfa[_0x588b09(0x1be)][_0x588b09(0x209)]({'name':_0x5c19f5[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x423767['id'],'diff':formatDiffWithColors(_0x4533f1)}),_0x4e6bfa['counts'][_0x588b09(0x1be)][_0x588b09(0x176)]++):(_0x4e6bfa[_0x588b09(0x1be)][_0x588b09(0x209)]({'name':_0x5c19f5[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x19b),'id':_0x423767['id']}),_0x4e6bfa[_0x588b09(0x211)]['knowledgeBases']['unchanged']++);}else _0x4e6bfa[_0x588b09(0x1be)][_0x588b09(0x209)]({'name':_0x5c19f5[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x168)}),_0x4e6bfa[_0x588b09(0x211)]['knowledgeBases'][_0x588b09(0x168)]++;}for(const _0x43cdfc of _0x7d51eb){const _0x2d9e5f=_0x4467a7[_0x588b09(0x16f)](_0x43cdfc[_0x588b09(0x12f)]),_0x190081=a181_0x4ca2ec[_0x588b09(0x186)](_0x43cdfc[_0x588b09(0x13e)],_0x588b09(0x129));if(_0x2d9e5f){const _0x3fc942=toTextKnowledgeBaseMd(_0x2d9e5f['attributes'][_0x588b09(0x12f)],_0x2d9e5f['attributes'][_0x588b09(0x121)]),_0xc37dd7=generateDiff(_0x3fc942,_0x190081),_0x436b75=hasChanges(_0xc37dd7);_0x436b75?(_0x4e6bfa[_0x588b09(0x1cd)][_0x588b09(0x209)]({'name':_0x43cdfc['name'],'action':'updated','id':_0x2d9e5f['id'],'diff':formatDiffWithColors(_0xc37dd7)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1cd)][_0x588b09(0x176)]++):(_0x4e6bfa[_0x588b09(0x1cd)][_0x588b09(0x209)]({'name':_0x43cdfc[_0x588b09(0x12f)],'action':'unchanged','id':_0x2d9e5f['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1cd)][_0x588b09(0x19b)]++);}else _0x4e6bfa[_0x588b09(0x1cd)][_0x588b09(0x209)]({'name':_0x43cdfc[_0x588b09(0x12f)],'action':'created'}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1cd)][_0x588b09(0x168)]++;}for(const _0x346e86 of _0x33fc4b){const _0x18dea3=_0x32770a['get'](_0x346e86[_0x588b09(0x1a0)][_0x588b09(0x12f)]),_0x31fd07=a181_0xdd0961['join'](_0x346e86[_0x588b09(0x171)],_0x588b09(0x118)),_0x2b0863=a181_0x4ca2ec[_0x588b09(0x186)](_0x31fd07,'utf-8'),_0x593e4b=_0x346e86[_0x588b09(0x1b0)],_0x4399ee=_0x588b09(0x151)+_0x593e4b+'\x0a\x0a#\x20agent.yml\x0a'+_0x2b0863;if(_0x18dea3){const {yaml:_0x513eda,systemPrompt:_0x2b7734}=await agentResponseToDef(_0x18dea3,_0x1c703e),_0x126c8c=toAgentYamlString(_0x513eda),_0x1e8dd4=_0x588b09(0x151)+_0x2b7734+_0x588b09(0x1a9)+_0x126c8c,_0x2ba87c=generateDiff(_0x1e8dd4,_0x4399ee),_0x463966=hasChanges(_0x2ba87c);_0x463966?(_0x4e6bfa['agents'][_0x588b09(0x209)]({'agentName':_0x346e86[_0x588b09(0x1a0)]['name'],'action':'updated','agentId':_0x18dea3['id'],'diff':formatDiffWithColors(_0x2ba87c)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x19c)]['updated']++):(_0x4e6bfa[_0x588b09(0x19c)]['push']({'agentName':_0x346e86['yaml'][_0x588b09(0x12f)],'action':_0x588b09(0x19b),'agentId':_0x18dea3['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x19c)][_0x588b09(0x19b)]++);}else _0x4e6bfa[_0x588b09(0x19c)][_0x588b09(0x209)]({'agentName':_0x346e86[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x168)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x19c)]['created']++;}for(const _0x23098a of _0x5119ce){const _0x1c923c=_0x145337[_0x588b09(0x16f)](_0x23098a['yaml']['name']),_0x56cf1a=a181_0x4ca2ec[_0x588b09(0x186)](_0x23098a[_0x588b09(0x13e)],'utf-8');if(_0x1c923c){const _0xbe2b4a=await apiPromptToYaml(_0x1c923c,_0x1c703e);if(!_0xbe2b4a){_0x4e6bfa[_0x588b09(0x15d)]['push']({'name':_0x23098a[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x1c923c['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x15d)][_0x588b09(0x176)]++;continue;}const _0x255997=toPromptYamlString(_0xbe2b4a),_0x9ffb6=generateDiff(_0x255997,_0x56cf1a),_0x6f273f=hasChanges(_0x9ffb6);_0x6f273f?(_0x4e6bfa[_0x588b09(0x15d)][_0x588b09(0x209)]({'name':_0x23098a[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':'updated','id':_0x1c923c['id'],'diff':formatDiffWithColors(_0x9ffb6)}),_0x4e6bfa[_0x588b09(0x211)]['prompts'][_0x588b09(0x176)]++):(_0x4e6bfa['prompts']['push']({'name':_0x23098a['yaml'][_0x588b09(0x12f)],'action':_0x588b09(0x19b),'id':_0x1c923c['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x15d)][_0x588b09(0x19b)]++);}else _0x4e6bfa[_0x588b09(0x15d)][_0x588b09(0x209)]({'name':_0x23098a['yaml'][_0x588b09(0x12f)],'action':_0x588b09(0x168)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x15d)][_0x588b09(0x168)]++;}for(const _0x359e2d of _0x5870f2){const _0x5e3c8b=_0x159c17[_0x588b09(0x16f)](_0x359e2d['yaml']['service_type']),_0x247124=a181_0x4ca2ec[_0x588b09(0x186)](_0x359e2d[_0x588b09(0x13e)],_0x588b09(0x129));if(_0x5e3c8b){const _0x2b0206=await apiIntegrationToYaml(_0x5e3c8b,_0x1c703e),_0x386d46=toIntegrationYamlString(_0x2b0206),_0x9e1819=generateDiff(_0x386d46,_0x247124),_0x24f776=hasChanges(_0x9e1819);_0x24f776?(_0x4e6bfa[_0x588b09(0x14b)][_0x588b09(0x209)]({'name':_0x359e2d[_0x588b09(0x1a0)][_0x588b09(0x1b7)],'action':_0x588b09(0x176),'id':_0x5e3c8b['id'],'diff':formatDiffWithColors(_0x9e1819)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x14b)]['updated']++):(_0x4e6bfa[_0x588b09(0x14b)][_0x588b09(0x209)]({'name':_0x359e2d[_0x588b09(0x1a0)]['service_type'],'action':'unchanged','id':_0x5e3c8b['id']}),_0x4e6bfa['counts'][_0x588b09(0x14b)][_0x588b09(0x19b)]++);}else _0x4e6bfa[_0x588b09(0x14b)]['push']({'name':_0x359e2d[_0x588b09(0x1a0)]['service_type'],'action':'created'}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x14b)][_0x588b09(0x168)]++;}for(const _0x253057 of _0x2807d5){const _0x300a6f=_0x3111ab[_0x588b09(0x16f)](_0x253057[_0x588b09(0x182)][_0x588b09(0x12f)]),_0x3c189a=toExperimentalKnowledgeBaseYamlString(_0x253057[_0x588b09(0x182)]);let _0x3968cf=_0x3c189a;for(const _0x4400fb of _0x253057['def'][_0x588b09(0x206)]){_0x3968cf+=_0x588b09(0x225)+_0x4400fb['name']+_0x588b09(0x1f3)+_0x4400fb[_0x588b09(0x17f)]+_0x588b09(0x1fc)+_0x4400fb['name']+'\x20---\x0a'+_0x4400fb[_0x588b09(0x232)]+'\x0a';}if(_0x300a6f){const _0x3d1f1b=apiExperimentalKnowledgeBaseToYaml(_0x300a6f),_0x28ef4a=toExperimentalKnowledgeBaseYamlString(_0x3d1f1b);let _0x2922af=_0x28ef4a;for(const _0x55879e of _0x3d1f1b[_0x588b09(0x206)]){_0x2922af+='\x0a---\x20function:\x20'+_0x55879e[_0x588b09(0x12f)]+'\x20---\x0a'+_0x55879e[_0x588b09(0x17f)]+_0x588b09(0x1fc)+_0x55879e[_0x588b09(0x12f)]+_0x588b09(0x1f3)+_0x55879e[_0x588b09(0x232)]+'\x0a';}const _0xa2454e=generateDiff(_0x2922af,_0x3968cf),_0x49b32a=hasChanges(_0xa2454e);_0x49b32a?(_0x4e6bfa[_0x588b09(0x21e)][_0x588b09(0x209)]({'name':_0x253057[_0x588b09(0x182)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x300a6f['id'],'diff':formatDiffWithColors(_0xa2454e)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x21e)][_0x588b09(0x176)]++):(_0x4e6bfa[_0x588b09(0x21e)]['push']({'name':_0x253057[_0x588b09(0x182)][_0x588b09(0x12f)],'action':'unchanged','id':_0x300a6f['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x21e)]['unchanged']++);}else _0x4e6bfa[_0x588b09(0x21e)]['push']({'name':_0x253057['def'][_0x588b09(0x12f)],'action':_0x588b09(0x168)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x21e)][_0x588b09(0x168)]++;}for(const _0x3e266c of _0x4dc8c2){const _0x3a79b5=_0x5b03a9[_0x588b09(0x16f)](_0x3e266c['def'][_0x588b09(0x12f)]),_0x569410=toExperimentalArtifactYamlString(_0x3e266c[_0x588b09(0x182)]);let _0x59cafd=_0x569410+('\x0a---\x20code\x20---\x0a'+_0x3e266c['def'][_0x588b09(0x17f)]+'\x0a');for(const _0x4f64be of _0x3e266c[_0x588b09(0x182)][_0x588b09(0x12a)]){_0x59cafd+=_0x588b09(0x181)+_0x4f64be['file_name']+'\x20---\x0a'+_0x4f64be[_0x588b09(0x1c0)]+'\x0a';}if(_0x3a79b5){const _0xdf757e=apiExperimentalArtifactToYaml(_0x3a79b5),_0x4a5d49=toExperimentalArtifactYamlString(_0xdf757e);let _0x107a88=_0x4a5d49+('\x0a---\x20code\x20---\x0a'+_0xdf757e['code']+'\x0a');for(const _0x154aca of _0xdf757e[_0x588b09(0x12a)]){_0x107a88+=_0x588b09(0x181)+_0x154aca[_0x588b09(0x199)]+'\x20---\x0a'+_0x154aca[_0x588b09(0x1c0)]+'\x0a';}const _0x4a8618=generateDiff(_0x107a88,_0x59cafd),_0x48f06f=hasChanges(_0x4a8618);_0x48f06f?(_0x4e6bfa[_0x588b09(0x1b5)][_0x588b09(0x209)]({'name':_0x3e266c['def'][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x3a79b5['id'],'diff':formatDiffWithColors(_0x4a8618)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1b5)][_0x588b09(0x176)]++):(_0x4e6bfa[_0x588b09(0x1b5)][_0x588b09(0x209)]({'name':_0x3e266c[_0x588b09(0x182)]['name'],'action':'unchanged','id':_0x3a79b5['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1b5)][_0x588b09(0x19b)]++);}else _0x4e6bfa[_0x588b09(0x1b5)][_0x588b09(0x209)]({'name':_0x3e266c[_0x588b09(0x182)][_0x588b09(0x12f)],'action':_0x588b09(0x168)}),_0x4e6bfa['counts'][_0x588b09(0x1b5)]['created']++;}for(const _0x1597c4 of _0xa7906c){const _0x459099=_0x479892[_0x588b09(0x16f)](_0x1597c4[_0x588b09(0x1a0)][_0x588b09(0x12f)]),_0xfc2235=a181_0x4ca2ec['readFileSync'](_0x1597c4[_0x588b09(0x13e)],_0x588b09(0x129));if(_0x459099){const _0x3aa318=await apiFormInterfaceToYaml(_0x459099,_0x1c703e),_0x11feaf=toFormInterfaceYamlString(_0x3aa318),_0x3a8b2e=generateDiff(_0x11feaf,_0xfc2235),_0x418beb=hasChanges(_0x3a8b2e);_0x418beb?(_0x4e6bfa[_0x588b09(0x1d9)][_0x588b09(0x209)]({'name':_0x1597c4[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x459099['id'],'diff':formatDiffWithColors(_0x3a8b2e)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1d9)][_0x588b09(0x176)]++):(_0x4e6bfa[_0x588b09(0x1d9)]['push']({'name':_0x1597c4[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':'unchanged','id':_0x459099['id']}),_0x4e6bfa['counts'][_0x588b09(0x1d9)]['unchanged']++);}else _0x4e6bfa[_0x588b09(0x1d9)][_0x588b09(0x209)]({'name':_0x1597c4[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x168)}),_0x4e6bfa[_0x588b09(0x211)]['formInterfaces'][_0x588b09(0x168)]++;}for(const _0x26593a of _0x2fa1ef){const _0x245d56=_0x5a4298[_0x588b09(0x16f)](_0x26593a[_0x588b09(0x1a0)][_0x588b09(0x12f)]),_0x44f6cc=a181_0x4ca2ec[_0x588b09(0x186)](_0x26593a['path'],_0x588b09(0x129));if(_0x245d56){const _0x1fdb29=await apiChatInterfaceToYaml(_0x245d56,_0x1c703e),_0x5e5a6e=toChatInterfaceYamlString(_0x1fdb29),_0xd7201c=generateDiff(_0x5e5a6e,_0x44f6cc),_0x211fc1=hasChanges(_0xd7201c);_0x211fc1?(_0x4e6bfa['chatInterfaces'][_0x588b09(0x209)]({'name':_0x26593a[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x245d56['id'],'diff':formatDiffWithColors(_0xd7201c)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x14a)][_0x588b09(0x176)]++):(_0x4e6bfa[_0x588b09(0x14a)]['push']({'name':_0x26593a['yaml'][_0x588b09(0x12f)],'action':'unchanged','id':_0x245d56['id']}),_0x4e6bfa['counts'][_0x588b09(0x14a)][_0x588b09(0x19b)]++);}else _0x4e6bfa['chatInterfaces'][_0x588b09(0x209)]({'name':_0x26593a[_0x588b09(0x1a0)]['name'],'action':'created'}),_0x4e6bfa['counts'][_0x588b09(0x14a)][_0x588b09(0x168)]++;}if(_0x44dc9e?.['dryRun'])return _0x4e6bfa;_0x4e6bfa['knowledgeBases']=[],_0x4e6bfa[_0x588b09(0x1cd)]=[],_0x4e6bfa[_0x588b09(0x15d)]=[],_0x4e6bfa[_0x588b09(0x14b)]=[],_0x4e6bfa[_0x588b09(0x21e)]=[],_0x4e6bfa['experimentalArtifacts']=[],_0x4e6bfa[_0x588b09(0x1d9)]=[],_0x4e6bfa[_0x588b09(0x14a)]=[];const _0x4c25ce=_0x4e6bfa[_0x588b09(0x19c)]['filter'](_0x5f1b0f=>_0x5f1b0f[_0x588b09(0x11a)]==='error');_0x4e6bfa['agents']=_0x4c25ce,_0x4e6bfa[_0x588b09(0x211)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x4c25ce[_0x588b09(0x1d1)]},'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 _0x3c6d3a of _0x44986d){try{const _0x25dd84=_0x528aad['get'](_0x3c6d3a[_0x588b09(0x1a0)][_0x588b09(0x12f)]),_0x4333cc=yamlKnowledgeBaseToApi(_0x3c6d3a[_0x588b09(0x1a0)],_0x1c9a70);if(_0x25dd84)await this['client'][_0x588b09(0x1da)](_0x25dd84['id'],_0x4333cc),_0x5494b5[_0x588b09(0x1a2)](_0x3c6d3a[_0x588b09(0x1a0)][_0x588b09(0x12f)],_0x25dd84['id']),_0x4e6bfa['knowledgeBases']['push']({'name':_0x3c6d3a[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x25dd84['id']}),_0x4e6bfa['counts']['knowledgeBases']['updated']++;else{const _0x47e2dc=await this['client'][_0x588b09(0x207)](_0x4333cc);_0x5494b5[_0x588b09(0x1a2)](_0x3c6d3a['yaml'][_0x588b09(0x12f)],_0x47e2dc['id']),_0x4e6bfa[_0x588b09(0x1be)][_0x588b09(0x209)]({'name':_0x3c6d3a[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':'created','id':_0x47e2dc['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1be)][_0x588b09(0x168)]++;}}catch(_0x318be2){_0x4e6bfa[_0x588b09(0x1be)][_0x588b09(0x209)]({'name':_0x3c6d3a[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x1e4),'error':_0x318be2[_0x588b09(0x12e)]}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1be)][_0x588b09(0x142)]++;}}for(const _0x3971f5 of _0x7d51eb){try{const _0x4c0480=_0x4467a7['get'](_0x3971f5['name']),_0x23cfd8=yamlTextKnowledgeBaseToApi({'name':_0x3971f5['name'],'text':_0x3971f5[_0x588b09(0x121)]},_0x1c9a70);if(_0x4c0480)await this[_0x588b09(0x221)][_0x588b09(0x117)](_0x4c0480['id'],_0x23cfd8),_0x18c940[_0x588b09(0x1a2)](_0x3971f5[_0x588b09(0x12f)],_0x4c0480['id']),_0x4e6bfa['textKnowledgeBases'][_0x588b09(0x209)]({'name':_0x3971f5['name'],'action':_0x588b09(0x176),'id':_0x4c0480['id']}),_0x4e6bfa[_0x588b09(0x211)]['textKnowledgeBases'][_0x588b09(0x176)]++;else{const _0x5b61e9=await this[_0x588b09(0x221)][_0x588b09(0x148)](_0x23cfd8);_0x18c940['set'](_0x3971f5[_0x588b09(0x12f)],_0x5b61e9['id']),_0x4e6bfa['textKnowledgeBases'][_0x588b09(0x209)]({'name':_0x3971f5[_0x588b09(0x12f)],'action':'created','id':_0x5b61e9['id']}),_0x4e6bfa[_0x588b09(0x211)]['textKnowledgeBases'][_0x588b09(0x168)]++;}}catch(_0x3aac36){_0x4e6bfa['textKnowledgeBases'][_0x588b09(0x209)]({'name':_0x3971f5['name'],'action':_0x588b09(0x1e4),'error':_0x3aac36['message']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1cd)][_0x588b09(0x142)]++;}}for(const _0x576912 of _0x2807d5){try{const _0xfa8b34=_0x3111ab[_0x588b09(0x16f)](_0x576912[_0x588b09(0x182)][_0x588b09(0x12f)]),_0x17a168=yamlExperimentalKnowledgeBaseToApi(_0x576912[_0x588b09(0x182)],_0x1c9a70);if(_0xfa8b34)await this[_0x588b09(0x221)][_0x588b09(0x215)](_0xfa8b34['id'],_0x17a168),_0x5a54d5[_0x588b09(0x1a2)](_0x576912[_0x588b09(0x182)][_0x588b09(0x12f)],_0xfa8b34['id']),_0x4e6bfa[_0x588b09(0x21e)][_0x588b09(0x209)]({'name':_0x576912[_0x588b09(0x182)][_0x588b09(0x12f)],'action':'updated','id':_0xfa8b34['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x21e)][_0x588b09(0x176)]++;else{const _0x39800d=await this['client'][_0x588b09(0x152)](_0x17a168);_0x5a54d5[_0x588b09(0x1a2)](_0x576912[_0x588b09(0x182)][_0x588b09(0x12f)],_0x39800d['id']),_0x4e6bfa[_0x588b09(0x21e)][_0x588b09(0x209)]({'name':_0x576912[_0x588b09(0x182)]['name'],'action':_0x588b09(0x168),'id':_0x39800d['id']}),_0x4e6bfa[_0x588b09(0x211)]['experimentalKnowledgeBases']['created']++;}}catch(_0x4198c2){_0x4e6bfa[_0x588b09(0x21e)][_0x588b09(0x209)]({'name':_0x576912[_0x588b09(0x182)]['name'],'action':'error','error':_0x4198c2['message']}),_0x4e6bfa['counts']['experimentalKnowledgeBases'][_0x588b09(0x142)]++;}}for(const _0x41e93c of _0x4dc8c2){try{const _0x5c36d7=_0x5b03a9['get'](_0x41e93c[_0x588b09(0x182)][_0x588b09(0x12f)]),_0x2192c6=yamlExperimentalArtifactToApi(_0x41e93c['def'],_0x1c9a70);if(_0x5c36d7)await this[_0x588b09(0x221)][_0x588b09(0x183)](_0x5c36d7['id'],_0x2192c6),_0x4b657f[_0x588b09(0x1a2)](_0x41e93c['def'][_0x588b09(0x12f)],_0x5c36d7['id']),_0x4e6bfa['experimentalArtifacts'][_0x588b09(0x209)]({'name':_0x41e93c[_0x588b09(0x182)]['name'],'action':_0x588b09(0x176),'id':_0x5c36d7['id']}),_0x4e6bfa[_0x588b09(0x211)]['experimentalArtifacts'][_0x588b09(0x176)]++;else{const _0x2d915a=await this[_0x588b09(0x221)][_0x588b09(0x1d6)](_0x2192c6);_0x4b657f[_0x588b09(0x1a2)](_0x41e93c['def']['name'],_0x2d915a['id']),_0x4e6bfa['experimentalArtifacts']['push']({'name':_0x41e93c[_0x588b09(0x182)][_0x588b09(0x12f)],'action':_0x588b09(0x168),'id':_0x2d915a['id']}),_0x4e6bfa['counts'][_0x588b09(0x1b5)]['created']++;}}catch(_0x46f790){_0x4e6bfa[_0x588b09(0x1b5)][_0x588b09(0x209)]({'name':_0x41e93c[_0x588b09(0x182)][_0x588b09(0x12f)],'action':_0x588b09(0x1e4),'error':_0x46f790[_0x588b09(0x12e)]}),_0x4e6bfa['counts'][_0x588b09(0x1b5)]['errors']++;}}for(const _0x260a07 of _0x33fc4b){_0x26de41=[];try{const _0x2ca455=_0x32770a['get'](_0x260a07[_0x588b09(0x1a0)][_0x588b09(0x12f)]),_0x1279d3=await agentDefToRequest(_0x260a07[_0x588b09(0x1a0)],_0x260a07[_0x588b09(0x1b0)],_0x260a07[_0x588b09(0x224)],_0x5e02d9);if(_0x2ca455)await this['client'][_0x588b09(0x1f9)](_0x2ca455['id'],_0x1279d3),_0x211fff[_0x588b09(0x1a2)](_0x260a07[_0x588b09(0x1a0)][_0x588b09(0x12f)],_0x2ca455['id']),_0x4e6bfa[_0x588b09(0x19c)][_0x588b09(0x209)]({'agentName':_0x260a07[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'agentId':_0x2ca455['id'],'warnings':_0x26de41['length']>0x0?_0x26de41:undefined}),_0x4e6bfa[_0x588b09(0x211)]['agents'][_0x588b09(0x176)]++;else{const _0x432b24=await this[_0x588b09(0x221)]['createAgentResponse'](_0x1279d3);_0x211fff[_0x588b09(0x1a2)](_0x260a07[_0x588b09(0x1a0)][_0x588b09(0x12f)],_0x432b24['id']),_0x4e6bfa['agents']['push']({'agentName':_0x260a07['yaml'][_0x588b09(0x12f)],'action':_0x588b09(0x168),'agentId':_0x432b24['id'],'warnings':_0x26de41['length']>0x0?_0x26de41:undefined}),_0x4e6bfa['counts'][_0x588b09(0x19c)][_0x588b09(0x168)]++;}}catch(_0x4c0106){_0x4e6bfa[_0x588b09(0x19c)][_0x588b09(0x209)]({'agentName':_0x260a07[_0x588b09(0x1a0)]['name'],'action':_0x588b09(0x1e4),'error':_0x4c0106[_0x588b09(0x12e)],'warnings':_0x26de41['length']>0x0?_0x26de41:undefined}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x19c)][_0x588b09(0x142)]++;}}for(const _0x201673 of _0x5119ce){try{const _0x38510a=_0x145337[_0x588b09(0x16f)](_0x201673['yaml']['name']),_0x26f118=await yamlPromptToApi(_0x201673[_0x588b09(0x1a0)],_0x1c9a70,_0x5e02d9);if(!_0x26f118){_0x4e6bfa[_0x588b09(0x15d)][_0x588b09(0x209)]({'name':_0x201673[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x1e4),'error':_0x588b09(0x1cb)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x15d)][_0x588b09(0x142)]++;continue;}if(_0x38510a)await this['client'][_0x588b09(0x213)](_0x38510a['id'],_0x26f118),_0xfe17e3[_0x588b09(0x1a2)](_0x201673[_0x588b09(0x1a0)][_0x588b09(0x12f)],_0x38510a['id']),_0x4e6bfa[_0x588b09(0x15d)][_0x588b09(0x209)]({'name':_0x201673[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x38510a['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x15d)][_0x588b09(0x176)]++;else{const _0x74daa7=await this['client'][_0x588b09(0x217)](_0x26f118);_0xfe17e3[_0x588b09(0x1a2)](_0x201673['yaml'][_0x588b09(0x12f)],_0x74daa7['id']),_0x4e6bfa['prompts'][_0x588b09(0x209)]({'name':_0x201673[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x168),'id':_0x74daa7['id']}),_0x4e6bfa['counts'][_0x588b09(0x15d)][_0x588b09(0x168)]++;}}catch(_0x9bc9){_0x4e6bfa[_0x588b09(0x15d)][_0x588b09(0x209)]({'name':_0x201673[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x1e4),'error':_0x9bc9[_0x588b09(0x12e)]}),_0x4e6bfa['counts']['prompts'][_0x588b09(0x142)]++;}}for(const _0x12d66f of _0x5870f2){try{const _0x6077ba=_0x159c17[_0x588b09(0x16f)](_0x12d66f['yaml'][_0x588b09(0x1b7)]),_0x2f3801=await yamlIntegrationToApi(_0x12d66f[_0x588b09(0x1a0)],_0x1c9a70,_0x5e02d9);if(_0x6077ba){await this['client'][_0x588b09(0x21f)](_0x6077ba['id']);const _0x1779b5=await this[_0x588b09(0x221)]['createIntegration'](_0x2f3801);_0x4e6bfa[_0x588b09(0x14b)][_0x588b09(0x209)]({'name':_0x12d66f[_0x588b09(0x1a0)][_0x588b09(0x1b7)],'action':_0x588b09(0x176),'id':_0x1779b5['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x14b)][_0x588b09(0x176)]++;}else{const _0x1e206c=await this[_0x588b09(0x221)]['createIntegration'](_0x2f3801);_0x4e6bfa[_0x588b09(0x14b)]['push']({'name':_0x12d66f[_0x588b09(0x1a0)]['service_type'],'action':_0x588b09(0x168),'id':_0x1e206c['id']}),_0x4e6bfa[_0x588b09(0x211)]['integrations'][_0x588b09(0x168)]++;}}catch(_0x4f023b){_0x4e6bfa['integrations'][_0x588b09(0x209)]({'name':_0x12d66f['yaml'][_0x588b09(0x1b7)],'action':_0x588b09(0x1e4),'error':_0x4f023b[_0x588b09(0x12e)]}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x14b)][_0x588b09(0x142)]++;}}for(const _0x1a0810 of _0xa7906c){try{const _0xd54f53=_0x479892['get'](_0x1a0810['yaml']['name']),_0x10b480=await yamlFormInterfaceToApi(_0x1a0810['yaml'],_0x1c9a70,_0x5e02d9);if(!_0x10b480){_0x4e6bfa[_0x588b09(0x1d9)][_0x588b09(0x209)]({'name':_0x1a0810[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x1e4),'error':_0x588b09(0x236)}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1d9)][_0x588b09(0x142)]++;continue;}if(_0xd54f53){const _0x4f69f6=await this[_0x588b09(0x221)][_0x588b09(0x1fb)](_0xd54f53['id'],_0x10b480);_0x4e6bfa[_0x588b09(0x1d9)][_0x588b09(0x209)]({'name':_0x1a0810[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0x4f69f6['id']}),_0x4e6bfa['counts'][_0x588b09(0x1d9)][_0x588b09(0x176)]++;}else{const _0x2155a1=await this['client'][_0x588b09(0x1ce)](_0x10b480);_0x4e6bfa[_0x588b09(0x1d9)][_0x588b09(0x209)]({'name':_0x1a0810[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x168),'id':_0x2155a1['id']}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1d9)]['created']++;}}catch(_0x13f10d){_0x4e6bfa[_0x588b09(0x1d9)][_0x588b09(0x209)]({'name':_0x1a0810[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':'error','error':_0x13f10d[_0x588b09(0x12e)]}),_0x4e6bfa[_0x588b09(0x211)][_0x588b09(0x1d9)][_0x588b09(0x142)]++;}}for(const _0x5c1d57 of _0x2fa1ef){try{const _0x3d3b4f=_0x5a4298[_0x588b09(0x16f)](_0x5c1d57[_0x588b09(0x1a0)][_0x588b09(0x12f)]),_0x351ee9=await yamlChatInterfaceToApi(_0x5c1d57['yaml'],_0x1c9a70,_0x5e02d9);if(_0x3d3b4f){const _0xed71d=await this[_0x588b09(0x221)][_0x588b09(0x185)](_0x3d3b4f['id'],_0x351ee9);_0x4e6bfa[_0x588b09(0x14a)][_0x588b09(0x209)]({'name':_0x5c1d57[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x176),'id':_0xed71d['id']}),_0x4e6bfa[_0x588b09(0x211)]['chatInterfaces'][_0x588b09(0x176)]++;}else{const _0x565ab9=await this[_0x588b09(0x221)][_0x588b09(0x1ca)](_0x351ee9);_0x4e6bfa[_0x588b09(0x14a)][_0x588b09(0x209)]({'name':_0x5c1d57[_0x588b09(0x1a0)][_0x588b09(0x12f)],'action':_0x588b09(0x168),'id':_0x565ab9['id']}),_0x4e6bfa['counts']['chatInterfaces'][_0x588b09(0x168)]++;}}catch(_0x2ad175){_0x4e6bfa['chatInterfaces'][_0x588b09(0x209)]({'name':_0x5c1d57['yaml'][_0x588b09(0x12f)],'action':_0x588b09(0x1e4),'error':_0x2ad175['message']}),_0x4e6bfa['counts'][_0x588b09(0x14a)][_0x588b09(0x142)]++;}}return _0x4e6bfa;}async[a181_0x20204d(0x167)](_0x5935f8,_0x282f75,_0x11ba7e,_0x530c0f){const _0x5dce05=a181_0x20204d,{projectId:_0x5ae3e7,project:_0x4bcc7f}=await this[_0x5dce05(0x208)](_0x5935f8),_0x44558a=_0x4bcc7f['attributes'][_0x5dce05(0x12f)],_0x49fe83=await this['client']['listAgentsFull'](_0x5ae3e7),_0x24fed8=_0x49fe83['find'](_0x4d78ae=>_0x4d78ae[_0x5dce05(0x1c5)][_0x5dce05(0x12f)]===_0x282f75);if(!_0x24fed8)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x5dce05(0x1bb)+_0x282f75,undefined,{'helpText':_0x5dce05(0x17b)+_0x49fe83[_0x5dce05(0x21d)](_0x7064e5=>_0x7064e5['attributes']['name'])[_0x5dce05(0x1e1)](',\x20')});let _0x1454ba;if(_0x11ba7e)_0x1454ba=_0x11ba7e;else{const _0x588efa=a181_0xdd0961[_0x5dce05(0x1e1)](process[_0x5dce05(0x1c3)](),'agents'),_0xc5675c=getSanitizedPathWithMigration(_0x588efa,_0x44558a);_0xc5675c[_0x5dce05(0x15a)]&&this[_0x5dce05(0x1ec)][_0x5dce05(0x15e)]('Renamed\x20folder:\x20'+a181_0xdd0961['basename'](_0xc5675c[_0x5dce05(0x212)])+'\x20→\x20'+a181_0xdd0961[_0x5dce05(0x1ff)](_0xc5675c[_0x5dce05(0x13e)])),_0x1454ba=_0xc5675c[_0x5dce05(0x13e)];}const _0x206769=getSanitizedPathWithMigration(_0x1454ba,_0x282f75);_0x206769[_0x5dce05(0x15a)]&&this[_0x5dce05(0x1ec)]['info'](_0x5dce05(0x120)+a181_0xdd0961[_0x5dce05(0x1ff)](_0x206769[_0x5dce05(0x212)])+_0x5dce05(0x164)+a181_0xdd0961[_0x5dce05(0x1ff)](_0x206769[_0x5dce05(0x13e)]));const _0x35d914=_0x206769[_0x5dce05(0x13e)],_0x372cd0=new Map(),_0x1c39b8=new Map(),_0x181bf1=await this[_0x5dce05(0x221)][_0x5dce05(0x1f4)](_0x5ae3e7),_0x4677cb=await this[_0x5dce05(0x221)]['listTextKnowledgeBases'](_0x5ae3e7),_0xc769ae=await safeListOrEmpty(()=>this[_0x5dce05(0x221)][_0x5dce05(0x13a)](_0x5ae3e7)),_0x5c14eb=new Map(),_0x32f3e2=new Map();for(const _0x16b9ea of _0x181bf1){_0x372cd0['set'](_0x16b9ea['id'],_0x16b9ea[_0x5dce05(0x1c5)][_0x5dce05(0x12f)]);}for(const _0x266afd of _0x4677cb){_0x5c14eb[_0x5dce05(0x1a2)](_0x266afd['id'],_0x266afd['attributes'][_0x5dce05(0x12f)]);}for(const _0x3f1ff7 of _0xc769ae){_0x32f3e2[_0x5dce05(0x1a2)](_0x3f1ff7['id'],_0x3f1ff7[_0x5dce05(0x1c5)][_0x5dce05(0x12f)]);}for(const _0x4e528d of _0x49fe83){_0x1c39b8['set'](_0x4e528d['id'],_0x4e528d[_0x5dce05(0x1c5)]['name']);}const _0x1a5c93={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x372cd0,'TextKnowledgeBase':_0x5c14eb,'Agent':_0x1c39b8,'ExperimentalKnowledgeBase':_0x32f3e2}),'resolvePromptName':async()=>undefined,'onWarning':_0x21e452=>this['logger'][_0x5dce05(0x20d)](_0x21e452)},_0x871c60=a181_0xdd0961['join'](_0x35d914,_0x5dce05(0x1e5)),_0x4a63e2=a181_0xdd0961[_0x5dce05(0x1e1)](_0x35d914,_0x5dce05(0x118)),_0x39be47=a181_0xdd0961[_0x5dce05(0x1e1)](_0x35d914,'starter_message.md'),_0x13c67e=!a181_0x4ca2ec[_0x5dce05(0x1b2)](_0x4a63e2);if(_0x530c0f?.['dryRun'])return{'agentName':_0x282f75,'outputPath':_0x35d914,'isNew':_0x13c67e,'hasChanges':!![]};a181_0x4ca2ec[_0x5dce05(0x222)](_0x1454ba,{'recursive':!![]}),a181_0x4ca2ec[_0x5dce05(0x222)](_0x35d914,{'recursive':!![]});const _0x35d7aa=a181_0xdd0961[_0x5dce05(0x1e1)](_0x1454ba,_0x5dce05(0x230));!a181_0x4ca2ec[_0x5dce05(0x1b2)](_0x35d7aa)&&a181_0x4ca2ec[_0x5dce05(0x189)](_0x35d7aa,createAgentConfigContent(_0x5935f8));const {yaml:_0x493e8b,systemPrompt:_0x4909e9,starterMessage:_0x2c2f00}=await agentResponseToDef(_0x24fed8,_0x1a5c93);let _0x45cb62=_0x13c67e;if(!_0x13c67e){const _0x1214e6=a181_0x4ca2ec[_0x5dce05(0x1b2)](_0x871c60)?a181_0x4ca2ec['readFileSync'](_0x871c60,_0x5dce05(0x129)):'',_0x4850c7=a181_0x4ca2ec['readFileSync'](_0x4a63e2,_0x5dce05(0x129));_0x45cb62=_0x1214e6!==_0x4909e9||_0x4850c7!==toAgentYamlString(_0x493e8b);}a181_0x4ca2ec[_0x5dce05(0x189)](_0x871c60,_0x4909e9),a181_0x4ca2ec['writeFileSync'](_0x4a63e2,toAgentYamlString(_0x493e8b));if(_0x2c2f00&&_0x2c2f00[_0x5dce05(0x1f2)]('\x0a'))a181_0x4ca2ec[_0x5dce05(0x189)](_0x39be47,_0x2c2f00);else a181_0x4ca2ec['existsSync'](_0x39be47)&&a181_0x4ca2ec[_0x5dce05(0x216)](_0x39be47);return{'agentName':_0x282f75,'outputPath':_0x35d914,'isNew':_0x13c67e,'hasChanges':_0x45cb62};}async[a181_0x20204d(0x12c)](_0x4612fe,_0x2c1220){const _0x3d9f9a=a181_0x20204d;let _0x17c7de;isAgentYamlPath(_0x4612fe)?_0x17c7de=getAgentDirFromYamlPath(_0x4612fe):_0x17c7de=_0x4612fe;const {config:_0x2d8c7f}=findAgentConfig(_0x17c7de),_0x581dc8=await this['resolveProjectId'](_0x2d8c7f[_0x3d9f9a(0x177)]),_0x33bcee=a181_0xdd0961[_0x3d9f9a(0x1e1)](_0x17c7de,'agent.yml'),_0x474008=a181_0xdd0961['join'](_0x17c7de,'prompt.md'),_0x115f78=a181_0xdd0961[_0x3d9f9a(0x1e1)](_0x17c7de,_0x3d9f9a(0x144));if(!a181_0x4ca2ec[_0x3d9f9a(0x1b2)](_0x33bcee))throw new SDKError(ErrorCode[_0x3d9f9a(0x229)],_0x3d9f9a(0x1a6)+_0x17c7de,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x66de29=parseAgentYaml(a181_0x4ca2ec[_0x3d9f9a(0x186)](_0x33bcee,'utf-8'),_0x33bcee),_0x4d72d9=a181_0x4ca2ec['existsSync'](_0x474008)?a181_0x4ca2ec[_0x3d9f9a(0x186)](_0x474008,_0x3d9f9a(0x129)):'',_0x361b9d=a181_0x4ca2ec[_0x3d9f9a(0x1b2)](_0x115f78)?a181_0x4ca2ec[_0x3d9f9a(0x186)](_0x115f78,_0x3d9f9a(0x129)):_0x66de29[_0x3d9f9a(0x233)];if(_0x2c1220?.['dryRun'])return{'agentName':_0x66de29[_0x3d9f9a(0x12f)],'action':_0x3d9f9a(0x168),'projectId':_0x581dc8};const _0x57f993=await this['client'][_0x3d9f9a(0x1d4)](_0x581dc8),_0x53f9ae=await fetchAllToolTargetMaps((_0x5cc5f0,_0x19a722)=>this[_0x3d9f9a(0x221)][_0x3d9f9a(0x172)](_0x5cc5f0,_0x19a722),_0x581dc8),_0x5171b1=new Map();for(const _0x113d28 of _0x57f993){_0x5171b1['set'](_0x113d28[_0x3d9f9a(0x1c5)][_0x3d9f9a(0x12f)],_0x113d28['id']);}const _0x193003=[],_0x30abbc={'projectId':_0x581dc8,'resolveToolTargetId':buildIdResolver({..._0x53f9ae[_0x3d9f9a(0x165)],'Agent':_0x5171b1}),'resolvePromptId':async()=>undefined,'onWarning':_0xbdaf98=>{const _0x2c5535=_0x3d9f9a;this['logger'][_0x2c5535(0x20d)](_0xbdaf98),_0x193003[_0x2c5535(0x209)](_0xbdaf98);}};try{const _0x4e792a=_0x57f993[_0x3d9f9a(0x227)](_0x6fa032=>_0x6fa032['attributes'][_0x3d9f9a(0x12f)]===_0x66de29[_0x3d9f9a(0x12f)]),_0x12ba5f=await agentDefToRequest(_0x66de29,_0x4d72d9,_0x361b9d,_0x30abbc);if(_0x4e792a)return await this['client'][_0x3d9f9a(0x1f9)](_0x4e792a['id'],_0x12ba5f),{'agentName':_0x66de29['name'],'action':_0x3d9f9a(0x176),'projectId':_0x581dc8,'agentId':_0x4e792a['id'],'warnings':_0x193003[_0x3d9f9a(0x1d1)]>0x0?_0x193003:undefined};else{const _0x37ef59=await this[_0x3d9f9a(0x221)][_0x3d9f9a(0x14e)](_0x12ba5f);return{'agentName':_0x66de29[_0x3d9f9a(0x12f)],'action':_0x3d9f9a(0x168),'projectId':_0x581dc8,'agentId':_0x37ef59['id'],'warnings':_0x193003[_0x3d9f9a(0x1d1)]>0x0?_0x193003:undefined};}}catch(_0x354232){return{'agentName':_0x66de29[_0x3d9f9a(0x12f)],'action':'error','projectId':_0x581dc8,'error':_0x354232[_0x3d9f9a(0x12e)],'warnings':_0x193003['length']>0x0?_0x193003:undefined};}}async[a181_0x20204d(0x1ac)](_0x2581be,_0x4bf389,_0x227ccf){const _0x3257bf=a181_0x20204d,_0x3bf702=a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x2581be)&&a181_0x4ca2ec[_0x3257bf(0x1b2)](a181_0xdd0961['join'](_0x2581be,'tdx.json'));let _0x20aa70;const _0x439f35=[],_0x871d54=[],_0x3f313e=[],_0x50a07b=[],_0x5c42ac=[],_0x43e6b5=[],_0x1543cd=[],_0x5d5ff8=[],_0x3b6ca0=[];if(_0x3bf702){const _0x45d4c2=loadAgentConfig(a181_0xdd0961[_0x3257bf(0x1e1)](_0x2581be,'tdx.json'));_0x20aa70=_0x45d4c2['llm_project'];const _0x580185=a181_0x4ca2ec[_0x3257bf(0x193)](_0x2581be,{'withFileTypes':!![]});for(const _0x56de65 of _0x580185){if(!_0x56de65[_0x3257bf(0x192)]())continue;if([_0x3257bf(0x145),_0x3257bf(0x156),'experimental_artifacts',_0x3257bf(0x15d),_0x3257bf(0x14b),_0x3257bf(0x14d),_0x3257bf(0x11c)][_0x3257bf(0x1f2)](_0x56de65[_0x3257bf(0x12f)]))continue;const _0x1d82a8=a181_0xdd0961[_0x3257bf(0x1e1)](_0x2581be,_0x56de65[_0x3257bf(0x12f)]);if(isAgentDir(_0x1d82a8)){const _0x34ffd7=a181_0xdd0961[_0x3257bf(0x1e1)](_0x1d82a8,_0x3257bf(0x118)),_0x5f5450=a181_0xdd0961[_0x3257bf(0x1e1)](_0x1d82a8,_0x3257bf(0x1e5)),_0x511f50=a181_0xdd0961[_0x3257bf(0x1e1)](_0x1d82a8,'starter_message.md'),_0x3570cc=parseAgentYaml(a181_0x4ca2ec[_0x3257bf(0x186)](_0x34ffd7,_0x3257bf(0x129)),_0x34ffd7),_0x19a4ee=a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x5f5450)?a181_0x4ca2ec[_0x3257bf(0x186)](_0x5f5450,_0x3257bf(0x129)):'',_0x3aa226=a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x511f50)?a181_0x4ca2ec[_0x3257bf(0x186)](_0x511f50,_0x3257bf(0x129)):_0x3570cc['starter_message'];_0x439f35[_0x3257bf(0x209)]({'name':_0x3570cc[_0x3257bf(0x12f)],'dir':_0x1d82a8,'yaml':_0x3570cc,'systemPrompt':_0x19a4ee,'starterMessage':_0x3aa226});}}const _0x570620=getKnowledgeBasesDir(_0x2581be);if(a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x570620)){const _0x4a642a=a181_0x4ca2ec[_0x3257bf(0x193)](_0x570620);for(const _0x265f21 of _0x4a642a){const _0x4d9743=a181_0xdd0961[_0x3257bf(0x1e1)](_0x570620,_0x265f21);if(_0x265f21[_0x3257bf(0x202)](_0x3257bf(0x1dc))){const _0x3b97c3=parseKnowledgeBaseYaml(a181_0x4ca2ec[_0x3257bf(0x186)](_0x4d9743,_0x3257bf(0x129)),_0x4d9743);_0x871d54[_0x3257bf(0x209)]({'name':_0x3b97c3['name'],'path':_0x4d9743,'yaml':_0x3b97c3});}else{if(_0x265f21[_0x3257bf(0x202)](_0x3257bf(0x218))){const _0x22c8aa=a181_0x4ca2ec['readFileSync'](_0x4d9743,_0x3257bf(0x129)),{name:_0x3ace63,text:_0x412693}=parseTextKnowledgeBaseMd(_0x22c8aa,_0x265f21);_0x3f313e[_0x3257bf(0x209)]({'name':_0x3ace63,'path':_0x4d9743,'text':_0x412693});}}}}const _0x4c5e6a=getPromptsDir(_0x2581be);if(a181_0x4ca2ec['existsSync'](_0x4c5e6a)){const _0x26a766=a181_0x4ca2ec['readdirSync'](_0x4c5e6a)[_0x3257bf(0x1e9)](_0x356b16=>_0x356b16[_0x3257bf(0x202)](_0x3257bf(0x1dc)));for(const _0x3e4356 of _0x26a766){const _0xb61724=a181_0xdd0961['join'](_0x4c5e6a,_0x3e4356),_0x447f49=parsePromptYaml(a181_0x4ca2ec[_0x3257bf(0x186)](_0xb61724,_0x3257bf(0x129)),_0xb61724);_0x50a07b['push']({'name':_0x447f49[_0x3257bf(0x12f)],'path':_0xb61724,'yaml':_0x447f49});}}const _0x3cee34=getIntegrationsDir(_0x2581be);if(a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x3cee34)){const _0xe62016=a181_0x4ca2ec['readdirSync'](_0x3cee34)[_0x3257bf(0x1e9)](_0x205ad7=>_0x205ad7[_0x3257bf(0x202)](_0x3257bf(0x1dc)));for(const _0x38a5d5 of _0xe62016){const _0x6a9b07=a181_0xdd0961[_0x3257bf(0x1e1)](_0x3cee34,_0x38a5d5),_0x3cd99a=parseIntegrationYaml(a181_0x4ca2ec['readFileSync'](_0x6a9b07,_0x3257bf(0x129)),_0x6a9b07);SAFE_INTEGRATION_TYPES[_0x3257bf(0x1f2)](_0x3cd99a[_0x3257bf(0x1b7)][_0x3257bf(0x1ae)]())?_0x5c42ac[_0x3257bf(0x209)]({'name':_0x3cd99a[_0x3257bf(0x12f)],'path':_0x6a9b07,'yaml':_0x3cd99a}):this[_0x3257bf(0x1ec)]['warn'](_0x3257bf(0x1f0)+_0x3cd99a[_0x3257bf(0x12f)]+_0x3257bf(0x237)+_0x3cd99a[_0x3257bf(0x1b7)]+_0x3257bf(0x163)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x3257bf(0x1e1)](',\x20')+_0x3257bf(0x138)));}}const _0x5e82cd=getExperimentalKnowledgeBasesDir(_0x2581be);if(a181_0x4ca2ec['existsSync'](_0x5e82cd)){const _0x2452c7=a181_0x4ca2ec[_0x3257bf(0x193)](_0x5e82cd,{'withFileTypes':!![]});for(const _0x10b3a6 of _0x2452c7){if(!_0x10b3a6[_0x3257bf(0x192)]())continue;const _0x1d20e2=a181_0xdd0961[_0x3257bf(0x1e1)](_0x5e82cd,_0x10b3a6['name']),_0x3587c7=a181_0xdd0961[_0x3257bf(0x1e1)](_0x1d20e2,_0x10b3a6[_0x3257bf(0x12f)]+'.yml');if(a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x3587c7)){const _0x429085=parseExperimentalKnowledgeBaseYaml(a181_0x4ca2ec[_0x3257bf(0x186)](_0x3587c7,_0x3257bf(0x129)),_0x3587c7),_0x447a0e=a181_0xdd0961['join'](_0x1d20e2,_0x3257bf(0x206)),_0x21cdca=[];if(a181_0x4ca2ec['existsSync'](_0x447a0e)){const _0x57a919=a181_0x4ca2ec['readdirSync'](_0x447a0e,{'withFileTypes':!![]});for(const _0x5281ae of _0x57a919){if(!_0x5281ae[_0x3257bf(0x192)]())continue;const _0x4a46ca=a181_0xdd0961[_0x3257bf(0x1e1)](_0x447a0e,_0x5281ae[_0x3257bf(0x12f)]),_0xaa3b14=a181_0xdd0961[_0x3257bf(0x1e1)](_0x4a46ca,_0x3257bf(0x15c)),_0x263bad=a181_0xdd0961[_0x3257bf(0x1e1)](_0x4a46ca,'json_schema.json');if(a181_0x4ca2ec['existsSync'](_0xaa3b14)&&a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x263bad)){const _0x1f9282=a181_0x4ca2ec[_0x3257bf(0x186)](_0xaa3b14,'utf-8'),_0x4aa96b=a181_0x4ca2ec['readFileSync'](_0x263bad,_0x3257bf(0x129));_0x21cdca['push']({'name':_0x5281ae[_0x3257bf(0x12f)],'code':_0x1f9282,'json_schema':_0x4aa96b});}}}const _0x1002b1={..._0x429085,'functions':_0x21cdca};_0x43e6b5['push']({'name':_0x429085['name'],'path':_0x1d20e2,'def':_0x1002b1});}}}const _0x3f32d8=getExperimentalArtifactsDir(_0x2581be);if(a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x3f32d8)){const _0x34e34a=a181_0x4ca2ec[_0x3257bf(0x193)](_0x3f32d8,{'withFileTypes':!![]});for(const _0xe285bc of _0x34e34a){if(!_0xe285bc[_0x3257bf(0x192)]())continue;const _0x2a7dc7=a181_0xdd0961[_0x3257bf(0x1e1)](_0x3f32d8,_0xe285bc[_0x3257bf(0x12f)]),_0x305a5c=a181_0xdd0961[_0x3257bf(0x1e1)](_0x2a7dc7,_0xe285bc[_0x3257bf(0x12f)]+_0x3257bf(0x1dc));if(a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x305a5c)){const _0x281d9c=parseExperimentalArtifactYaml(a181_0x4ca2ec[_0x3257bf(0x186)](_0x305a5c,_0x3257bf(0x129)),_0x305a5c),_0x558b0d=a181_0xdd0961[_0x3257bf(0x1e1)](_0x2a7dc7,_0x3257bf(0x15c)),_0x16a7d0=a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x558b0d)?a181_0x4ca2ec[_0x3257bf(0x186)](_0x558b0d,_0x3257bf(0x129)):'',_0x148af7=a181_0xdd0961[_0x3257bf(0x1e1)](_0x2a7dc7,_0x3257bf(0x12a)),_0x9cb63d=[];if(a181_0x4ca2ec[_0x3257bf(0x1b2)](_0x148af7)){const _0x5c9334=a181_0x4ca2ec[_0x3257bf(0x193)](_0x148af7);for(const _0x2874b5 of _0x5c9334){const _0x24cbe4=a181_0xdd0961[_0x3257bf(0x1e1)](_0x148af7,_0x2874b5);if(a181_0x4ca2ec[_0x3257bf(0x135)](_0x24cbe4)[_0x3257bf(0x137)]()){const _0x22bed6=a181_0x4ca2ec[_0x3257bf(0x186)](_0x24cbe4,'utf-8');_0x9cb63d['push']({'file_name':_0x2874b5,'text_content':_0x22bed6});}}}const _0x551aa3={..._0x281d9c,'code':_0x16a7d0,'files':_0x9cb63d};_0x1543cd[_0x3257bf(0x209)]({'name':_0x281d9c[_0x3257bf(0x12f)],'path':_0x2a7dc7,'def':_0x551aa3});}}}const _0x255ad2=getFormInterfacesDir(_0x2581be);if(a181_0x4ca2ec['existsSync'](_0x255ad2)){const _0xb0f5d=a181_0x4ca2ec[_0x3257bf(0x193)](_0x255ad2)[_0x3257bf(0x1e9)](_0x39c436=>_0x39c436['endsWith'](_0x3257bf(0x1dc)));for(const _0x3651db of _0xb0f5d){const _0x4cda84=a181_0xdd0961['join'](_0x255ad2,_0x3651db),_0x4980b1=parseFormInterfaceYaml(a181_0x4ca2ec[_0x3257bf(0x186)](_0x4cda84,_0x3257bf(0x129)),_0x4cda84);_0x5d5ff8['push']({'name':_0x4980b1[_0x3257bf(0x12f)],'path':_0x4cda84,'yaml':_0x4980b1});}}const _0x2295ce=getChatInterfacesDir(_0x2581be);if(a181_0x4ca2ec['existsSync'](_0x2295ce)){const _0x28f661=a181_0x4ca2ec[_0x3257bf(0x193)](_0x2295ce)[_0x3257bf(0x1e9)](_0x1e5186=>_0x1e5186['endsWith'](_0x3257bf(0x1dc)));for(const _0x247439 of _0x28f661){const _0x290dca=a181_0xdd0961[_0x3257bf(0x1e1)](_0x2295ce,_0x247439),_0x37cfb3=parseChatInterfaceYaml(a181_0x4ca2ec['readFileSync'](_0x290dca,_0x3257bf(0x129)),_0x290dca);_0x3b6ca0[_0x3257bf(0x209)]({'name':_0x37cfb3[_0x3257bf(0x12f)],'path':_0x290dca,'yaml':_0x37cfb3});}}}else{const _0x164a2f=await this[_0x3257bf(0x16e)](_0x2581be),_0x3f8691=await this[_0x3257bf(0x221)]['getProject'](_0x164a2f);_0x20aa70=_0x3f8691[_0x3257bf(0x1c5)][_0x3257bf(0x12f)];const _0x812961=await this[_0x3257bf(0x221)][_0x3257bf(0x1d4)](_0x164a2f),_0x4d10ad=await this[_0x3257bf(0x221)][_0x3257bf(0x1f4)](_0x164a2f),_0x397460=await this[_0x3257bf(0x221)][_0x3257bf(0x21b)](_0x164a2f),_0x10afa1=await this[_0x3257bf(0x221)]['listPrompts'](_0x164a2f),_0x23649c=await this[_0x3257bf(0x221)][_0x3257bf(0x1c1)](_0x164a2f),_0x2ea998=await safeListOrEmpty(()=>this['client'][_0x3257bf(0x13a)](_0x164a2f)),_0x1eefd7=await safeListOrEmpty(()=>this[_0x3257bf(0x221)]['listExperimentalArtifacts'](_0x164a2f)),_0xfff327=new Map(),_0x4d5d2f=new Map(),_0x100f57=new Map(),_0x2394f2=new Map(),_0x3e35d5=new Map(),_0x28ce9b=new Map();for(const _0x4873e1 of _0x4d10ad){_0xfff327[_0x3257bf(0x1a2)](_0x4873e1['id'],_0x4873e1[_0x3257bf(0x1c5)]['name']);}for(const _0x11706d of _0x397460){_0x4d5d2f[_0x3257bf(0x1a2)](_0x11706d['id'],_0x11706d['attributes']['name']);}for(const _0x2068b2 of _0x812961){_0x100f57[_0x3257bf(0x1a2)](_0x2068b2['id'],_0x2068b2[_0x3257bf(0x1c5)][_0x3257bf(0x12f)]);}for(const _0x341f14 of _0x10afa1){_0x2394f2[_0x3257bf(0x1a2)](_0x341f14['id'],_0x341f14[_0x3257bf(0x1c5)][_0x3257bf(0x12f)]);}for(const _0x5b4ec8 of _0x2ea998){_0x3e35d5['set'](_0x5b4ec8['id'],_0x5b4ec8[_0x3257bf(0x1c5)][_0x3257bf(0x12f)]);}for(const _0x185f2a of _0x1eefd7){_0x28ce9b['set'](_0x185f2a['id'],_0x185f2a[_0x3257bf(0x1c5)]['name']);}const _0x2a8d2b={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xfff327,'TextKnowledgeBase':_0x4d5d2f,'Agent':_0x100f57,'ExperimentalKnowledgeBase':_0x3e35d5}),'resolvePromptName':async _0x2787b2=>_0x2394f2[_0x3257bf(0x16f)](_0x2787b2),'onWarning':_0x2806da=>this[_0x3257bf(0x1ec)]['warn'](_0x2806da)};for(const _0x4050ee of _0x812961){const _0x2ffb9b=await agentResponseToDef(_0x4050ee,_0x2a8d2b),{yaml:_0x23c7eb,systemPrompt:_0x24fb44,starterMessage:_0x48db61}=_0x2ffb9b;_0x439f35['push']({'name':_0x23c7eb[_0x3257bf(0x12f)],'dir':'','yaml':_0x23c7eb,'systemPrompt':_0x24fb44,'starterMessage':_0x48db61});}for(const _0x2a269d of _0x4d10ad){const _0x108198=apiKnowledgeBaseToYaml(_0x2a269d);_0x871d54['push']({'name':_0x108198['name'],'path':'','yaml':_0x108198});}for(const _0x37ccbf of _0x397460){_0x3f313e['push']({'name':_0x37ccbf[_0x3257bf(0x1c5)]['name'],'path':'','text':_0x37ccbf['attributes'][_0x3257bf(0x121)]});}for(const _0x41a97a of _0x10afa1){const _0x20f8fa=await apiPromptToYaml(_0x41a97a,_0x2a8d2b);_0x20f8fa&&_0x50a07b['push']({'name':_0x20f8fa['name'],'path':'','yaml':_0x20f8fa});}for(const _0x412138 of _0x23649c){if(!_0x412138[_0x3257bf(0x1c5)][_0x3257bf(0x132)]&&SAFE_INTEGRATION_TYPES[_0x3257bf(0x1f2)](_0x412138[_0x3257bf(0x1c5)]['serviceType'][_0x3257bf(0x1ae)]())){const _0x2dd86e=await apiIntegrationToYaml(_0x412138,_0x2a8d2b);_0x5c42ac[_0x3257bf(0x209)]({'name':_0x412138['attributes']['serviceType'][_0x3257bf(0x1ae)](),'path':'','yaml':_0x2dd86e});}}for(const _0xc89ffd of _0x2ea998){const _0x245434=apiExperimentalKnowledgeBaseToYaml(_0xc89ffd);_0x43e6b5[_0x3257bf(0x209)]({'name':_0x245434[_0x3257bf(0x12f)],'path':'','def':_0x245434});}for(const _0x45d442 of _0x1eefd7){const _0x547c46=apiExperimentalArtifactToYaml(_0x45d442);_0x1543cd[_0x3257bf(0x209)]({'name':_0x547c46[_0x3257bf(0x12f)],'path':'','def':_0x547c46});}const _0x8ce5ff=await safeListOrEmpty(()=>this[_0x3257bf(0x221)][_0x3257bf(0x198)](_0x164a2f));for(const _0x477ab5 of _0x8ce5ff){const _0x13f444=await apiFormInterfaceToYaml(_0x477ab5,_0x2a8d2b);_0x5d5ff8['push']({'name':_0x13f444[_0x3257bf(0x12f)],'path':'','yaml':_0x13f444});}const _0x2623df=await safeListOrEmpty(()=>this[_0x3257bf(0x221)][_0x3257bf(0x19f)](_0x164a2f));for(const _0x35b3fa of _0x2623df){if(_0x35b3fa[_0x3257bf(0x1c5)]['isManaged'])continue;const _0x3e2cea=await apiChatInterfaceToYaml(_0x35b3fa,_0x2a8d2b);_0x3b6ca0[_0x3257bf(0x209)]({'name':_0x3e2cea[_0x3257bf(0x12f)],'path':'','yaml':_0x3e2cea});}}const _0x1282ae={'sourceProjectName':_0x20aa70,'newProjectName':_0x4bf389,'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}}},_0x3fde44=await this[_0x3257bf(0x221)][_0x3257bf(0x1c4)](),_0x404095=_0x3fde44['find'](_0x4ce27c=>_0x4ce27c[_0x3257bf(0x1c5)][_0x3257bf(0x12f)]===_0x4bf389);if(_0x404095)throw new SDKError(ErrorCode[_0x3257bf(0x174)],_0x3257bf(0x128)+_0x4bf389+'\x22\x20already\x20exists',undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x227ccf?.[_0x3257bf(0x1d2)])return _0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x19c)]['created']=_0x439f35[_0x3257bf(0x1d1)],_0x1282ae['counts'][_0x3257bf(0x1be)]['created']=_0x871d54[_0x3257bf(0x1d1)],_0x1282ae['counts'][_0x3257bf(0x1cd)][_0x3257bf(0x168)]=_0x3f313e[_0x3257bf(0x1d1)],_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x21e)]['created']=_0x43e6b5[_0x3257bf(0x1d1)],_0x1282ae[_0x3257bf(0x211)]['experimentalArtifacts']['created']=_0x1543cd['length'],_0x1282ae[_0x3257bf(0x211)]['prompts'][_0x3257bf(0x168)]=_0x50a07b[_0x3257bf(0x1d1)],_0x1282ae['counts'][_0x3257bf(0x14b)]['created']=_0x5c42ac[_0x3257bf(0x1d1)],_0x1282ae;const _0x1a10b3=await this[_0x3257bf(0x221)]['createProject']({'name':_0x4bf389}),_0x2458e5=_0x1a10b3['id'];_0x1282ae[_0x3257bf(0x1f7)]=_0x2458e5;const _0x2e0e2f=new Map(),_0x42cc7a=new Map(),_0x45f224=new Map(),_0x2b86a7=new Map(),_0x45ac4b=new Map(),_0x31f7bd=new Map(),_0x3b5d26=new Map(),_0x33ccd1=new Map(),_0x8f059f=new Set(),_0x219742=new Set();for(const _0x413bd4 of _0x439f35){for(const _0x5c5f2a of _0x413bd4['yaml'][_0x3257bf(0x1ea)]||[]){if(_0x5c5f2a[_0x3257bf(0x234)]===_0x3257bf(0x1b6)&&_0x5c5f2a[_0x3257bf(0x139)]){const _0x10f1d3=parseRef(_0x5c5f2a['target']);if(_0x10f1d3)_0x8f059f[_0x3257bf(0x1b9)](_0x10f1d3[_0x3257bf(0x12f)]);}else{if(_0x5c5f2a['type']===_0x3257bf(0x18e)&&_0x5c5f2a[_0x3257bf(0x139)]){const _0x528b68=parseRef(_0x5c5f2a[_0x3257bf(0x139)]);if(_0x528b68)_0x219742[_0x3257bf(0x1b9)](_0x528b68['name']);}}}}for(const _0x1efbfe of _0x8f059f){try{const _0x2f2c3a=await this[_0x3257bf(0x221)][_0x3257bf(0x1e8)]({'projectId':_0x2458e5,'name':_0x1efbfe});_0x45ac4b[_0x3257bf(0x1a2)](_0x1efbfe,_0x2f2c3a['id']),_0x1282ae[_0x3257bf(0x19e)][_0x3257bf(0x209)]({'name':_0x1efbfe,'action':_0x3257bf(0x168),'id':_0x2f2c3a['id']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x19e)][_0x3257bf(0x168)]++;}catch(_0x111653){_0x1282ae['imageGenerators']['push']({'name':_0x1efbfe,'action':'error','error':_0x111653[_0x3257bf(0x12e)]}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x19e)][_0x3257bf(0x142)]++;}}for(const _0x2cd844 of _0x219742){try{const _0x50952a=await this[_0x3257bf(0x221)]['createWebSearchTool']({'projectId':_0x2458e5,'name':_0x2cd844});_0x31f7bd['set'](_0x2cd844,_0x50952a['id']),_0x1282ae[_0x3257bf(0x162)][_0x3257bf(0x209)]({'name':_0x2cd844,'action':'created','id':_0x50952a['id']}),_0x1282ae['counts'][_0x3257bf(0x162)][_0x3257bf(0x168)]++;}catch(_0x37d472){_0x1282ae['webSearchTools'][_0x3257bf(0x209)]({'name':_0x2cd844,'action':'error','error':_0x37d472[_0x3257bf(0x12e)]}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x162)][_0x3257bf(0x142)]++;}}const _0x5783d6=await fetchAllToolTargetMaps((_0x17076c,_0x662178)=>this['client'][_0x3257bf(0x172)](_0x17076c,_0x662178),_0x2458e5);let _0x2ec946=[];const _0x4a229d={'projectId':_0x2458e5,'resolveToolTargetId':buildIdResolver({..._0x5783d6[_0x3257bf(0x165)],'KnowledgeBase':_0x2e0e2f,'TextKnowledgeBase':_0x42cc7a,'ExperimentalKnowledgeBase':_0x3b5d26,'Agent':_0x45f224,'WebSearchTool':_0x31f7bd,'ImageGenerator':_0x45ac4b}),'resolvePromptId':async _0x5d17dc=>_0x2b86a7[_0x3257bf(0x16f)](_0x5d17dc),'onWarning':_0x2fae64=>{const _0x12f054=_0x3257bf;this[_0x12f054(0x1ec)][_0x12f054(0x20d)](_0x2fae64),_0x2ec946[_0x12f054(0x209)](_0x2fae64);}};for(const _0x58b53c of _0x871d54){try{const _0x3fd461=yamlKnowledgeBaseToApi(_0x58b53c[_0x3257bf(0x1a0)],_0x2458e5),_0x14d215=await this[_0x3257bf(0x221)][_0x3257bf(0x207)](_0x3fd461);_0x2e0e2f[_0x3257bf(0x1a2)](_0x58b53c[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],_0x14d215['id']),_0x1282ae['knowledgeBases']['push']({'name':_0x58b53c[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],'action':_0x3257bf(0x168),'id':_0x14d215['id']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x1be)][_0x3257bf(0x168)]++;}catch(_0x2c6c8f){_0x1282ae[_0x3257bf(0x1be)][_0x3257bf(0x209)]({'name':_0x58b53c[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],'action':_0x3257bf(0x1e4),'error':_0x2c6c8f['message']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x1be)][_0x3257bf(0x142)]++;}}for(const _0x11ba86 of _0x3f313e){try{const _0x276f64=yamlTextKnowledgeBaseToApi({'name':_0x11ba86[_0x3257bf(0x12f)],'text':_0x11ba86['text']},_0x2458e5),_0x179353=await this[_0x3257bf(0x221)][_0x3257bf(0x148)](_0x276f64);_0x42cc7a[_0x3257bf(0x1a2)](_0x11ba86[_0x3257bf(0x12f)],_0x179353['id']),_0x1282ae[_0x3257bf(0x1cd)][_0x3257bf(0x209)]({'name':_0x11ba86['name'],'action':_0x3257bf(0x168),'id':_0x179353['id']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x1cd)][_0x3257bf(0x168)]++;}catch(_0x2c5fca){_0x1282ae[_0x3257bf(0x1cd)][_0x3257bf(0x209)]({'name':_0x11ba86[_0x3257bf(0x12f)],'action':_0x3257bf(0x1e4),'error':_0x2c5fca[_0x3257bf(0x12e)]}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x1cd)][_0x3257bf(0x142)]++;}}for(const _0x2bfef5 of _0x1543cd){try{const _0x37e1ef=yamlExperimentalArtifactToApi(_0x2bfef5['def'],_0x2458e5),_0x4a790d=await this['client'][_0x3257bf(0x1d6)](_0x37e1ef);_0x33ccd1[_0x3257bf(0x1a2)](_0x2bfef5[_0x3257bf(0x182)]['name'],_0x4a790d['id']),_0x1282ae['experimentalArtifacts']['push']({'name':_0x2bfef5[_0x3257bf(0x182)]['name'],'action':_0x3257bf(0x168),'id':_0x4a790d['id']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x1b5)][_0x3257bf(0x168)]++;}catch(_0x53047a){_0x1282ae['experimentalArtifacts'][_0x3257bf(0x209)]({'name':_0x2bfef5[_0x3257bf(0x182)][_0x3257bf(0x12f)],'action':_0x3257bf(0x1e4),'error':_0x53047a['message']}),_0x1282ae['counts'][_0x3257bf(0x1b5)]['errors']++;}}for(const _0x4dedc2 of _0x43e6b5){try{const _0x32e844=yamlExperimentalKnowledgeBaseToApi(_0x4dedc2['def'],_0x2458e5),_0x5317c6=await this['client'][_0x3257bf(0x152)](_0x32e844);_0x3b5d26[_0x3257bf(0x1a2)](_0x4dedc2['def'][_0x3257bf(0x12f)],_0x5317c6['id']),_0x1282ae[_0x3257bf(0x21e)][_0x3257bf(0x209)]({'name':_0x4dedc2[_0x3257bf(0x182)]['name'],'action':'created','id':_0x5317c6['id']}),_0x1282ae['counts'][_0x3257bf(0x21e)][_0x3257bf(0x168)]++;}catch(_0x40c9c8){_0x1282ae[_0x3257bf(0x21e)]['push']({'name':_0x4dedc2[_0x3257bf(0x182)][_0x3257bf(0x12f)],'action':'error','error':_0x40c9c8[_0x3257bf(0x12e)]}),_0x1282ae[_0x3257bf(0x211)]['experimentalKnowledgeBases'][_0x3257bf(0x142)]++;}}const _0xf185f2=[..._0x439f35][_0x3257bf(0x11f)]((_0x3d77cb,_0x1e8c28)=>{const _0x5e3514=_0x3257bf,_0x441dc2=_0x3d77cb['yaml'][_0x5e3514(0x1ea)]?.[_0x5e3514(0x178)](_0x1fff50=>_0x1fff50[_0x5e3514(0x234)]===_0x5e3514(0x20b))??![],_0x5ee9f9=_0x1e8c28[_0x5e3514(0x1a0)]['tools']?.[_0x5e3514(0x178)](_0x66fee1=>_0x66fee1[_0x5e3514(0x234)]==='agent')??![];if(_0x441dc2&&!_0x5ee9f9)return 0x1;if(!_0x441dc2&&_0x5ee9f9)return-0x1;return 0x0;});for(const _0x28906d of _0xf185f2){_0x2ec946=[];try{const _0x1b1055=_0x28906d[_0x3257bf(0x1a0)]['tools']?.[_0x3257bf(0x1e9)](_0x2ca9d6=>{const _0x49ce45=_0x3257bf;if(_0x2ca9d6[_0x49ce45(0x234)]===_0x49ce45(0x20b)&&_0x2ca9d6[_0x49ce45(0x139)]){const _0x5f4ddc=parseRef(_0x2ca9d6[_0x49ce45(0x139)]);return _0x5f4ddc?.['name']===_0x28906d[_0x49ce45(0x1a0)]['name'];}return![];})??[];if(_0x1b1055[_0x3257bf(0x1d1)]>0x0){const _0x4bfb44='Agent\x20\x27'+_0x28906d[_0x3257bf(0x1a0)][_0x3257bf(0x12f)]+_0x3257bf(0x196)+_0x3257bf(0x12d);this[_0x3257bf(0x1ec)]['warn'](_0x4bfb44),_0x2ec946[_0x3257bf(0x209)](_0x4bfb44);}const _0x3621e0=await agentDefToRequest(_0x28906d['yaml'],_0x28906d[_0x3257bf(0x1b0)],_0x28906d[_0x3257bf(0x224)],_0x4a229d),_0x2c2635=await this[_0x3257bf(0x221)][_0x3257bf(0x14e)](_0x3621e0);_0x45f224[_0x3257bf(0x1a2)](_0x28906d[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],_0x2c2635['id']),_0x1282ae[_0x3257bf(0x19c)][_0x3257bf(0x209)]({'agentName':_0x28906d['yaml']['name'],'action':_0x3257bf(0x168),'agentId':_0x2c2635['id'],'warnings':_0x2ec946[_0x3257bf(0x1d1)]>0x0?_0x2ec946:undefined}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x19c)][_0x3257bf(0x168)]++;}catch(_0x3e0000){_0x1282ae[_0x3257bf(0x19c)][_0x3257bf(0x209)]({'agentName':_0x28906d['yaml'][_0x3257bf(0x12f)],'action':_0x3257bf(0x1e4),'error':_0x3e0000[_0x3257bf(0x12e)],'warnings':_0x2ec946[_0x3257bf(0x1d1)]>0x0?_0x2ec946:undefined}),_0x1282ae['counts'][_0x3257bf(0x19c)][_0x3257bf(0x142)]++;}}for(const _0x383f31 of _0x50a07b){try{const _0x5eaead=await yamlPromptToApi(_0x383f31[_0x3257bf(0x1a0)],_0x2458e5,_0x4a229d);if(!_0x5eaead){_0x1282ae[_0x3257bf(0x15d)][_0x3257bf(0x209)]({'name':_0x383f31['yaml'][_0x3257bf(0x12f)],'action':'error','error':_0x3257bf(0x1cb)}),_0x1282ae[_0x3257bf(0x211)]['prompts'][_0x3257bf(0x142)]++;continue;}const _0x4189b3=await this['client'][_0x3257bf(0x217)](_0x5eaead);_0x2b86a7[_0x3257bf(0x1a2)](_0x383f31[_0x3257bf(0x1a0)]['name'],_0x4189b3['id']),_0x1282ae['prompts'][_0x3257bf(0x209)]({'name':_0x383f31[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],'action':'created','id':_0x4189b3['id']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x15d)][_0x3257bf(0x168)]++;}catch(_0x388604){_0x1282ae[_0x3257bf(0x15d)]['push']({'name':_0x383f31[_0x3257bf(0x1a0)]['name'],'action':_0x3257bf(0x1e4),'error':_0x388604[_0x3257bf(0x12e)]}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x15d)][_0x3257bf(0x142)]++;}}for(const _0x1660d6 of _0x5c42ac){try{const _0x43015c=await yamlIntegrationToApi(_0x1660d6[_0x3257bf(0x1a0)],_0x2458e5,_0x4a229d),_0x332c51=await this[_0x3257bf(0x221)][_0x3257bf(0x1d7)](_0x43015c);_0x1282ae[_0x3257bf(0x14b)][_0x3257bf(0x209)]({'name':_0x1660d6['yaml'][_0x3257bf(0x1b7)],'action':_0x3257bf(0x168),'id':_0x332c51['id']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x14b)][_0x3257bf(0x168)]++;}catch(_0x49a892){_0x1282ae[_0x3257bf(0x14b)]['push']({'name':_0x1660d6[_0x3257bf(0x1a0)]['service_type'],'action':_0x3257bf(0x1e4),'error':_0x49a892['message']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x14b)][_0x3257bf(0x142)]++;}}for(const _0x4253a9 of _0x5d5ff8){try{const _0x4fa37d=await yamlFormInterfaceToApi(_0x4253a9[_0x3257bf(0x1a0)],_0x2458e5,_0x4a229d);if(!_0x4fa37d){_0x1282ae[_0x3257bf(0x1d9)]['push']({'name':_0x4253a9[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],'action':'error','error':_0x3257bf(0x236)}),_0x1282ae['counts'][_0x3257bf(0x1d9)][_0x3257bf(0x142)]++;continue;}const _0x2d3af0=await this[_0x3257bf(0x221)][_0x3257bf(0x1ce)](_0x4fa37d);_0x1282ae[_0x3257bf(0x1d9)]['push']({'name':_0x4253a9[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],'action':_0x3257bf(0x168),'id':_0x2d3af0['id']}),_0x1282ae[_0x3257bf(0x211)]['formInterfaces'][_0x3257bf(0x168)]++;}catch(_0x5c8a9f){_0x1282ae[_0x3257bf(0x1d9)]['push']({'name':_0x4253a9[_0x3257bf(0x1a0)]['name'],'action':_0x3257bf(0x1e4),'error':_0x5c8a9f[_0x3257bf(0x12e)]}),_0x1282ae[_0x3257bf(0x211)]['formInterfaces'][_0x3257bf(0x142)]++;}}for(const _0x311662 of _0x3b6ca0){try{const _0x512255=await yamlChatInterfaceToApi(_0x311662[_0x3257bf(0x1a0)],_0x2458e5,_0x4a229d),_0xf99133=await this[_0x3257bf(0x221)][_0x3257bf(0x1ca)](_0x512255);_0x1282ae[_0x3257bf(0x14a)][_0x3257bf(0x209)]({'name':_0x311662[_0x3257bf(0x1a0)][_0x3257bf(0x12f)],'action':'created','id':_0xf99133['id']}),_0x1282ae[_0x3257bf(0x211)]['chatInterfaces']['created']++;}catch(_0x2cad2a){_0x1282ae[_0x3257bf(0x14a)]['push']({'name':_0x311662[_0x3257bf(0x1a0)]['name'],'action':_0x3257bf(0x1e4),'error':_0x2cad2a['message']}),_0x1282ae[_0x3257bf(0x211)][_0x3257bf(0x14a)][_0x3257bf(0x142)]++;}}return _0x1282ae;}}