@treasuredata/tdx 0.26.6 → 0.26.7

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 (191) 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/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.d.ts.map +1 -1
  22. package/dist/commands/job-command.js +1 -1
  23. package/dist/commands/job-command.js.map +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/tools/index.js +1 -1
  65. package/dist/mcp/tools/tdx-run.js +1 -1
  66. package/dist/mcp/tools/tdx-search.js +1 -1
  67. package/dist/mcp/utils.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/passthrough-server.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.d.ts +14 -37
  74. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  75. package/dist/sdk/agent/agent-yaml.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/agent/tool-target-registry.d.ts +82 -0
  83. package/dist/sdk/agent/tool-target-registry.d.ts.map +1 -0
  84. package/dist/sdk/agent/tool-target-registry.js +1 -0
  85. package/dist/sdk/agent/tool-target-registry.js.map +1 -0
  86. package/dist/sdk/agent/types/agent-def.d.ts +3 -2
  87. package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/endpoints.js +1 -1
  91. package/dist/sdk/client/engage-api-client.js +1 -1
  92. package/dist/sdk/client/http-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.d.ts +20 -0
  94. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  95. package/dist/sdk/client/llm-api-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js.map +1 -1
  97. package/dist/sdk/client/rate-limiter.js +1 -1
  98. package/dist/sdk/client/td-api-client.d.ts +2 -2
  99. package/dist/sdk/client/td-api-client.d.ts.map +1 -1
  100. package/dist/sdk/client/td-api-client.js +1 -1
  101. package/dist/sdk/client/td-api-client.js.map +1 -1
  102. package/dist/sdk/client/trino-api-client.js +1 -1
  103. package/dist/sdk/client/workflow-client.js +1 -1
  104. package/dist/sdk/connection-validator.js +1 -1
  105. package/dist/sdk/connection.js +1 -1
  106. package/dist/sdk/engage.js +1 -1
  107. package/dist/sdk/errors.js +1 -1
  108. package/dist/sdk/index.js +1 -1
  109. package/dist/sdk/io/index.js +1 -1
  110. package/dist/sdk/io/node-filesystem.js +1 -1
  111. package/dist/sdk/job.d.ts +1 -1
  112. package/dist/sdk/job.d.ts.map +1 -1
  113. package/dist/sdk/job.js +1 -1
  114. package/dist/sdk/job.js.map +1 -1
  115. package/dist/sdk/journey.js +1 -1
  116. package/dist/sdk/llm/chat-cache.js +1 -1
  117. package/dist/sdk/llm/index.d.ts.map +1 -1
  118. package/dist/sdk/llm/index.js +1 -1
  119. package/dist/sdk/llm/index.js.map +1 -1
  120. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  121. package/dist/sdk/llm/model-factors.js +1 -1
  122. package/dist/sdk/personalization.js +1 -1
  123. package/dist/sdk/query/index.js +1 -1
  124. package/dist/sdk/query/sql-parser.js +1 -1
  125. package/dist/sdk/realtime.js +1 -1
  126. package/dist/sdk/schedule.js +1 -1
  127. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  128. package/dist/sdk/segment/fields-display.js +1 -1
  129. package/dist/sdk/segment/file-discovery.js +1 -1
  130. package/dist/sdk/segment/journey-utils.js +1 -1
  131. package/dist/sdk/segment/journey-validator.js +1 -1
  132. package/dist/sdk/segment/journey-yaml.js +1 -1
  133. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  134. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  135. package/dist/sdk/segment/pull-workflow.js +1 -1
  136. package/dist/sdk/segment/push-recovery.js +1 -1
  137. package/dist/sdk/segment/push-workflow.js +1 -1
  138. package/dist/sdk/segment/resolution-context.js +1 -1
  139. package/dist/sdk/segment/segment-path-parser.js +1 -1
  140. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  141. package/dist/sdk/segment/target-resolution.js +1 -1
  142. package/dist/sdk/segment/tdx-config.js +1 -1
  143. package/dist/sdk/segment/validate-files.js +1 -1
  144. package/dist/sdk/segment/yaml-validator.js +1 -1
  145. package/dist/sdk/segment.js +1 -1
  146. package/dist/sdk/types/index.js +1 -1
  147. package/dist/sdk/types/progress.js +1 -1
  148. package/dist/sdk/user.js +1 -1
  149. package/dist/sdk/util/format-detector.js +1 -1
  150. package/dist/sdk/util/formatters.js +1 -1
  151. package/dist/sdk/util/index.js +1 -1
  152. package/dist/sdk/util/tree-formatter.js +1 -1
  153. package/dist/sdk/workflow/archive-validation.js +1 -1
  154. package/dist/sdk/workflow/clone-workflow.js +1 -1
  155. package/dist/sdk/workflow/index.js +1 -1
  156. package/dist/sdk/workflow/pull-workflow.js +1 -1
  157. package/dist/sdk/workflow/push-workflow.js +1 -1
  158. package/dist/sdk/workflow/tdx-config.js +1 -1
  159. package/dist/sdk/workflow/workflow-utils.js +1 -1
  160. package/dist/test-utils/command-runner.js +1 -1
  161. package/dist/test-utils/factories.js +1 -1
  162. package/dist/test-utils/fixtures.js +1 -1
  163. package/dist/test-utils/http-mock.js +1 -1
  164. package/dist/test-utils/index.js +1 -1
  165. package/dist/utils/async.js +1 -1
  166. package/dist/utils/colors.js +1 -1
  167. package/dist/utils/diff.js +1 -1
  168. package/dist/utils/file-permissions.js +1 -1
  169. package/dist/utils/global-cache.js +1 -1
  170. package/dist/utils/json-loader.js +1 -1
  171. package/dist/utils/local-cache.js +1 -1
  172. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  173. package/dist/utils/logger/formatters/index.js +1 -1
  174. package/dist/utils/logger/handlers/console-handler.js +1 -1
  175. package/dist/utils/logger/handlers/file-handler.js +1 -1
  176. package/dist/utils/logger/handlers/index.js +1 -1
  177. package/dist/utils/logger/handlers/null-handler.js +1 -1
  178. package/dist/utils/logger/index.js +1 -1
  179. package/dist/utils/logger/logger.js +1 -1
  180. package/dist/utils/logger/types.js +1 -1
  181. package/dist/utils/option-validation.js +1 -1
  182. package/dist/utils/port.js +1 -1
  183. package/dist/utils/process.js +1 -1
  184. package/dist/utils/prompt.js +1 -1
  185. package/dist/utils/spinner.js +1 -1
  186. package/dist/utils/sse-parser.js +1 -1
  187. package/dist/utils/string-utils.js +1 -1
  188. package/dist/utils/table-ref-parser.js +1 -1
  189. package/dist/utils/tdx-logger.js +1 -1
  190. package/dist/utils/version-check.js +1 -1
  191. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/llm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EACV,UAAU,EACV,KAAK,EACL,SAAS,EACT,IAAI,EACJ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,aAAa,EAKb,qBAAqB,EACrB,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AA2E3B;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,wEAAyE,CAAC;AAE7G;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,MAAM;IACjB,mEAAmE;IACnE,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAElC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,MAAM,CAAwB;IAEtC,gBAAgB;gBACJ,OAAO,EAAE,UAAU;IAK/B;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAK7B;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpD;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,IAAI,MAAM,GAAG,SAAS;IAIvC;;;;;;;;;;;;;;;;;;OAkBG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCtD;;;;;;;;;;;;;;OAcG;IACH,eAAe,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAK9E;;;;;;;;;OASG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAkBpC;;;;;;;;;;;;;;OAcG;IACG,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIrE;;;;;;;;;;;;OAYG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhD;;;;;;;;;;;;;;;OAeG;IACG,QAAQ,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIzD;;;;;;;;;;;;;;OAcG;IACH;;;;;;;;;;OAUG;IACG,yBAAyB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAkD1E;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB5D;;;;;;;;;;;OAWG;IACG,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,UAAU,CAAA;KAAE,CAAC;IAgB3F;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,uBAAuB,CAC3B,KAAK,GAAE,MAA4B,EACnC,eAAe,GAAE,MAAU,EAC3B,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,KAAK,CAAC;IAqFjB;;;;;;;;;;;;;;;OAeG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAwB5E;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAMlD;;;;;;OAMG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI7D;;;;;;;;;;;OAWG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAI5C;;;;;;;;;;;;;;;;;OAiBG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAI5D;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAI7E;;;;;;;;;;OAUG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACI,IAAI,CACT,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,WAAW,GACpB,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC;IAoCjD;;;;;;;;;;;OAWG;IACG,KAAK,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAIhD;;;;;;;;;;;;;;OAcG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI3D;;;;;;;;;;;;OAYG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAI1D;;;;;;;;;;;;;OAaG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,aAAa,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAC7B,OAAO,CAAC,aAAa,CAAC;IA6EzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,cAAc,CAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAC5C,OAAO,CAAC,cAAc,CAAC;IAiM1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,qBAAqB;IAwC1D;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CACf,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,gBAAgB,CAAC;IAglBtD;;;;;;;;;;;;;;OAcG;IACG,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,gBAAgB,CAAC;IA02BtD;;;;;;;;OAQG;IACG,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,eAAe,CAAC;IA2HrD;;;;;;OAMG;IACG,SAAS,CACb,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,eAAe,CAAC;IAsHrD;;;;;;;;;OASG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,iBAAiB,GACpD,OAAO,CAAC,OAAO,iBAAiB,EAAE,iBAAiB,CAAC;CAwhBxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/llm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EACV,UAAU,EACV,KAAK,EACL,SAAS,EACT,IAAI,EACJ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,aAAa,EAKb,qBAAqB,EACrB,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AA8E3B;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,wEAAyE,CAAC;AAE7G;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,MAAM;IACjB,mEAAmE;IACnE,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAElC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,MAAM,CAAwB;IAEtC,gBAAgB;gBACJ,OAAO,EAAE,UAAU;IAK/B;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAK7B;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpD;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,IAAI,MAAM,GAAG,SAAS;IAIvC;;;;;;;;;;;;;;;;;;OAkBG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCtD;;;;;;;;;;;;;;OAcG;IACH,eAAe,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAK9E;;;;;;;;;OASG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAkBpC;;;;;;;;;;;;;;OAcG;IACG,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIrE;;;;;;;;;;;;OAYG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhD;;;;;;;;;;;;;;;OAeG;IACG,QAAQ,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIzD;;;;;;;;;;;;;;OAcG;IACH;;;;;;;;;;OAUG;IACG,yBAAyB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAkD1E;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB5D;;;;;;;;;;;OAWG;IACG,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,UAAU,CAAA;KAAE,CAAC;IAgB3F;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,uBAAuB,CAC3B,KAAK,GAAE,MAA4B,EACnC,eAAe,GAAE,MAAU,EAC3B,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,KAAK,CAAC;IAqFjB;;;;;;;;;;;;;;;OAeG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAwB5E;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAMlD;;;;;;OAMG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI7D;;;;;;;;;;;OAWG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAI5C;;;;;;;;;;;;;;;;;OAiBG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAI5D;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAI7E;;;;;;;;;;OAUG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACI,IAAI,CACT,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,WAAW,GACpB,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC;IAoCjD;;;;;;;;;;;OAWG;IACG,KAAK,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAIhD;;;;;;;;;;;;;;OAcG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI3D;;;;;;;;;;;;OAYG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAI1D;;;;;;;;;;;;;OAaG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,aAAa,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAC7B,OAAO,CAAC,aAAa,CAAC;IA6EzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,cAAc,CAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAC5C,OAAO,CAAC,cAAc,CAAC;IAiM1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,qBAAqB;IAwC1D;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CACf,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,gBAAgB,CAAC;IAklBtD;;;;;;;;;;;;;;OAcG;IACG,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,gBAAgB,CAAC;IA20BtD;;;;;;;;OAQG;IACG,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,eAAe,CAAC;IA2HrD;;;;;;OAMG;IACG,SAAS,CACb,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,GACnD,OAAO,CAAC,OAAO,iBAAiB,EAAE,eAAe,CAAC;IAyGrD;;;;;;;;;OASG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,OAAO,iBAAiB,EAAE,iBAAiB,GACpD,OAAO,CAAC,OAAO,iBAAiB,EAAE,iBAAiB,CAAC;CA+hBxD"}
@@ -1 +1 @@
1
- const a96_0x5d9617=a96_0x186e;(function(_0x22ffa8,_0x935652){const _0x3fd756=a96_0x186e,_0x1c942e=_0x22ffa8();while(!![]){try{const _0x42e939=-parseInt(_0x3fd756(0x26b))/0x1*(-parseInt(_0x3fd756(0x1d7))/0x2)+-parseInt(_0x3fd756(0x185))/0x3*(-parseInt(_0x3fd756(0x24a))/0x4)+parseInt(_0x3fd756(0x25d))/0x5*(parseInt(_0x3fd756(0x1e0))/0x6)+parseInt(_0x3fd756(0x270))/0x7+-parseInt(_0x3fd756(0x1ff))/0x8+parseInt(_0x3fd756(0x251))/0x9+-parseInt(_0x3fd756(0x273))/0xa*(parseInt(_0x3fd756(0x1cc))/0xb);if(_0x42e939===_0x935652)break;else _0x1c942e['push'](_0x1c942e['shift']());}catch(_0x5f26eb){_0x1c942e['push'](_0x1c942e['shift']());}}}(a96_0x2d05,0x58750));import{LLMApiClient}from'../client/llm-api-client.js';import*as a96_0x1974b2 from'node:fs';import*as a96_0xa96e78 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';function a96_0x186e(_0x264c6e,_0x276505){_0x264c6e=_0x264c6e-0x17e;const _0x2d052c=a96_0x2d05();let _0x186ece=_0x2d052c[_0x264c6e];return _0x186ece;}function a96_0x2d05(){const _0x1ed895=['Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','createAgentResponse','createIntegration','tdx.json','type','add','(dry-run)','UNAUTHENTICATED','dry-run-','getChatInfo','AGENT_NOT_FOUND','path','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','getProject','Renamed\x20KB\x20file:\x20','3676KWzzZa','slackMessageMode','image_gen','listChats','outputs','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.','listAgentsFull','3146868xIANJk','updatePrompt','PERMISSION_DENIED','#\x20prompt.md\x0a','find','agent','models','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','service_type','startChat','profile','Available\x20agents:\x20','5ZeSyIi','renamed','Skipping\x20integration\x20\x27','resolveProjectId','starter_message.md','prompt.md','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','agent.yml','listExperimentalArtifacts','name','has','getDefaultAgent','version','integrations','114RmjFcj','getDefaultProjectName','already\x20exists','client','utf-8','2206792iXhYAN','yaml','starter_message','10UEpRXx','createTextKnowledgeBase','listExperimentalKnowledgeBases','listIntegrations','description','.llm','Agent\x20\x27','getOrCreateDefaultProject','json_schema.json','action','):\x20','setCurrentProject','knowledgebases.json','rmSync','listWebSearchTools','logger','knowledgeBases','dir','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','context','site','tables','restoreProject','createAgent','map','new','Agent\x20reference\x20not\x20found','jsonSchemaHint','createProject','warn','imageGenerators','Unable\x20to\x20create\x20project\x20after\x20','errors','created','metadata','updateAgentResponse','getChatLog','knowledge_bases','dryRun','324tGStUX','---\x20file:\x20','Multiple\x20agents\x20found\x20with\x20name\x20\x27','promptId','chat_generic','tdx_default_','project.json','oldPath','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','\x0a---\x20schema:\x20','updateAgent','\x0a\x0a#\x20agent.yml\x0a','Renamed\x20experimental\x20artifact\x20directory:\x20','agentId','size','files','low','listTextKnowledgeBases','isDir','llm_project','cwd','serviceType','\x20attempts\x20due\x20to\x20name\x20conflicts.','Project\x20not\x20found:\x20','experimentalKnowledgeBases','mkdirSync','createExperimentalKnowledgeBase','getAgent','LLM_PROJECT_NOT_FOUND','listAgents','pushProject','updated','exportedFrom','\x0a---\x20code\x20---\x0a','getParentSegmentKnowledgeBase','webhookCorsOrigins','updateTextKnowledgeBase','cloneProject','Renamed\x20folder:\x20','Unsupported\x20backup\x20version:\x20','message','\x20---\x0a','readFileSync','agents.json','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Agent\x20not\x20found:\x20','Multiple\x20projects\x20found\x20with\x20name\x20\x27','conflict','existsSync','readdirSync','deleteProject','actions','setDefaultAgent','target','statSync','agent.yml\x20not\x20found\x20in\x20','Renamed\x20agent\x20folder:\x20','file_name','backupProject','ALREADY_EXISTS','info','createWebSearchTool','integrations.json','listPrompts','Renamed\x20prompt\x20file:\x20','get','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','\x0a---\x20function:\x20','deleteAgent','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','listKnowledgeBases','7712331DZLcKI','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','agentsFull','stringify','total','tdx_','minimal','temperature','getOrCreateDefaultAgent','projects','experimentalArtifacts','12130ukejXU','Invalid\x20agent\x20reference\x20format:\x20','Output\x20directory\x20already\x20exists:\x20','clearDefaultAgent','variables','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','listImageGenerators','chat','availableModelNames','1810986KtpQKg','projectName',')\x20can\x20be\x20pushed.\x20','agents','text_content','endsWith','localeCompare','functions','dirname','prompts','def','attributes','includes','chatId','.yml','Only\x20safe\x20types\x20(','NOT_FOUND','parse','json_schema','modelType','writeFileSync','duplicate','chat_parent_segment','prompts.json','createImageGenerator','toLowerCase','status','loadJsonFile','signal','createKnowledgeBase','reasoningEffort','5551680oSunPE','resolveAgentId','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','INTERNAL','set','\x27\x20(','some','text','createPrompt','chatWelcomeMessage','Renamed\x20integration\x20file:\x20','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','listProjects','content','No\x20tdx.json\x20found\x20in\x20','filter','newProjectId','currentProjectId','push','textKnowledgeBases','Project\x20\x22','createExperimentalArtifact','.md','getBackupMetadata','starterMessage','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','length','\x27.\x20This\x20should\x20not\x20happen.','error','systemPrompt','Backup\x20folder\x20not\x20found:\x20','basename','INVALID_ARGUMENT','getChatHistory','isFile','updateExperimentalArtifact','tdDatabaseName','\x20→\x20','tools','continueChat','isManaged','Removed\x20deleted\x20directory:\x20','none','resolveProjectName','toISOString','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','\x22\x20already\x20exists','sort','isDirectory','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','webSearchTools','experimental_knowledge_bases','code.js','counts','code','maxToolIterations','join','unchanged','pullAgent'];a96_0x2d05=function(){return _0x1ed895;};return a96_0x2d05();}import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a96_0x5d9617(0x189),'chat_agent_console',a96_0x5d9617(0x1f6)];export class LLMSDK{['currentProjectId'];[a96_0x5d9617(0x26e)];[a96_0x5d9617(0x286)];[a96_0x5d9617(0x282)]=Logger['of']('sdk.llm');constructor(_0x181f37){const _0x3009b4=a96_0x5d9617;this['client']=new LLMApiClient(_0x181f37),this[_0x3009b4(0x286)]=_0x181f37;}[a96_0x5d9617(0x26c)](){const _0x5d7efe=a96_0x5d9617,_0x6c9d84=getSanitizedUsername();return _0x5d7efe(0x18a)+_0x6c9d84;}async[a96_0x5d9617(0x27e)](_0x3ed979){const _0x5b7369=a96_0x5d9617,{projectId:_0x32d633}=await this[_0x5b7369(0x22a)](_0x3ed979);this[_0x5b7369(0x210)]=_0x32d633;}['getCurrentProject'](){const _0x17df28=a96_0x5d9617;return this[_0x17df28(0x210)];}async[a96_0x5d9617(0x1b9)](_0xd1980e){const _0x53aac9=a96_0x5d9617,_0x26b1c0=this['context'][_0x53aac9(0x25b)];let _0x1a2df5,_0x4a0a84;if(_0xd1980e[_0x53aac9(0x1ec)]('/')){const _0x1de881=_0xd1980e['split']('/');if(_0x1de881[_0x53aac9(0x219)]!==0x2)throw new SDKError(ErrorCode[_0x53aac9(0x21f)],_0x53aac9(0x1d8)+_0xd1980e,undefined,{'helpText':_0x53aac9(0x1ca)});const [_0x5a80fa,_0x4ead5a]=_0x1de881;_0x1a2df5=await this['resolveProjectId'](_0x5a80fa),_0x4a0a84=_0x4ead5a;}else _0x1a2df5=this['currentProjectId']||(await this[_0x53aac9(0x27a)]())['id'],_0x4a0a84=_0xd1980e;const _0x4de8ab=await this[_0x53aac9(0x200)](_0x4a0a84,_0x1a2df5),_0x1bddbb=await this[_0x53aac9(0x26e)][_0x53aac9(0x1a0)](_0x4de8ab);writeCachedLLMAgent(_0x1bddbb[_0x53aac9(0x1eb)]['name'],_0x4de8ab,_0x1a2df5,_0x26b1c0);}[a96_0x5d9617(0x268)](){const _0x3d1bde=a96_0x5d9617,_0x7ff860=this[_0x3d1bde(0x286)][_0x3d1bde(0x25b)];return readCachedLLMAgent(_0x7ff860)||undefined;}[a96_0x5d9617(0x1da)](){const _0xff6e2c=a96_0x5d9617,_0x3c651c=this[_0xff6e2c(0x286)]['profile'];clearCachedLLMAgent(_0x3c651c);}async[a96_0x5d9617(0x257)](){const _0x154ead=a96_0x5d9617,_0x23beba=await this[_0x154ead(0x26e)]['getUserSettings'](),_0x50b4ac=[];for(const _0x55e2ff of _0x23beba[_0x154ead(0x1df)]){const _0x33eb3a=_0x23beba['availableModels'][_0x55e2ff];_0x33eb3a&&_0x50b4ac['push']({'name':_0x55e2ff,'displayName':_0x33eb3a['displayName']});}return _0x50b4ac;}async[a96_0x5d9617(0x28f)](_0x5ab81a){const _0x46865a=a96_0x5d9617;return await this['client'][_0x46865a(0x28f)](_0x5ab81a);}async[a96_0x5d9617(0x1b7)](_0x48002d){const _0x5aec44=a96_0x5d9617,{projectId:_0x49f29e}=await this[_0x5aec44(0x22a)](_0x48002d);await this[_0x5aec44(0x26e)][_0x5aec44(0x1b7)](_0x49f29e);}async[a96_0x5d9617(0x1d5)](_0x333001=0x32){const _0x44f6a2=a96_0x5d9617;return await this['client'][_0x44f6a2(0x20b)](_0x333001);}async['getOrCreateDefaultProject'](_0x52e60b){const _0x15eb23=a96_0x5d9617,_0x4cf2cd=_0x52e60b||this[_0x15eb23(0x26c)](),_0x4140ad=this[_0x15eb23(0x286)][_0x15eb23(0x25b)];if(!_0x52e60b){const _0xfc1036=readCachedLLMProject(_0x4140ad);if(_0xfc1036&&_0xfc1036[_0x15eb23(0x266)]===_0x4cf2cd)try{const _0x29ecdc=await this[_0x15eb23(0x26e)][_0x15eb23(0x248)](_0xfc1036['id']);if(_0x29ecdc[_0x15eb23(0x1eb)][_0x15eb23(0x266)]===_0x4cf2cd)return _0x29ecdc;}catch{}}const _0x4c8322=await this['client'][_0x15eb23(0x20b)](),_0x46bc28=_0x4c8322['find'](_0x153690=>_0x153690[_0x15eb23(0x1eb)]['name']===_0x4cf2cd);if(_0x46bc28)return!_0x52e60b&&writeCachedLLMProject(_0x4cf2cd,_0x46bc28['id'],_0x4140ad),_0x46bc28;const _0x1e744b=await this[_0x15eb23(0x26e)][_0x15eb23(0x28f)]({'name':_0x4cf2cd,'description':_0x15eb23(0x201)+getSanitizedUsername()+')'});return!_0x52e60b&&writeCachedLLMProject(_0x4cf2cd,_0x1e744b['id'],_0x4140ad),_0x1e744b;}async[a96_0x5d9617(0x260)](_0x4e024b){const _0x10eafb=a96_0x5d9617,_0x176d07=await this[_0x10eafb(0x26e)][_0x10eafb(0x20b)](),_0x2268d3=_0x176d07[_0x10eafb(0x20e)](_0x5bfd7a=>_0x5bfd7a[_0x10eafb(0x1eb)][_0x10eafb(0x266)]===_0x4e024b);if(_0x2268d3[_0x10eafb(0x219)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x10eafb(0x19c)+_0x4e024b,undefined,{'helpText':_0x10eafb(0x1cd)});if(_0x2268d3['length']>0x1)throw new SDKError(ErrorCode[_0x10eafb(0x202)],_0x10eafb(0x1b3)+_0x4e024b+_0x10eafb(0x21a));return _0x2268d3[0x0]['id'];}async['resolveProjectName'](_0x1e7264){const _0x2103d4=a96_0x5d9617,_0x4df0fe=await this[_0x2103d4(0x26e)][_0x2103d4(0x20b)](),_0x2f9193=_0x4df0fe[_0x2103d4(0x255)](_0x131721=>_0x131721[_0x2103d4(0x1eb)][_0x2103d4(0x266)]===_0x1e7264);if(_0x2f9193)return{'projectId':_0x2f9193['id'],'project':_0x2f9193};throw new SDKError(ErrorCode[_0x2103d4(0x1a1)],_0x2103d4(0x19c)+_0x1e7264,undefined,{'helpText':_0x2103d4(0x1cd)});}async[a96_0x5d9617(0x1d4)](_0x49e945='claude-4.5-sonnet',_0x29727c=0x0,_0x7b0a36){const _0x57c1de=a96_0x5d9617,_0x52a6b8=0xa;let _0x202e5c=0x0,_0x2cdd51;while(_0x202e5c<_0x52a6b8){try{const _0xd3ebe=await this[_0x57c1de(0x27a)](_0x2cdd51),_0x225cf3=_0xd3ebe['id'],_0xfacfc9=[_0x57c1de(0x229),_0x57c1de(0x1d2),_0x57c1de(0x195),'medium','high'],_0x1ba78b=_0x29727c===0x0?_0x57c1de(0x1d1)+_0x49e945:_0x57c1de(0x1d1)+_0x49e945+'_reasoning_'+_0xfacfc9[_0x29727c],_0x56be10=await this['client'][_0x57c1de(0x1a2)](_0x225cf3),_0xb2b48e=_0x56be10[_0x57c1de(0x255)](_0x169c60=>_0x169c60[_0x57c1de(0x1eb)][_0x57c1de(0x266)]===_0x1ba78b);if(_0xb2b48e)return _0xb2b48e;const _0x2ecdf1=_0x29727c>0x0?0x1:_0x7b0a36;return await this[_0x57c1de(0x26e)][_0x57c1de(0x28a)]({'name':_0x1ba78b,'projectId':_0x225cf3,'modelType':_0x49e945,'systemPrompt':'','temperature':_0x2ecdf1,'reasoningEffort':_0x29727c>0x0?_0x29727c:undefined});}catch(_0x2e1d6f){if(_0x2e1d6f instanceof HTTPClientError){const _0x121d7e=_0x2e1d6f[_0x57c1de(0x1fa)];if(_0x121d7e>=0x190&&_0x121d7e<0x1f4){if(_0x121d7e===0x191)throw new SDKError(ErrorCode[_0x57c1de(0x242)],_0x57c1de(0x247),_0x2e1d6f);else{if(_0x121d7e===0x193)throw new SDKError(ErrorCode[_0x57c1de(0x253)],_0x57c1de(0x22c),_0x2e1d6f);}throw _0x2e1d6f;}}if(errorContains(_0x2e1d6f,_0x57c1de(0x26d),_0x57c1de(0x1f5),_0x57c1de(0x1b4))){_0x202e5c++;if(_0x202e5c>=_0x52a6b8)throw new SDKError(ErrorCode[_0x57c1de(0x1c0)],_0x57c1de(0x292)+_0x52a6b8+_0x57c1de(0x19b),_0x2e1d6f);const _0x407df4=this[_0x57c1de(0x26c)]();_0x2cdd51=_0x407df4+'_'+generateRandomHex();continue;}throw _0x2e1d6f;}}throw new SDKError(ErrorCode['INTERNAL'],_0x57c1de(0x23a));}async['resolveAgentId'](_0x840679,_0x38acfb){const _0x20ed9c=a96_0x5d9617,_0x21a5a1=_0x38acfb||this[_0x20ed9c(0x210)],_0xec5db3=await this[_0x20ed9c(0x26e)][_0x20ed9c(0x1a2)](_0x21a5a1),_0x3efc04=_0xec5db3[_0x20ed9c(0x20e)](_0x477a2f=>_0x477a2f[_0x20ed9c(0x1eb)]['name']===_0x840679);if(_0x3efc04[_0x20ed9c(0x219)]===0x0){const _0x47f871=_0x21a5a1?'\x20in\x20project\x20'+_0x21a5a1:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x20ed9c(0x1b2)+_0x840679+_0x47f871,undefined,{'helpText':_0x21a5a1?_0x20ed9c(0x1b1):_0x20ed9c(0x24f)});}if(_0x3efc04['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x20ed9c(0x187)+_0x840679+_0x20ed9c(0x21a));return _0x3efc04[0x0]['id'];}async['agents'](_0x4be4a5){const _0x2c64f0=a96_0x5d9617,_0x34ced6=_0x4be4a5||this[_0x2c64f0(0x210)];return await this[_0x2c64f0(0x26e)]['listAgents'](_0x34ced6);}async[a96_0x5d9617(0x1ce)](_0xff64a){const _0x2b6879=a96_0x5d9617;return await this[_0x2b6879(0x26e)][_0x2b6879(0x250)](_0xff64a);}async['agent'](_0x3f3c45){const _0x3d624c=a96_0x5d9617;return await this[_0x3d624c(0x26e)][_0x3d624c(0x1a0)](_0x3f3c45);}async['createAgent'](_0x388b0c){const _0x395c71=a96_0x5d9617;return await this['client'][_0x395c71(0x28a)](_0x388b0c);}async[a96_0x5d9617(0x18f)](_0x27b0ae,_0x221ff3){return await this['client']['updateAgent'](_0x27b0ae,_0x221ff3);}async[a96_0x5d9617(0x1c9)](_0x3aeb8b){const _0x33ebf1=a96_0x5d9617;await this[_0x33ebf1(0x26e)][_0x33ebf1(0x1c9)](_0x3aeb8b);}async[a96_0x5d9617(0x25a)](_0x79bd2a){const _0x74aa07=a96_0x5d9617;return await this[_0x74aa07(0x26e)]['startChat']({'agentId':_0x79bd2a});}async*[a96_0x5d9617(0x1de)](_0x2a6b98,_0x4bcb38){const _0x2150e1=a96_0x5d9617;let _0x3c5aa6=_0x4bcb38?.[_0x2150e1(0x1ed)];const _0xda4651=_0x4bcb38?.[_0x2150e1(0x192)];if(!_0x3c5aa6){if(!_0xda4651)throw new Error(_0x2150e1(0x218));const _0x4c6abf=await this[_0x2150e1(0x26e)][_0x2150e1(0x25a)]({'agentId':_0xda4651});_0x3c5aa6=_0x4c6abf['id'],yield{'type':_0x2150e1(0x180),'data':{'chatId':_0x3c5aa6,'agentId':_0xda4651,'projectId':_0x4c6abf[_0x2150e1(0x1eb)]['projectId']}};}for await(const _0x38ec50 of this[_0x2150e1(0x26e)][_0x2150e1(0x226)](_0x3c5aa6,_0x2a6b98,_0x4bcb38?.[_0x2150e1(0x1fc)])){yield{'type':'event','data':_0x38ec50};}}async['chats'](_0xa0466e=0x32){const _0x2bcd82=a96_0x5d9617;return await this[_0x2bcd82(0x26e)][_0x2bcd82(0x24d)](_0xa0466e);}async['history'](_0x19a3d9){const _0x3e896a=a96_0x5d9617;return await this[_0x3e896a(0x26e)][_0x3e896a(0x220)](_0x19a3d9);}async[a96_0x5d9617(0x182)](_0x1198d1){const _0x4b4fb4=a96_0x5d9617;return await this[_0x4b4fb4(0x26e)][_0x4b4fb4(0x182)](_0x1198d1);}async['chatInfo'](_0x4af85d){const _0x370908=a96_0x5d9617;return await this[_0x370908(0x26e)][_0x370908(0x244)](_0x4af85d);}async[a96_0x5d9617(0x1bf)](_0x2df71a,_0x38889d,_0x59e300){const _0x2689b9=a96_0x5d9617,_0x134dee=_0x59e300?.['dryRun']??![],{projectId:_0x2ac36f,project:_0x382b18}=await this['resolveProjectName'](_0x2df71a),_0x282176=_0x382b18[_0x2689b9(0x1eb)][_0x2689b9(0x266)],_0xcee911=_0x38889d||_0x282176+_0x2689b9(0x278);if(a96_0x1974b2['existsSync'](_0xcee911)&&!_0x134dee)throw new SDKError(ErrorCode[_0x2689b9(0x1c0)],_0x2689b9(0x1d9)+_0xcee911,undefined,{'helpText':_0x2689b9(0x1c7)});const _0x5d719d=await this[_0x2689b9(0x26e)]['listAgentsFull'](_0x2ac36f),_0x3b336e=await this[_0x2689b9(0x26e)][_0x2689b9(0x1cb)](_0x2ac36f),_0x2d291d=await this[_0x2689b9(0x26e)][_0x2689b9(0x1c4)](_0x2ac36f),_0x57c742=await this[_0x2689b9(0x26e)][_0x2689b9(0x276)](_0x2ac36f);if(!_0x134dee){a96_0x1974b2[_0x2689b9(0x19e)](_0xcee911,{'recursive':!![]});const _0x59dad7={'version':'1.0','exportedAt':new Date()[_0x2689b9(0x22b)](),'exportedFrom':{'site':this[_0x2689b9(0x286)][_0x2689b9(0x287)],'projectId':_0x2ac36f,'projectName':_0x282176},'project':_0x382b18};a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78['join'](_0xcee911,'project.json'),JSON[_0x2689b9(0x1cf)](_0x59dad7,null,0x2)),a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78['join'](_0xcee911,_0x2689b9(0x1b0)),JSON[_0x2689b9(0x1cf)](_0x5d719d,null,0x2)),a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78['join'](_0xcee911,_0x2689b9(0x27f)),JSON[_0x2689b9(0x1cf)](_0x3b336e,null,0x2)),a96_0x1974b2['writeFileSync'](a96_0xa96e78['join'](_0xcee911,'prompts.json'),JSON['stringify'](_0x2d291d,null,0x2)),a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78[_0x2689b9(0x237)](_0xcee911,'integrations.json'),JSON['stringify'](_0x57c742,null,0x2));}return{'projectName':_0x282176,'outputDir':_0xcee911,'counts':{'agents':_0x5d719d['length'],'knowledgeBases':_0x3b336e[_0x2689b9(0x219)],'prompts':_0x2d291d[_0x2689b9(0x219)],'integrations':_0x57c742[_0x2689b9(0x219)]}};}async[a96_0x5d9617(0x289)](_0x51cab0,_0x37eafa){const _0x458e4d=a96_0x5d9617,_0x3efc29=_0x37eafa?.[_0x458e4d(0x184)]??![],_0x34018d=this[_0x458e4d(0x216)](_0x51cab0),_0x225f0d=_0x34018d['exportedFrom'][_0x458e4d(0x287)],_0x5bca7a=this[_0x458e4d(0x286)][_0x458e4d(0x287)],_0x58b452=_0x225f0d!==_0x5bca7a?_0x225f0d:undefined,_0x202129=this[_0x458e4d(0x1fb)](a96_0xa96e78['join'](_0x51cab0,_0x458e4d(0x1b0)),[]),_0x2f9d1f=this[_0x458e4d(0x1fb)](a96_0xa96e78['join'](_0x51cab0,_0x458e4d(0x27f)),[]),_0x447d57=this[_0x458e4d(0x1fb)](a96_0xa96e78[_0x458e4d(0x237)](_0x51cab0,_0x458e4d(0x1f7)),[]),_0x339316=this[_0x458e4d(0x1fb)](a96_0xa96e78[_0x458e4d(0x237)](_0x51cab0,_0x458e4d(0x1c3)),[]),_0x17888c=_0x37eafa?.['name']||_0x34018d[_0x458e4d(0x1a5)][_0x458e4d(0x1e1)];if(_0x3efc29){const _0x4c432d=new Map(),_0x270e7e=[..._0x202129],_0x46e815=_0x202129[_0x458e4d(0x219)]+0x1;let _0x67d146=0x0;while(_0x270e7e['length']>0x0&&_0x67d146<_0x46e815){_0x67d146++;const _0x11261a=[];for(const _0x35ed9a of _0x270e7e){canCreateAgent(_0x35ed9a,_0x4c432d)?_0x4c432d[_0x458e4d(0x203)](_0x35ed9a['id'],_0x458e4d(0x243)+_0x35ed9a['id']):_0x11261a[_0x458e4d(0x211)](_0x35ed9a);}if(_0x11261a[_0x458e4d(0x219)]===_0x270e7e[_0x458e4d(0x219)])throw new SDKError(ErrorCode[_0x458e4d(0x202)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x270e7e[_0x458e4d(0x219)]=0x0,_0x270e7e[_0x458e4d(0x211)](..._0x11261a);}const _0x116c08=_0x447d57[_0x458e4d(0x20e)](_0x5d24a4=>_0x4c432d['has'](_0x5d24a4[_0x458e4d(0x1eb)][_0x458e4d(0x192)]))['length'];return{'projectName':_0x17888c,'projectId':_0x458e4d(0x241),'counts':{'agents':_0x202129[_0x458e4d(0x219)],'knowledgeBases':_0x2f9d1f[_0x458e4d(0x219)],'prompts':_0x116c08,'integrations':_0x339316[_0x458e4d(0x219)]},'sourceSite':_0x58b452};}const _0x27584e=await this[_0x458e4d(0x26e)][_0x458e4d(0x28f)]({'name':_0x17888c,'description':_0x34018d['project'][_0x458e4d(0x1eb)][_0x458e4d(0x277)]}),_0xc02048=_0x27584e['id'],_0x17e87e=new Map(),_0x41e96d=new Map(),_0x4d0634=new Map();for(const _0x56528b of _0x2f9d1f){const _0x5a20d6=await this[_0x458e4d(0x26e)][_0x458e4d(0x1fd)]({'projectId':_0xc02048,'name':_0x56528b['attributes'][_0x458e4d(0x266)],'tdDatabaseName':_0x56528b['attributes'][_0x458e4d(0x223)],'tables':_0x56528b[_0x458e4d(0x1eb)][_0x458e4d(0x288)]});_0x17e87e['set'](_0x56528b['id'],_0x5a20d6['id']);}const _0x42ea6d=[..._0x202129],_0x29f18e=_0x202129['length']+0x1;let _0xa55e0=0x0;while(_0x42ea6d['length']>0x0&&_0xa55e0<_0x29f18e){_0xa55e0++;const _0x1f5d50=[];for(const _0x4d008 of _0x42ea6d){if(canCreateAgent(_0x4d008,_0x41e96d)){const _0x4433f4=remapToolIds(_0x4d008[_0x458e4d(0x1eb)]['tools'],_0x17e87e,_0x41e96d),_0x487562=remapVariableIds(_0x4d008['attributes'][_0x458e4d(0x1db)],_0x17e87e),_0x39734f=await this[_0x458e4d(0x26e)][_0x458e4d(0x23c)]({'name':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x266)],'projectId':_0xc02048,'systemPrompt':_0x4d008[_0x458e4d(0x1eb)]['systemPrompt'],'starterMessage':_0x4d008[_0x458e4d(0x1eb)]['starterMessage'],'modelType':migrateModelType(_0x4d008['attributes'][_0x458e4d(0x1f3)]),'maxToolIterations':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x236)],'temperature':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x1d3)],'reasoningEffort':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x1fe)],'outputs':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x24e)],'tools':_0x4433f4,'variables':_0x487562});_0x41e96d[_0x458e4d(0x203)](_0x4d008['id'],_0x39734f['id']);}else _0x1f5d50[_0x458e4d(0x211)](_0x4d008);}if(_0x1f5d50['length']===_0x42ea6d['length'])throw new SDKError(ErrorCode[_0x458e4d(0x202)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x458e4d(0x263)});_0x42ea6d[_0x458e4d(0x219)]=0x0,_0x42ea6d['push'](..._0x1f5d50);}for(const _0x31f2f9 of _0x447d57){const _0x110075=_0x41e96d[_0x458e4d(0x1c6)](_0x31f2f9[_0x458e4d(0x1eb)][_0x458e4d(0x192)]);if(!_0x110075)continue;const _0x5bc236=await this[_0x458e4d(0x26e)]['createPrompt']({'projectId':_0xc02048,'agentId':_0x110075,'name':_0x31f2f9[_0x458e4d(0x1eb)][_0x458e4d(0x266)],'systemPrompt':_0x31f2f9[_0x458e4d(0x1eb)]['systemPrompt'],'template':_0x31f2f9[_0x458e4d(0x1eb)]['template'],'jsonSchemaHint':_0x31f2f9[_0x458e4d(0x1eb)][_0x458e4d(0x28e)]});_0x4d0634[_0x458e4d(0x203)](_0x31f2f9['id'],_0x5bc236['id']);}for(const _0x5d02fd of _0x339316){const _0xd82e7c=_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x1b8)][_0x458e4d(0x28b)](_0x42c844=>({..._0x42c844,'promptId':_0x4d0634['get'](_0x42c844['promptId'])||_0x42c844[_0x458e4d(0x188)]}));await this[_0x458e4d(0x26e)][_0x458e4d(0x23d)]({'projectId':_0xc02048,'serviceType':_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x19a)],'actions':_0xd82e7c,'slackMessageMode':_0x5d02fd['attributes'][_0x458e4d(0x24b)],'chatIgnoreManagedActions':_0x5d02fd['attributes']['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x208)],'webhookCorsOrigins':_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x1a8)]});}return{'projectName':_0x17888c,'projectId':_0xc02048,'counts':{'agents':_0x41e96d[_0x458e4d(0x193)],'knowledgeBases':_0x17e87e[_0x458e4d(0x193)],'prompts':_0x4d0634['size'],'integrations':_0x339316[_0x458e4d(0x219)]},'sourceSite':_0x58b452};}[a96_0x5d9617(0x1fb)](_0x277d13,_0x16fbdd){const _0x11c758=a96_0x5d9617;if(!a96_0x1974b2[_0x11c758(0x1b5)](_0x277d13))return _0x16fbdd;return JSON[_0x11c758(0x1f1)](a96_0x1974b2[_0x11c758(0x1af)](_0x277d13,_0x11c758(0x26f)));}['getBackupMetadata'](_0x59934a){const _0x2c1bfa=a96_0x5d9617;if(!a96_0x1974b2[_0x2c1bfa(0x1b5)](_0x59934a))throw new SDKError(ErrorCode['NOT_FOUND'],_0x2c1bfa(0x21d)+_0x59934a,undefined,{'helpText':_0x2c1bfa(0x285)});const _0x14e559=a96_0xa96e78['join'](_0x59934a,_0x2c1bfa(0x18b));if(!a96_0x1974b2['existsSync'](_0x14e559))throw new SDKError(ErrorCode[_0x2c1bfa(0x21f)],_0x2c1bfa(0x1dc)+_0x59934a,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x48ccd7=JSON[_0x2c1bfa(0x1f1)](a96_0x1974b2['readFileSync'](_0x14e559,'utf-8'));if(!isSupportedBackupVersion(_0x48ccd7[_0x2c1bfa(0x269)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2c1bfa(0x1ac)+_0x48ccd7[_0x2c1bfa(0x269)],undefined,{'helpText':_0x2c1bfa(0x20a)});return _0x48ccd7;}async['pullProject'](_0x2c99fb,_0x3bc890,_0x4be00f){const _0x5a935c=a96_0x5d9617,{projectId:_0x5a3f8f,project:_0x1ca199}=await this[_0x5a935c(0x22a)](_0x2c99fb),_0x538242=_0x1ca199[_0x5a935c(0x1eb)][_0x5a935c(0x266)];let _0x208c69;if(_0x3bc890)_0x208c69=_0x3bc890;else{const _0x45b21e=a96_0xa96e78[_0x5a935c(0x237)](process[_0x5a935c(0x199)](),'agents'),_0x260058=getSanitizedPathWithMigration(_0x45b21e,_0x538242);_0x260058[_0x5a935c(0x25e)]&&this[_0x5a935c(0x282)][_0x5a935c(0x1c1)](_0x5a935c(0x1ab)+a96_0xa96e78[_0x5a935c(0x21e)](_0x260058[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x260058[_0x5a935c(0x246)])),_0x208c69=_0x260058[_0x5a935c(0x246)];}const _0x144b6e=await this[_0x5a935c(0x26e)][_0x5a935c(0x250)](_0x5a3f8f),_0x15b792=await this['client'][_0x5a935c(0x1cb)](_0x5a3f8f),_0x273378=await this[_0x5a935c(0x26e)]['listTextKnowledgeBases'](_0x5a3f8f),_0x58fa0d=await this[_0x5a935c(0x26e)][_0x5a935c(0x1dd)](_0x5a3f8f),_0x172f70=await this[_0x5a935c(0x26e)][_0x5a935c(0x281)](_0x5a3f8f),_0x2d1302=await this[_0x5a935c(0x26e)][_0x5a935c(0x1c4)](_0x5a3f8f),_0x466fb5=await this[_0x5a935c(0x26e)]['listIntegrations'](_0x5a3f8f),_0x587ca0=await this[_0x5a935c(0x26e)][_0x5a935c(0x275)](_0x5a3f8f),_0x1a18b2=await this[_0x5a935c(0x26e)][_0x5a935c(0x265)](_0x5a3f8f),_0x56fa75=_0x466fb5['filter'](_0x4f9274=>!_0x4f9274['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES[_0x5a935c(0x1ec)](_0x4f9274[_0x5a935c(0x1eb)][_0x5a935c(0x19a)][_0x5a935c(0x1f9)]())),_0x5af258=new Map(),_0x4048bc=new Map(),_0x3efd1a=new Map(),_0x4a4c2d=new Map(),_0x3102bd=new Map(),_0x3ed2c7=new Map(),_0x4cf0ea=new Map();for(const _0x2028d6 of _0x144b6e){_0x5af258['set'](_0x2028d6['id'],_0x2028d6['attributes'][_0x5a935c(0x266)]);}for(const _0x266c83 of _0x15b792){_0x4048bc[_0x5a935c(0x203)](_0x266c83['id'],_0x266c83[_0x5a935c(0x1eb)]['name']);}for(const _0x1c2edc of _0x273378){_0x3efd1a['set'](_0x1c2edc['id'],_0x1c2edc[_0x5a935c(0x1eb)]['name']);}for(const _0x563565 of _0x58fa0d){_0x4a4c2d[_0x5a935c(0x203)](_0x563565['id'],_0x563565[_0x5a935c(0x1eb)]['name']);}for(const _0x57a755 of _0x172f70){_0x3102bd[_0x5a935c(0x203)](_0x57a755['id'],_0x57a755[_0x5a935c(0x1eb)]['name']);}for(const _0x603d8b of _0x2d1302){_0x3ed2c7[_0x5a935c(0x203)](_0x603d8b['id'],_0x603d8b['attributes'][_0x5a935c(0x266)]);}for(const _0x34ef34 of _0x587ca0){_0x4cf0ea['set'](_0x34ef34['id'],_0x34ef34[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);}const _0x45af7c={'resolveKnowledgeBaseName':async _0x54816a=>_0x4048bc[_0x5a935c(0x1c6)](_0x54816a),'resolveTextKnowledgeBaseName':async _0x58d48f=>_0x3efd1a[_0x5a935c(0x1c6)](_0x58d48f),'resolveAgentName':async _0x3072da=>_0x5af258[_0x5a935c(0x1c6)](_0x3072da),'resolveWebSearchToolName':async _0x518af0=>_0x3102bd[_0x5a935c(0x1c6)](_0x518af0),'resolveImageGeneratorName':async _0x2ff197=>_0x4a4c2d[_0x5a935c(0x1c6)](_0x2ff197),'resolvePromptName':async _0x31d90b=>_0x3ed2c7[_0x5a935c(0x1c6)](_0x31d90b),'resolveExperimentalKnowledgeBaseName':async _0xe11cde=>_0x4cf0ea[_0x5a935c(0x1c6)](_0xe11cde),'onWarning':_0x59bbfd=>this[_0x5a935c(0x282)][_0x5a935c(0x290)](_0x59bbfd)},_0x55e600={'projectName':_0x538242,'outputDir':_0x208c69,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0xb7f8d7=[],_0x5294b6=[];for(const _0x26d732 of _0x144b6e){const _0x6460d=getSanitizedPathWithMigration(_0x208c69,_0x26d732[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);_0x6460d[_0x5a935c(0x25e)]&&this['logger'][_0x5a935c(0x1c1)]('Renamed\x20agent\x20folder:\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x6460d[_0x5a935c(0x18c)])+'\x20→\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x6460d[_0x5a935c(0x246)]));const _0x48e556=_0x6460d[_0x5a935c(0x246)],_0x1a3bb2=a96_0xa96e78['join'](_0x48e556,'prompt.md'),_0x15ccb0=a96_0xa96e78[_0x5a935c(0x237)](_0x48e556,_0x5a935c(0x264)),_0x36e747=a96_0xa96e78[_0x5a935c(0x237)](_0x48e556,_0x5a935c(0x261)),{yaml:_0x5bb8ee,systemPrompt:_0x5356b0,starterMessage:_0x40a507}=await agentResponseToDef(_0x26d732,_0x45af7c),_0x27ab0e=toAgentYamlString(_0x5bb8ee),_0x1e9ac6=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x15ccb0);let _0x33c3d0=_0x1e9ac6,_0x8334c5;if(!_0x1e9ac6){const _0x3679ea=a96_0x1974b2[_0x5a935c(0x1b5)](_0x1a3bb2)?a96_0x1974b2[_0x5a935c(0x1af)](_0x1a3bb2,_0x5a935c(0x26f)):'',_0x541a2a=a96_0x1974b2[_0x5a935c(0x1af)](_0x15ccb0,_0x5a935c(0x26f)),_0x4994e1='#\x20prompt.md\x0a'+_0x3679ea+'\x0a\x0a#\x20agent.yml\x0a'+_0x541a2a,_0x45e35b=_0x5a935c(0x254)+_0x5356b0+_0x5a935c(0x190)+_0x27ab0e,_0x44a12f=generateDiff(_0x4994e1,_0x45e35b);_0x33c3d0=hasChanges(_0x44a12f),_0x33c3d0&&(_0x8334c5=formatDiffWithColors(_0x44a12f));}_0xb7f8d7['push']({'path':_0x48e556,'content':'','isDir':!![]}),_0xb7f8d7['push']({'path':_0x1a3bb2,'content':_0x5356b0}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x15ccb0,'content':_0x27ab0e});_0x40a507&&_0x40a507['includes']('\x0a')&&_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x36e747,'content':_0x40a507});_0x55e600[_0x5a935c(0x1e3)][_0x5a935c(0x211)]({'agentName':_0x26d732[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'outputPath':_0x48e556,'isNew':_0x1e9ac6,'hasChanges':_0x33c3d0,'diff':_0x8334c5}),_0x55e600['counts'][_0x5a935c(0x1e3)][_0x5a935c(0x1d0)]++;if(_0x1e9ac6)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e3)]['new']++;else{if(_0x33c3d0)_0x55e600['counts'][_0x5a935c(0x1e3)]['updated']++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e3)]['unchanged']++;}}for(const _0x1003a1 of _0x15b792){if(_0x1003a1[_0x5a935c(0x1eb)][_0x5a935c(0x227)])continue;const _0x1a4882=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x208c69),_0x1003a1[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'.yml');_0x1a4882['renamed']&&this['logger']['info'](_0x5a935c(0x249)+a96_0xa96e78[_0x5a935c(0x21e)](_0x1a4882[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x1a4882[_0x5a935c(0x246)]));const _0x4297d7=_0x1a4882[_0x5a935c(0x246)],_0x2057ba=apiKnowledgeBaseToYaml(_0x1003a1),_0x34854a=toKnowledgeBaseYamlString(_0x2057ba),_0xd53456=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x4297d7);let _0x207c8b=_0xd53456,_0x2ba79a;if(!_0xd53456){const _0x184c97=a96_0x1974b2[_0x5a935c(0x1af)](_0x4297d7,'utf-8'),_0x2d2271=generateDiff(_0x184c97,_0x34854a);_0x207c8b=hasChanges(_0x2d2271),_0x207c8b&&(_0x2ba79a=formatDiffWithColors(_0x2d2271));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x4297d7,'content':_0x34854a}),_0x55e600[_0x5a935c(0x283)]['push']({'name':_0x1003a1[_0x5a935c(0x1eb)]['name'],'outputPath':_0x4297d7,'isNew':_0xd53456,'hasChanges':_0x207c8b,'diff':_0x2ba79a}),_0x55e600[_0x5a935c(0x234)]['knowledgeBases'][_0x5a935c(0x1d0)]++;if(_0xd53456)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x283)][_0x5a935c(0x28c)]++;else{if(_0x207c8b)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x283)][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x283)][_0x5a935c(0x238)]++;}}for(const _0x45c750 of _0x273378){if(_0x45c750['attributes'][_0x5a935c(0x227)])continue;const _0x40a51e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x208c69),_0x45c750['attributes'][_0x5a935c(0x266)],'.md');_0x40a51e[_0x5a935c(0x25e)]&&this[_0x5a935c(0x282)]['info']('Renamed\x20text\x20KB\x20file:\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x40a51e[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x40a51e['path']));const _0x3ec65d=_0x40a51e['path'],_0x384932=toTextKnowledgeBaseMd(_0x45c750['attributes']['name'],_0x45c750[_0x5a935c(0x1eb)][_0x5a935c(0x206)]),_0x617ad3=!a96_0x1974b2['existsSync'](_0x3ec65d);let _0x51f6bc=_0x617ad3,_0x2ba933;if(!_0x617ad3){const _0x427129=a96_0x1974b2['readFileSync'](_0x3ec65d,_0x5a935c(0x26f)),_0x2eeb89=generateDiff(_0x427129,_0x384932);_0x51f6bc=hasChanges(_0x2eeb89),_0x51f6bc&&(_0x2ba933=formatDiffWithColors(_0x2eeb89));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x3ec65d,'content':_0x384932}),_0x55e600['textKnowledgeBases'][_0x5a935c(0x211)]({'name':_0x45c750['attributes'][_0x5a935c(0x266)],'outputPath':_0x3ec65d,'isNew':_0x617ad3,'hasChanges':_0x51f6bc,'diff':_0x2ba933}),_0x55e600['counts'][_0x5a935c(0x212)][_0x5a935c(0x1d0)]++;if(_0x617ad3)_0x55e600['counts'][_0x5a935c(0x212)]['new']++;else{if(_0x51f6bc)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x212)][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x212)][_0x5a935c(0x238)]++;}}for(const _0x3c5cad of _0x2d1302){if(_0x3c5cad[_0x5a935c(0x1eb)][_0x5a935c(0x227)])continue;const _0x4b3c63=getSanitizedPathWithMigration(getPromptsDir(_0x208c69),_0x3c5cad[_0x5a935c(0x1eb)][_0x5a935c(0x266)],_0x5a935c(0x1ee));_0x4b3c63[_0x5a935c(0x25e)]&&this['logger']['info'](_0x5a935c(0x1c5)+a96_0xa96e78[_0x5a935c(0x21e)](_0x4b3c63['oldPath'])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x4b3c63['path']));const _0x11b06d=_0x4b3c63[_0x5a935c(0x246)],_0x3e1b6a=await apiPromptToYaml(_0x3c5cad,_0x45af7c);if(!_0x3e1b6a)continue;const _0x3f5180=toPromptYamlString(_0x3e1b6a),_0x32afb6=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x11b06d);let _0x2de6d1=_0x32afb6,_0x5f5445;if(!_0x32afb6){const _0x1e8d3d=a96_0x1974b2[_0x5a935c(0x1af)](_0x11b06d,_0x5a935c(0x26f)),_0x253156=generateDiff(_0x1e8d3d,_0x3f5180);_0x2de6d1=hasChanges(_0x253156),_0x2de6d1&&(_0x5f5445=formatDiffWithColors(_0x253156));}_0xb7f8d7['push']({'path':_0x11b06d,'content':_0x3f5180}),_0x55e600[_0x5a935c(0x1e9)][_0x5a935c(0x211)]({'name':_0x3c5cad[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'outputPath':_0x11b06d,'isNew':_0x32afb6,'hasChanges':_0x2de6d1,'diff':_0x5f5445}),_0x55e600[_0x5a935c(0x234)]['prompts']['total']++;if(_0x32afb6)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e9)][_0x5a935c(0x28c)]++;else{if(_0x2de6d1)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e9)]['updated']++;else _0x55e600[_0x5a935c(0x234)]['prompts'][_0x5a935c(0x238)]++;}}for(const _0x38db5f of _0x56fa75){const _0x405fdc=_0x38db5f['attributes'][_0x5a935c(0x19a)][_0x5a935c(0x1f9)](),_0x44420b=getSanitizedPathWithMigration(getIntegrationsDir(_0x208c69),_0x405fdc,'.yml');_0x44420b[_0x5a935c(0x25e)]&&this[_0x5a935c(0x282)][_0x5a935c(0x1c1)](_0x5a935c(0x209)+a96_0xa96e78['basename'](_0x44420b[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x44420b[_0x5a935c(0x246)]));const _0x37f40b=_0x44420b[_0x5a935c(0x246)],_0x4e5643=await apiIntegrationToYaml(_0x38db5f,_0x45af7c),_0x369a58=toIntegrationYamlString(_0x4e5643),_0x28f974=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x37f40b);let _0x39de85=_0x28f974,_0x1e7e00;if(!_0x28f974){const _0x33e52b=a96_0x1974b2[_0x5a935c(0x1af)](_0x37f40b,'utf-8'),_0x16fdd5=generateDiff(_0x33e52b,_0x369a58);_0x39de85=hasChanges(_0x16fdd5),_0x39de85&&(_0x1e7e00=formatDiffWithColors(_0x16fdd5));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x37f40b,'content':_0x369a58}),_0x55e600['integrations'][_0x5a935c(0x211)]({'name':_0x405fdc,'outputPath':_0x37f40b,'isNew':_0x28f974,'hasChanges':_0x39de85,'diff':_0x1e7e00}),_0x55e600[_0x5a935c(0x234)]['integrations'][_0x5a935c(0x1d0)]++;if(_0x28f974)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x26a)][_0x5a935c(0x28c)]++;else{if(_0x39de85)_0x55e600['counts'][_0x5a935c(0x26a)][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x26a)][_0x5a935c(0x238)]++;}}for(const _0x17450e of _0x587ca0){if(_0x17450e[_0x5a935c(0x1eb)][_0x5a935c(0x227)])continue;const _0x4717d7=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x208c69),_0x17450e[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);_0x4717d7[_0x5a935c(0x25e)]&&this['logger'][_0x5a935c(0x1c1)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a96_0xa96e78['basename'](_0x4717d7[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x4717d7[_0x5a935c(0x246)]));const _0x2d4225=_0x4717d7[_0x5a935c(0x246)],_0x10c830=a96_0xa96e78[_0x5a935c(0x237)](_0x2d4225,sanitizeForFilesystem(_0x17450e[_0x5a935c(0x1eb)][_0x5a935c(0x266)])+'.yml'),_0x486c7d=a96_0xa96e78[_0x5a935c(0x237)](_0x2d4225,_0x5a935c(0x1e7)),_0x1dba3a=apiExperimentalKnowledgeBaseToYaml(_0x17450e),_0x526452=toExperimentalKnowledgeBaseYamlString(_0x1dba3a),_0x3d6c2d=!a96_0x1974b2['existsSync'](_0x2d4225);let _0x49d8fb=_0x3d6c2d,_0x3b0118,_0x510980=_0x526452;const _0x2d7488=[..._0x1dba3a[_0x5a935c(0x1e7)]][_0x5a935c(0x22e)]((_0x452dcd,_0x27d652)=>_0x452dcd['name'][_0x5a935c(0x1e6)](_0x27d652[_0x5a935c(0x266)]));for(const _0x535233 of _0x2d7488){_0x510980+='\x0a---\x20function:\x20'+_0x535233[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+_0x535233[_0x5a935c(0x235)]+'\x0a---\x20schema:\x20'+_0x535233[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+_0x535233[_0x5a935c(0x1f2)]+'\x0a';}if(!_0x3d6c2d){let _0x4377cb='';a96_0x1974b2['existsSync'](_0x10c830)&&(_0x4377cb=a96_0x1974b2[_0x5a935c(0x1af)](_0x10c830,_0x5a935c(0x26f)));if(a96_0x1974b2[_0x5a935c(0x1b5)](_0x486c7d)){const _0x41ac70=a96_0x1974b2['readdirSync'](_0x486c7d,{'withFileTypes':!![]}),_0x59ac56=_0x41ac70[_0x5a935c(0x20e)](_0x7c5fa1=>_0x7c5fa1[_0x5a935c(0x22f)]())[_0x5a935c(0x22e)]((_0x5c7aa7,_0x49dc01)=>_0x5c7aa7[_0x5a935c(0x266)][_0x5a935c(0x1e6)](_0x49dc01[_0x5a935c(0x266)]));for(const _0x1fab17 of _0x59ac56){const _0x3dd648=a96_0xa96e78[_0x5a935c(0x237)](_0x486c7d,_0x1fab17[_0x5a935c(0x266)],'code.js'),_0x46dd02=a96_0xa96e78['join'](_0x486c7d,_0x1fab17[_0x5a935c(0x266)],_0x5a935c(0x27b));a96_0x1974b2['existsSync'](_0x3dd648)&&(_0x4377cb+='\x0a---\x20function:\x20'+_0x1fab17[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+a96_0x1974b2['readFileSync'](_0x3dd648,_0x5a935c(0x26f))+'\x0a'),a96_0x1974b2[_0x5a935c(0x1b5)](_0x46dd02)&&(_0x4377cb+='---\x20schema:\x20'+_0x1fab17[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+a96_0x1974b2[_0x5a935c(0x1af)](_0x46dd02,'utf-8')+'\x0a');}}const _0x14ee0e=generateDiff(_0x4377cb,_0x510980);_0x49d8fb=hasChanges(_0x14ee0e),_0x49d8fb&&(_0x3b0118=formatDiffWithColors(_0x14ee0e));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x2d4225,'content':'','isDir':!![]}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x10c830,'content':_0x526452}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x486c7d,'content':'','isDir':!![]});for(const _0x460a56 of _0x1dba3a[_0x5a935c(0x1e7)]){const _0x336d94=a96_0xa96e78['join'](_0x486c7d,sanitizeForFilesystem(_0x460a56[_0x5a935c(0x266)])),_0x55074b=a96_0xa96e78[_0x5a935c(0x237)](_0x336d94,_0x5a935c(0x233)),_0x36b521=a96_0xa96e78[_0x5a935c(0x237)](_0x336d94,'json_schema.json');_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x336d94,'content':'','isDir':!![]}),_0xb7f8d7['push']({'path':_0x55074b,'content':_0x460a56[_0x5a935c(0x235)]}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x36b521,'content':_0x460a56[_0x5a935c(0x1f2)]});}if(a96_0x1974b2['existsSync'](_0x486c7d)){const _0x8058e0=a96_0x1974b2['readdirSync'](_0x486c7d,{'withFileTypes':!![]}),_0xca1202=new Set(_0x1dba3a[_0x5a935c(0x1e7)][_0x5a935c(0x28b)](_0x1def83=>sanitizeForFilesystem(_0x1def83[_0x5a935c(0x266)])));for(const _0x43433e of _0x8058e0){if(_0x43433e[_0x5a935c(0x22f)]()&&!_0xca1202[_0x5a935c(0x267)](_0x43433e[_0x5a935c(0x266)])){const _0x550e05=a96_0xa96e78[_0x5a935c(0x237)](_0x486c7d,_0x43433e[_0x5a935c(0x266)]);_0x5294b6[_0x5a935c(0x211)]({'path':_0x550e05,'isDir':!![]});}}}_0x55e600['experimentalKnowledgeBases'][_0x5a935c(0x211)]({'name':_0x17450e['attributes']['name'],'outputPath':_0x2d4225,'isNew':_0x3d6c2d,'hasChanges':_0x49d8fb,'diff':_0x3b0118}),_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x19d)][_0x5a935c(0x1d0)]++;if(_0x3d6c2d)_0x55e600['counts']['experimentalKnowledgeBases'][_0x5a935c(0x28c)]++;else{if(_0x49d8fb)_0x55e600['counts']['experimentalKnowledgeBases'][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x19d)]['unchanged']++;}}for(const _0x821210 of _0x1a18b2){if(_0x821210[_0x5a935c(0x1eb)]['isManaged'])continue;const _0x3ab127=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x208c69),_0x821210[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);_0x3ab127['renamed']&&this[_0x5a935c(0x282)]['info'](_0x5a935c(0x191)+a96_0xa96e78[_0x5a935c(0x21e)](_0x3ab127['oldPath'])+'\x20→\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x3ab127[_0x5a935c(0x246)]));const _0x387f31=_0x3ab127['path'],_0x2c702e=a96_0xa96e78[_0x5a935c(0x237)](_0x387f31,sanitizeForFilesystem(_0x821210[_0x5a935c(0x1eb)][_0x5a935c(0x266)])+_0x5a935c(0x1ee)),_0x5f2256=a96_0xa96e78[_0x5a935c(0x237)](_0x387f31,_0x5a935c(0x233)),_0x595d0a=a96_0xa96e78[_0x5a935c(0x237)](_0x387f31,'files'),_0x2990ae=apiExperimentalArtifactToYaml(_0x821210),_0x23b961=toExperimentalArtifactYamlString(_0x2990ae),_0x2b3e14=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x387f31);let _0x37324f=_0x2b3e14,_0x5bb5ad,_0x4c9587=_0x23b961+(_0x5a935c(0x1a6)+_0x2990ae[_0x5a935c(0x235)]+'\x0a');const _0x4ad6a5=[..._0x2990ae['files']][_0x5a935c(0x22e)]((_0x1b7152,_0x2d4dd3)=>_0x1b7152[_0x5a935c(0x1be)]['localeCompare'](_0x2d4dd3[_0x5a935c(0x1be)]));for(const _0x31d0d9 of _0x4ad6a5){_0x4c9587+=_0x5a935c(0x186)+_0x31d0d9[_0x5a935c(0x1be)]+_0x5a935c(0x1ae)+_0x31d0d9[_0x5a935c(0x1e4)]+'\x0a';}if(!_0x2b3e14){let _0xedc6bd='';a96_0x1974b2[_0x5a935c(0x1b5)](_0x2c702e)&&(_0xedc6bd=a96_0x1974b2['readFileSync'](_0x2c702e,'utf-8'));a96_0x1974b2[_0x5a935c(0x1b5)](_0x5f2256)&&(_0xedc6bd+='\x0a---\x20code\x20---\x0a'+a96_0x1974b2[_0x5a935c(0x1af)](_0x5f2256,_0x5a935c(0x26f))+'\x0a');if(a96_0x1974b2[_0x5a935c(0x1b5)](_0x595d0a)){const _0x18dc5a=a96_0x1974b2['readdirSync'](_0x595d0a),_0x3ea0f1=_0x18dc5a[_0x5a935c(0x20e)](_0x48ce3a=>{const _0xe9012f=_0x5a935c,_0x11d22b=a96_0xa96e78[_0xe9012f(0x237)](_0x595d0a,_0x48ce3a);return a96_0x1974b2[_0xe9012f(0x1bb)](_0x11d22b)[_0xe9012f(0x221)]();})[_0x5a935c(0x22e)]((_0x20fd5a,_0x51bef3)=>_0x20fd5a[_0x5a935c(0x1e6)](_0x51bef3));for(const _0x9f4c8 of _0x3ea0f1){const _0x597f2f=a96_0xa96e78['join'](_0x595d0a,_0x9f4c8);_0xedc6bd+=_0x5a935c(0x186)+_0x9f4c8+_0x5a935c(0x1ae)+a96_0x1974b2[_0x5a935c(0x1af)](_0x597f2f,_0x5a935c(0x26f))+'\x0a';}}const _0x6ac46d=generateDiff(_0xedc6bd,_0x4c9587);_0x37324f=hasChanges(_0x6ac46d),_0x37324f&&(_0x5bb5ad=formatDiffWithColors(_0x6ac46d));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x387f31,'content':'','isDir':!![]}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x2c702e,'content':_0x23b961}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x5f2256,'content':_0x2990ae[_0x5a935c(0x235)]});if(_0x2990ae[_0x5a935c(0x194)][_0x5a935c(0x219)]>0x0){_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x595d0a,'content':'','isDir':!![]});for(const _0x1917cc of _0x2990ae['files']){const _0x19b55b=a96_0xa96e78[_0x5a935c(0x237)](_0x595d0a,_0x1917cc[_0x5a935c(0x1be)]);_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x19b55b,'content':_0x1917cc[_0x5a935c(0x1e4)]});}}if(a96_0x1974b2[_0x5a935c(0x1b5)](_0x595d0a)){const _0xf59a5=a96_0x1974b2[_0x5a935c(0x1b6)](_0x595d0a),_0x1d52d2=new Set(_0x2990ae[_0x5a935c(0x194)][_0x5a935c(0x28b)](_0x10e97c=>_0x10e97c[_0x5a935c(0x1be)]));for(const _0x2c5da5 of _0xf59a5){const _0x190627=a96_0xa96e78[_0x5a935c(0x237)](_0x595d0a,_0x2c5da5);a96_0x1974b2[_0x5a935c(0x1bb)](_0x190627)['isFile']()&&!_0x1d52d2[_0x5a935c(0x267)](_0x2c5da5)&&_0x5294b6[_0x5a935c(0x211)]({'path':_0x190627});}}_0x55e600[_0x5a935c(0x1d6)]['push']({'name':_0x821210[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'outputPath':_0x387f31,'isNew':_0x2b3e14,'hasChanges':_0x37324f,'diff':_0x5bb5ad}),_0x55e600['counts']['experimentalArtifacts']['total']++;if(_0x2b3e14)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1d6)][_0x5a935c(0x28c)]++;else{if(_0x37324f)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1d6)][_0x5a935c(0x1a4)]++;else _0x55e600['counts'][_0x5a935c(0x1d6)][_0x5a935c(0x238)]++;}}if(_0x4be00f?.['dryRun'])return _0x55e600;a96_0x1974b2[_0x5a935c(0x19e)](_0x208c69,{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getKnowledgeBasesDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getPromptsDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getIntegrationsDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getExperimentalKnowledgeBasesDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getExperimentalArtifactsDir(_0x208c69),{'recursive':!![]});const _0x1f1100=a96_0xa96e78[_0x5a935c(0x237)](_0x208c69,'tdx.json');a96_0x1974b2['writeFileSync'](_0x1f1100,createAgentConfigContent(_0x538242));for(const _0x18784f of _0xb7f8d7){if(_0x18784f[_0x5a935c(0x197)])a96_0x1974b2[_0x5a935c(0x19e)](_0x18784f[_0x5a935c(0x246)],{'recursive':!![]});else{const _0xa6ca92=a96_0xa96e78[_0x5a935c(0x1e8)](_0x18784f[_0x5a935c(0x246)]);!a96_0x1974b2[_0x5a935c(0x1b5)](_0xa6ca92)&&a96_0x1974b2[_0x5a935c(0x19e)](_0xa6ca92,{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x1f4)](_0x18784f[_0x5a935c(0x246)],_0x18784f[_0x5a935c(0x20c)]);}}for(const _0x57f5df of _0x5294b6){_0x57f5df['isDir']?(a96_0x1974b2[_0x5a935c(0x280)](_0x57f5df[_0x5a935c(0x246)],{'recursive':!![],'force':!![]}),this[_0x5a935c(0x282)][_0x5a935c(0x1c1)](_0x5a935c(0x228)+a96_0xa96e78[_0x5a935c(0x21e)](a96_0xa96e78['dirname'](_0x57f5df[_0x5a935c(0x246)]))+'/'+a96_0xa96e78[_0x5a935c(0x21e)](_0x57f5df['path']))):(a96_0x1974b2['rmSync'](_0x57f5df['path'],{'force':!![]}),this[_0x5a935c(0x282)]['info']('Removed\x20deleted\x20file:\x20'+a96_0xa96e78[_0x5a935c(0x21e)](a96_0xa96e78[_0x5a935c(0x1e8)](_0x57f5df[_0x5a935c(0x246)]))+'/'+a96_0xa96e78['basename'](_0x57f5df['path'])));}return _0x55e600;}async[a96_0x5d9617(0x1a3)](_0x566498,_0x2f9739){const _0xc0009=a96_0x5d9617,_0x2e8ffd=a96_0xa96e78[_0xc0009(0x237)](_0x566498,_0xc0009(0x23e));if(!a96_0x1974b2['existsSync'](_0x2e8ffd))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xc0009(0x20d)+_0x566498,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x32b850=loadAgentConfig(_0x2e8ffd),_0xffbd1=await this[_0xc0009(0x260)](_0x32b850[_0xc0009(0x198)]),_0x4c522c=await this[_0xc0009(0x26e)]['getProject'](_0xffbd1),_0x24959c=_0x4c522c[_0xc0009(0x1eb)]['name'],_0x5ef5c2={'projectName':_0x24959c,'projectId':_0xffbd1,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x259a00=[],_0x28ec15=[],_0x29aa56=[],_0x28a987=[],_0x3cc637=[],_0x59ca95=[],_0xfe2cd2=a96_0x1974b2[_0xc0009(0x1b6)](_0x566498,{'withFileTypes':!![]});for(const _0xfc539e of _0xfe2cd2){if(!_0xfc539e[_0xc0009(0x22f)]())continue;if([_0xc0009(0x183),_0xc0009(0x1e9),_0xc0009(0x26a),_0xc0009(0x232),'experimental_artifacts'][_0xc0009(0x1ec)](_0xfc539e[_0xc0009(0x266)]))continue;const _0xe31c4b=a96_0xa96e78['join'](_0x566498,_0xfc539e['name']);if(isAgentDir(_0xe31c4b)){const _0x28e8a5=a96_0xa96e78['join'](_0xe31c4b,_0xc0009(0x264)),_0x523351=a96_0xa96e78[_0xc0009(0x237)](_0xe31c4b,'prompt.md'),_0x5f106a=a96_0xa96e78['join'](_0xe31c4b,_0xc0009(0x261)),_0x377833=parseAgentYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x28e8a5,_0xc0009(0x26f)),_0x28e8a5),_0x7ebef6=a96_0x1974b2[_0xc0009(0x1b5)](_0x523351)?a96_0x1974b2[_0xc0009(0x1af)](_0x523351,_0xc0009(0x26f)):'',_0x53be87=a96_0x1974b2[_0xc0009(0x1b5)](_0x5f106a)?a96_0x1974b2['readFileSync'](_0x5f106a,_0xc0009(0x26f)):_0x377833[_0xc0009(0x272)];_0x259a00['push']({'name':_0x377833['name'],'dir':_0xe31c4b,'yaml':_0x377833,'systemPrompt':_0x7ebef6,'starterMessage':_0x53be87});}}const _0x261cd7=getKnowledgeBasesDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x261cd7)){const _0x346c56=a96_0x1974b2['readdirSync'](_0x261cd7);for(const _0x1c4a8c of _0x346c56){const _0xacc317=a96_0xa96e78[_0xc0009(0x237)](_0x261cd7,_0x1c4a8c);if(_0x1c4a8c[_0xc0009(0x1e5)](_0xc0009(0x1ee))){const _0x45b2d6=parseKnowledgeBaseYaml(a96_0x1974b2[_0xc0009(0x1af)](_0xacc317,_0xc0009(0x26f)),_0xacc317);_0x28ec15['push']({'name':_0x45b2d6[_0xc0009(0x266)],'path':_0xacc317,'yaml':_0x45b2d6});}else{if(_0x1c4a8c['endsWith'](_0xc0009(0x215))){const _0x4746f2=a96_0x1974b2['readFileSync'](_0xacc317,_0xc0009(0x26f)),{name:_0x544599,text:_0x4a8e1e}=parseTextKnowledgeBaseMd(_0x4746f2,_0x1c4a8c);_0x29aa56[_0xc0009(0x211)]({'name':_0x544599,'path':_0xacc317,'text':_0x4a8e1e});}}}}const _0x356109=getPromptsDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x356109)){const _0x2b4419=a96_0x1974b2['readdirSync'](_0x356109)['filter'](_0x1a9b35=>_0x1a9b35['endsWith'](_0xc0009(0x1ee)));for(const _0x42b8b7 of _0x2b4419){const _0x57a625=a96_0xa96e78[_0xc0009(0x237)](_0x356109,_0x42b8b7),_0x5ad495=parsePromptYaml(a96_0x1974b2['readFileSync'](_0x57a625,'utf-8'),_0x57a625);_0x28a987[_0xc0009(0x211)]({'name':_0x5ad495['name'],'path':_0x57a625,'yaml':_0x5ad495});}}const _0x4d03f8=[],_0x126936=getIntegrationsDir(_0x566498);if(a96_0x1974b2['existsSync'](_0x126936)){const _0x37fcd8=a96_0x1974b2[_0xc0009(0x1b6)](_0x126936)[_0xc0009(0x20e)](_0x55723e=>_0x55723e[_0xc0009(0x1e5)]('.yml'));for(const _0x254e60 of _0x37fcd8){const _0x1cb261=a96_0xa96e78[_0xc0009(0x237)](_0x126936,_0x254e60),_0x4f1dc5=parseIntegrationYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x1cb261,'utf-8'),_0x1cb261);if(!SAFE_INTEGRATION_TYPES[_0xc0009(0x1ec)](_0x4f1dc5['service_type'][_0xc0009(0x1f9)]())){this[_0xc0009(0x282)][_0xc0009(0x290)](_0xc0009(0x25f)+_0x4f1dc5[_0xc0009(0x266)]+_0xc0009(0x204)+_0x4f1dc5[_0xc0009(0x259)]+_0xc0009(0x27d)+(_0xc0009(0x1ef)+SAFE_INTEGRATION_TYPES[_0xc0009(0x237)](',\x20')+_0xc0009(0x1e2))+_0xc0009(0x18d));continue;}_0x4d03f8['push']({'name':_0x4f1dc5['name'],'path':_0x1cb261,'yaml':_0x4f1dc5});}}const _0x2c7dc1=getExperimentalKnowledgeBasesDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x2c7dc1)){const _0x198cfb=a96_0x1974b2[_0xc0009(0x1b6)](_0x2c7dc1,{'withFileTypes':!![]});for(const _0x5a2498 of _0x198cfb){if(!_0x5a2498[_0xc0009(0x22f)]())continue;const _0x534b73=a96_0xa96e78[_0xc0009(0x237)](_0x2c7dc1,_0x5a2498[_0xc0009(0x266)]),_0x172465=a96_0xa96e78[_0xc0009(0x237)](_0x534b73,_0x5a2498[_0xc0009(0x266)]+'.yml'),_0x2bd54a=a96_0xa96e78[_0xc0009(0x237)](_0x534b73,_0xc0009(0x1e7));if(!a96_0x1974b2[_0xc0009(0x1b5)](_0x172465))continue;const _0x13b783=parseExperimentalKnowledgeBaseYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x172465,_0xc0009(0x26f)),_0x172465),_0x3e329a=[];if(a96_0x1974b2[_0xc0009(0x1b5)](_0x2bd54a)){const _0x2d8aed=a96_0x1974b2['readdirSync'](_0x2bd54a,{'withFileTypes':!![]});for(const _0x4f03ec of _0x2d8aed){if(!_0x4f03ec[_0xc0009(0x22f)]())continue;const _0x20e336=a96_0xa96e78[_0xc0009(0x237)](_0x2bd54a,_0x4f03ec[_0xc0009(0x266)]),_0x28f054=a96_0xa96e78[_0xc0009(0x237)](_0x20e336,_0xc0009(0x233)),_0x20fa92=a96_0xa96e78['join'](_0x20e336,_0xc0009(0x27b));a96_0x1974b2[_0xc0009(0x1b5)](_0x28f054)&&a96_0x1974b2[_0xc0009(0x1b5)](_0x20fa92)&&_0x3e329a[_0xc0009(0x211)]({'name':_0x4f03ec[_0xc0009(0x266)],'code':a96_0x1974b2['readFileSync'](_0x28f054,_0xc0009(0x26f)),'json_schema':a96_0x1974b2['readFileSync'](_0x20fa92,_0xc0009(0x26f))});}}const _0x1c3852={..._0x13b783,'variables':_0x13b783[_0xc0009(0x1db)]||[],'functions':_0x3e329a};_0x3cc637[_0xc0009(0x211)]({'name':_0x13b783[_0xc0009(0x266)],'dir':_0x534b73,'def':_0x1c3852});}}const _0x28a6bb=getExperimentalArtifactsDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x28a6bb)){const _0x4cf827=a96_0x1974b2['readdirSync'](_0x28a6bb,{'withFileTypes':!![]});for(const _0x7130ea of _0x4cf827){if(!_0x7130ea[_0xc0009(0x22f)]())continue;const _0x3dc9f5=a96_0xa96e78[_0xc0009(0x237)](_0x28a6bb,_0x7130ea[_0xc0009(0x266)]),_0x582fcf=a96_0xa96e78[_0xc0009(0x237)](_0x3dc9f5,_0x7130ea[_0xc0009(0x266)]+_0xc0009(0x1ee)),_0x43087b=a96_0xa96e78['join'](_0x3dc9f5,_0xc0009(0x233)),_0x4e1210=a96_0xa96e78['join'](_0x3dc9f5,_0xc0009(0x194));if(!a96_0x1974b2[_0xc0009(0x1b5)](_0x582fcf)||!a96_0x1974b2[_0xc0009(0x1b5)](_0x43087b))continue;const _0xc982fc=parseExperimentalArtifactYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x582fcf,'utf-8'),_0x582fcf),_0x2cb529=a96_0x1974b2[_0xc0009(0x1af)](_0x43087b,_0xc0009(0x26f)),_0x96635c=[];if(a96_0x1974b2[_0xc0009(0x1b5)](_0x4e1210)){const _0xb60b35=a96_0x1974b2['readdirSync'](_0x4e1210);for(const _0x430f35 of _0xb60b35){const _0x5061e6=a96_0xa96e78[_0xc0009(0x237)](_0x4e1210,_0x430f35);a96_0x1974b2[_0xc0009(0x1bb)](_0x5061e6)['isFile']()&&_0x96635c[_0xc0009(0x211)]({'file_name':_0x430f35,'text_content':a96_0x1974b2[_0xc0009(0x1af)](_0x5061e6,_0xc0009(0x26f))});}}const _0x34bc79={..._0xc982fc,'code':_0x2cb529,'files':_0x96635c};_0x59ca95[_0xc0009(0x211)]({'name':_0xc982fc[_0xc0009(0x266)],'dir':_0x3dc9f5,'def':_0x34bc79});}}const _0x56a4a5=await this[_0xc0009(0x26e)][_0xc0009(0x250)](_0xffbd1),_0x142256=await this[_0xc0009(0x26e)][_0xc0009(0x1cb)](_0xffbd1),_0x17f9c6=await this[_0xc0009(0x26e)][_0xc0009(0x196)](_0xffbd1),_0x119c36=await this[_0xc0009(0x26e)][_0xc0009(0x1dd)](_0xffbd1),_0x543383=await this[_0xc0009(0x26e)]['listWebSearchTools'](_0xffbd1),_0x214be7=await this['client'][_0xc0009(0x1c4)](_0xffbd1),_0x434008=await this[_0xc0009(0x26e)][_0xc0009(0x276)](_0xffbd1),_0x580340=await this[_0xc0009(0x26e)][_0xc0009(0x1a7)](_0xffbd1),_0x46c06b=await this[_0xc0009(0x26e)][_0xc0009(0x275)](_0xffbd1),_0x14403a=await this[_0xc0009(0x26e)][_0xc0009(0x265)](_0xffbd1),_0x33329e=new Map(),_0xc95e25=new Map(),_0x8ce0b9=new Map(),_0x4ead06=new Map(),_0x23c33f=new Map(),_0x5a17cc=new Map(),_0x5a3acc=new Map();for(const _0x1005ee of _0x56a4a5){_0x33329e[_0xc0009(0x203)](_0x1005ee['attributes']['name'],_0x1005ee);}for(const _0x5a939c of _0x142256){_0xc95e25[_0xc0009(0x203)](_0x5a939c[_0xc0009(0x1eb)]['name'],_0x5a939c);}for(const _0x5f27dc of _0x17f9c6){_0x8ce0b9[_0xc0009(0x203)](_0x5f27dc[_0xc0009(0x1eb)]['name'],_0x5f27dc);}for(const _0x452039 of _0x214be7){_0x4ead06['set'](_0x452039[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x452039);}for(const _0x51f4d1 of _0x434008){_0x23c33f[_0xc0009(0x203)](_0x51f4d1['attributes'][_0xc0009(0x19a)][_0xc0009(0x1f9)](),_0x51f4d1);}for(const _0x64f625 of _0x46c06b){_0x5a17cc[_0xc0009(0x203)](_0x64f625['attributes'][_0xc0009(0x266)],_0x64f625);}for(const _0x779552 of _0x14403a){_0x5a3acc['set'](_0x779552[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x779552);}const _0x1d9915=new Map(),_0x4b6692=new Map(),_0x379c7a=new Map(),_0x53574c=new Map(),_0x50ee83=new Map(),_0x41e09d=new Map(),_0x53647e=new Map(),_0x3ea53e=new Map(),_0xc24aae=new Map(),_0x1bd36a=new Map(),_0x2f9db5=new Map(),_0x5f5089=new Map(),_0x4bae66=new Map(),_0x37a103=new Map(),_0xbbfb8c=new Map(),_0x5dbd4c=new Map();for(const _0x4ab7f0 of _0x142256){_0x1d9915['set'](_0x4ab7f0[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x4ab7f0['id']),_0xc24aae[_0xc0009(0x203)](_0x4ab7f0['id'],_0x4ab7f0['attributes'][_0xc0009(0x266)]);}for(const _0x1ca3a8 of _0x17f9c6){_0x4b6692[_0xc0009(0x203)](_0x1ca3a8['attributes'][_0xc0009(0x266)],_0x1ca3a8['id']),_0x1bd36a['set'](_0x1ca3a8['id'],_0x1ca3a8['attributes'][_0xc0009(0x266)]);}for(const _0x82d1fc of _0x56a4a5){_0x379c7a[_0xc0009(0x203)](_0x82d1fc[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x82d1fc['id']),_0x2f9db5[_0xc0009(0x203)](_0x82d1fc['id'],_0x82d1fc[_0xc0009(0x1eb)][_0xc0009(0x266)]);}for(const _0x39cc57 of _0x119c36){_0x53574c[_0xc0009(0x203)](_0x39cc57[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x39cc57['id']),_0x5f5089[_0xc0009(0x203)](_0x39cc57['id'],_0x39cc57['attributes']['name']);}for(const _0x1782c7 of _0x543383){_0x50ee83[_0xc0009(0x203)](_0x1782c7[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x1782c7['id']),_0x4bae66[_0xc0009(0x203)](_0x1782c7['id'],_0x1782c7[_0xc0009(0x1eb)][_0xc0009(0x266)]);}for(const _0x42069f of _0x214be7){_0x41e09d[_0xc0009(0x203)](_0x42069f['attributes'][_0xc0009(0x266)],_0x42069f['id']),_0x37a103['set'](_0x42069f['id'],_0x42069f[_0xc0009(0x1eb)][_0xc0009(0x266)]);}for(const _0x5ca180 of _0x46c06b){_0x53647e['set'](_0x5ca180[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x5ca180['id']),_0xbbfb8c[_0xc0009(0x203)](_0x5ca180['id'],_0x5ca180[_0xc0009(0x1eb)]['name']);}for(const _0x3d72c7 of _0x14403a){_0x3ea53e['set'](_0x3d72c7[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x3d72c7['id']),_0x5dbd4c['set'](_0x3d72c7['id'],_0x3d72c7[_0xc0009(0x1eb)][_0xc0009(0x266)]);}const _0x1c3083={'resolveKnowledgeBaseName':async _0x4f4699=>_0xc24aae[_0xc0009(0x1c6)](_0x4f4699),'resolveTextKnowledgeBaseName':async _0x476a90=>_0x1bd36a[_0xc0009(0x1c6)](_0x476a90),'resolveAgentName':async _0x91dd2c=>_0x2f9db5[_0xc0009(0x1c6)](_0x91dd2c),'resolveWebSearchToolName':async _0x275c0f=>_0x4bae66[_0xc0009(0x1c6)](_0x275c0f),'resolveImageGeneratorName':async _0x4d557e=>_0x5f5089[_0xc0009(0x1c6)](_0x4d557e),'resolvePromptName':async _0x15d052=>_0x37a103[_0xc0009(0x1c6)](_0x15d052),'resolveExperimentalKnowledgeBaseName':async _0x5b21e8=>_0xbbfb8c[_0xc0009(0x1c6)](_0x5b21e8),'onWarning':_0x48181f=>this[_0xc0009(0x282)][_0xc0009(0x290)](_0x48181f)};let _0x592b51=[];const _0x16adff={'projectId':_0xffbd1,'resolveKnowledgeBaseId':async _0x3f19ee=>_0x1d9915[_0xc0009(0x1c6)](_0x3f19ee),'resolveTextKnowledgeBaseId':async _0x4d01b0=>_0x4b6692['get'](_0x4d01b0),'resolveAgentId':async _0x507a4b=>_0x379c7a[_0xc0009(0x1c6)](_0x507a4b),'resolveWebSearchToolId':async _0x2cc462=>_0x50ee83[_0xc0009(0x1c6)](_0x2cc462),'resolveImageGeneratorId':async _0x34fbf=>_0x53574c[_0xc0009(0x1c6)](_0x34fbf),'resolvePromptId':async _0x4850ce=>_0x41e09d[_0xc0009(0x1c6)](_0x4850ce),'resolveParentSegmentKBId':async()=>_0x580340?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x5cde93=>_0x53647e[_0xc0009(0x1c6)](_0x5cde93),'onWarning':_0x435b1e=>{const _0x32dd4e=_0xc0009;this[_0x32dd4e(0x282)][_0x32dd4e(0x290)](_0x435b1e),_0x592b51[_0x32dd4e(0x211)](_0x435b1e);}},{resolved:_0x45d816,unresolved:_0x54a964}=resolveAgentDependencies(_0x259a00,new Set(_0x33329e['keys']()));for(const {agent:_0x2eb59a,missingDeps:_0x3f18f7}of _0x54a964){_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x2eb59a[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':'Unresolved\x20dependencies:\x20'+_0x3f18f7[_0xc0009(0x237)](',\x20')+_0xc0009(0x258)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)][_0xc0009(0x17e)]++;}for(const _0x53a316 of _0x28ec15){const _0x2cb8e2=_0xc95e25[_0xc0009(0x1c6)](_0x53a316[_0xc0009(0x271)][_0xc0009(0x266)]),_0x644783=a96_0x1974b2[_0xc0009(0x1af)](_0x53a316[_0xc0009(0x246)],'utf-8');if(_0x2cb8e2){const _0x6079a3=apiKnowledgeBaseToYaml(_0x2cb8e2),_0x293e58=toKnowledgeBaseYamlString(_0x6079a3),_0x1ae114=generateDiff(_0x293e58,_0x644783),_0x1c920c=hasChanges(_0x1ae114);_0x1c920c?(_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x53a316[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x2cb8e2['id'],'diff':formatDiffWithColors(_0x1ae114)}),_0x5ef5c2['counts']['knowledgeBases'][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x53a316[_0xc0009(0x271)]['name'],'action':_0xc0009(0x238),'id':_0x2cb8e2['id']}),_0x5ef5c2['counts'][_0xc0009(0x283)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x53a316['yaml'][_0xc0009(0x266)],'action':'created'}),_0x5ef5c2['counts']['knowledgeBases']['created']++;}for(const _0x4dc0c7 of _0x29aa56){const _0x5b0698=_0x8ce0b9[_0xc0009(0x1c6)](_0x4dc0c7[_0xc0009(0x266)]),_0x3fd7f7=a96_0x1974b2[_0xc0009(0x1af)](_0x4dc0c7[_0xc0009(0x246)],'utf-8');if(_0x5b0698){const _0x8eb055=toTextKnowledgeBaseMd(_0x5b0698['attributes']['name'],_0x5b0698[_0xc0009(0x1eb)]['text']),_0x50e3f8=generateDiff(_0x8eb055,_0x3fd7f7),_0xcd3fc6=hasChanges(_0x50e3f8);_0xcd3fc6?(_0x5ef5c2['textKnowledgeBases'][_0xc0009(0x211)]({'name':_0x4dc0c7['name'],'action':'updated','id':_0x5b0698['id'],'diff':formatDiffWithColors(_0x50e3f8)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4dc0c7[_0xc0009(0x266)],'action':_0xc0009(0x238),'id':_0x5b0698['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4dc0c7[_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x17f)]++;}for(const _0x326919 of _0x45d816){const _0x55e315=_0x33329e['get'](_0x326919[_0xc0009(0x271)]['name']),_0x7ede19=a96_0xa96e78[_0xc0009(0x237)](_0x326919[_0xc0009(0x284)],_0xc0009(0x264)),_0x9269d3=a96_0x1974b2[_0xc0009(0x1af)](_0x7ede19,_0xc0009(0x26f)),_0x2929ce=_0x326919[_0xc0009(0x21c)],_0x398c6d=_0xc0009(0x254)+_0x2929ce+_0xc0009(0x190)+_0x9269d3;if(_0x55e315){const {yaml:_0x5c0cf0,systemPrompt:_0x4715e2}=await agentResponseToDef(_0x55e315,_0x1c3083),_0x4f082f=toAgentYamlString(_0x5c0cf0),_0x383c13=_0xc0009(0x254)+_0x4715e2+_0xc0009(0x190)+_0x4f082f,_0x65ea1b=generateDiff(_0x383c13,_0x398c6d),_0x2d7d2c=hasChanges(_0x65ea1b);_0x2d7d2c?(_0x5ef5c2[_0xc0009(0x1e3)]['push']({'agentName':_0x326919[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'agentId':_0x55e315['id'],'diff':formatDiffWithColors(_0x65ea1b)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)]['updated']++):(_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x326919[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x238),'agentId':_0x55e315['id']}),_0x5ef5c2['counts'][_0xc0009(0x1e3)]['unchanged']++);}else _0x5ef5c2['agents'][_0xc0009(0x211)]({'agentName':_0x326919[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)]['agents'][_0xc0009(0x17f)]++;}for(const _0xd387e4 of _0x28a987){const _0x1eaaa6=_0x4ead06['get'](_0xd387e4['yaml'][_0xc0009(0x266)]),_0x346854=a96_0x1974b2[_0xc0009(0x1af)](_0xd387e4[_0xc0009(0x246)],_0xc0009(0x26f));if(_0x1eaaa6){const _0x556ba0=await apiPromptToYaml(_0x1eaaa6,_0x1c3083);if(!_0x556ba0){_0x5ef5c2[_0xc0009(0x1e9)]['push']({'name':_0xd387e4['yaml']['name'],'action':_0xc0009(0x1a4),'id':_0x1eaaa6['id']}),_0x5ef5c2[_0xc0009(0x234)]['prompts']['updated']++;continue;}const _0x4dd80d=toPromptYamlString(_0x556ba0),_0x2ec1a7=generateDiff(_0x4dd80d,_0x346854),_0x9033ad=hasChanges(_0x2ec1a7);_0x9033ad?(_0x5ef5c2['prompts'][_0xc0009(0x211)]({'name':_0xd387e4['yaml'][_0xc0009(0x266)],'action':'updated','id':_0x1eaaa6['id'],'diff':formatDiffWithColors(_0x2ec1a7)}),_0x5ef5c2['counts'][_0xc0009(0x1e9)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x1e9)]['push']({'name':_0xd387e4['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x238),'id':_0x1eaaa6['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e9)]['unchanged']++);}else _0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0xd387e4['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e9)]['created']++;}for(const _0x51eb73 of _0x4d03f8){const _0x4984a8=_0x23c33f[_0xc0009(0x1c6)](_0x51eb73[_0xc0009(0x271)][_0xc0009(0x259)]),_0x9d6e1f=a96_0x1974b2['readFileSync'](_0x51eb73[_0xc0009(0x246)],_0xc0009(0x26f));if(_0x4984a8){const _0x1a119a=await apiIntegrationToYaml(_0x4984a8,_0x1c3083),_0x50d4d9=toIntegrationYamlString(_0x1a119a),_0x24cf1d=generateDiff(_0x50d4d9,_0x9d6e1f),_0x5ee2e7=hasChanges(_0x24cf1d);_0x5ee2e7?(_0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x51eb73[_0xc0009(0x271)][_0xc0009(0x259)],'action':_0xc0009(0x1a4),'id':_0x4984a8['id'],'diff':formatDiffWithColors(_0x24cf1d)}),_0x5ef5c2['counts'][_0xc0009(0x26a)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x26a)]['push']({'name':_0x51eb73['yaml'][_0xc0009(0x259)],'action':_0xc0009(0x238),'id':_0x4984a8['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x26a)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x51eb73['yaml'][_0xc0009(0x259)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x26a)][_0xc0009(0x17f)]++;}for(const _0x3a9ce0 of _0x3cc637){const _0x52e068=_0x5a17cc[_0xc0009(0x1c6)](_0x3a9ce0['def']['name']),_0x122166=toExperimentalKnowledgeBaseYamlString(_0x3a9ce0[_0xc0009(0x1ea)]);let _0x3b9195=_0x122166;for(const _0x5ae237 of _0x3a9ce0['def']['functions']){_0x3b9195+=_0xc0009(0x1c8)+_0x5ae237['name']+_0xc0009(0x1ae)+_0x5ae237[_0xc0009(0x235)]+'\x0a---\x20schema:\x20'+_0x5ae237['name']+_0xc0009(0x1ae)+_0x5ae237[_0xc0009(0x1f2)]+'\x0a';}if(_0x52e068){const _0x26a974=apiExperimentalKnowledgeBaseToYaml(_0x52e068),_0x44e45a=toExperimentalKnowledgeBaseYamlString(_0x26a974);let _0x202ae0=_0x44e45a;for(const _0x12b810 of _0x26a974[_0xc0009(0x1e7)]){_0x202ae0+='\x0a---\x20function:\x20'+_0x12b810['name']+_0xc0009(0x1ae)+_0x12b810[_0xc0009(0x235)]+_0xc0009(0x18e)+_0x12b810['name']+_0xc0009(0x1ae)+_0x12b810[_0xc0009(0x1f2)]+'\x0a';}const _0x5f093c=generateDiff(_0x202ae0,_0x3b9195),_0x2049b7=hasChanges(_0x5f093c);_0x2049b7?(_0x5ef5c2[_0xc0009(0x19d)][_0xc0009(0x211)]({'name':_0x3a9ce0[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x52e068['id'],'diff':formatDiffWithColors(_0x5f093c)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x1a4)]++):(_0x5ef5c2['experimentalKnowledgeBases'][_0xc0009(0x211)]({'name':_0x3a9ce0['def']['name'],'action':_0xc0009(0x238),'id':_0x52e068['id']}),_0x5ef5c2[_0xc0009(0x234)]['experimentalKnowledgeBases'][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x19d)]['push']({'name':_0x3a9ce0[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)]['experimentalKnowledgeBases'][_0xc0009(0x17f)]++;}for(const _0x2fdb05 of _0x59ca95){const _0x52f4ec=_0x5a3acc[_0xc0009(0x1c6)](_0x2fdb05[_0xc0009(0x1ea)][_0xc0009(0x266)]),_0x287c17=toExperimentalArtifactYamlString(_0x2fdb05[_0xc0009(0x1ea)]);let _0x523bb6=_0x287c17+(_0xc0009(0x1a6)+_0x2fdb05['def'][_0xc0009(0x235)]+'\x0a');for(const _0x5dfad6 of _0x2fdb05[_0xc0009(0x1ea)][_0xc0009(0x194)]){_0x523bb6+=_0xc0009(0x186)+_0x5dfad6['file_name']+'\x20---\x0a'+_0x5dfad6['text_content']+'\x0a';}if(_0x52f4ec){const _0x326c90=apiExperimentalArtifactToYaml(_0x52f4ec),_0x583434=toExperimentalArtifactYamlString(_0x326c90);let _0x5b2634=_0x583434+(_0xc0009(0x1a6)+_0x326c90['code']+'\x0a');for(const _0x59ba0a of _0x326c90[_0xc0009(0x194)]){_0x5b2634+=_0xc0009(0x186)+_0x59ba0a[_0xc0009(0x1be)]+'\x20---\x0a'+_0x59ba0a[_0xc0009(0x1e4)]+'\x0a';}const _0x2c7b05=generateDiff(_0x5b2634,_0x523bb6),_0x47ff60=hasChanges(_0x2c7b05);_0x47ff60?(_0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0x2fdb05[_0xc0009(0x1ea)]['name'],'action':_0xc0009(0x1a4),'id':_0x52f4ec['id'],'diff':formatDiffWithColors(_0x2c7b05)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0x2fdb05[_0xc0009(0x1ea)]['name'],'action':_0xc0009(0x238),'id':_0x52f4ec['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0x2fdb05[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x17f)]++;}if(_0x2f9739?.['dryRun'])return _0x5ef5c2;_0x5ef5c2[_0xc0009(0x283)]=[],_0x5ef5c2[_0xc0009(0x212)]=[],_0x5ef5c2[_0xc0009(0x1e9)]=[],_0x5ef5c2[_0xc0009(0x26a)]=[],_0x5ef5c2[_0xc0009(0x19d)]=[],_0x5ef5c2[_0xc0009(0x1d6)]=[];const _0x105987=_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x20e)](_0x461f26=>_0x461f26[_0xc0009(0x27c)]===_0xc0009(0x21b));_0x5ef5c2[_0xc0009(0x1e3)]=_0x105987,_0x5ef5c2[_0xc0009(0x234)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x105987[_0xc0009(0x219)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x218514 of _0x28ec15){try{const _0x36dcc1=_0xc95e25['get'](_0x218514['yaml']['name']),_0x238ca6=yamlKnowledgeBaseToApi(_0x218514[_0xc0009(0x271)],_0xffbd1);if(_0x36dcc1)await this[_0xc0009(0x26e)]['updateKnowledgeBase'](_0x36dcc1['id'],_0x238ca6),_0x1d9915[_0xc0009(0x203)](_0x218514['yaml'][_0xc0009(0x266)],_0x36dcc1['id']),_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x218514[_0xc0009(0x271)][_0xc0009(0x266)],'action':'updated','id':_0x36dcc1['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x283)]['updated']++;else{const _0x1e1054=await this[_0xc0009(0x26e)][_0xc0009(0x1fd)](_0x238ca6);_0x1d9915[_0xc0009(0x203)](_0x218514[_0xc0009(0x271)][_0xc0009(0x266)],_0x1e1054['id']),_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x218514[_0xc0009(0x271)][_0xc0009(0x266)],'action':'created','id':_0x1e1054['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x283)][_0xc0009(0x17f)]++;}}catch(_0x47fe7c){_0x5ef5c2['knowledgeBases'][_0xc0009(0x211)]({'name':_0x218514['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x47fe7c[_0xc0009(0x1ad)]}),_0x5ef5c2['counts'][_0xc0009(0x283)][_0xc0009(0x17e)]++;}}for(const _0x4f34d8 of _0x29aa56){try{const _0x25005b=_0x8ce0b9['get'](_0x4f34d8['name']),_0x14fea6=yamlTextKnowledgeBaseToApi({'name':_0x4f34d8[_0xc0009(0x266)],'text':_0x4f34d8[_0xc0009(0x206)]},_0xffbd1);if(_0x25005b)await this[_0xc0009(0x26e)][_0xc0009(0x1a9)](_0x25005b['id'],_0x14fea6),_0x4b6692[_0xc0009(0x203)](_0x4f34d8[_0xc0009(0x266)],_0x25005b['id']),_0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4f34d8['name'],'action':_0xc0009(0x1a4),'id':_0x25005b['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x1a4)]++;else{const _0x4cddae=await this[_0xc0009(0x26e)][_0xc0009(0x274)](_0x14fea6);_0x4b6692[_0xc0009(0x203)](_0x4f34d8[_0xc0009(0x266)],_0x4cddae['id']),_0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4f34d8[_0xc0009(0x266)],'action':_0xc0009(0x17f),'id':_0x4cddae['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)]['created']++;}}catch(_0x231657){_0x5ef5c2['textKnowledgeBases']['push']({'name':_0x4f34d8[_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x231657[_0xc0009(0x1ad)]}),_0x5ef5c2['counts'][_0xc0009(0x212)][_0xc0009(0x17e)]++;}}for(const _0x2e362e of _0x3cc637){try{const _0x46d1b7=_0x5a17cc[_0xc0009(0x1c6)](_0x2e362e['def'][_0xc0009(0x266)]),_0x242ebd=yamlExperimentalKnowledgeBaseToApi(_0x2e362e[_0xc0009(0x1ea)],_0xffbd1);if(_0x46d1b7)await this[_0xc0009(0x26e)]['updateExperimentalKnowledgeBase'](_0x46d1b7['id'],_0x242ebd),_0x53647e[_0xc0009(0x203)](_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],_0x46d1b7['id']),_0x5ef5c2['experimentalKnowledgeBases']['push']({'name':_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x46d1b7['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x1a4)]++;else{const _0x4901a3=await this[_0xc0009(0x26e)][_0xc0009(0x19f)](_0x242ebd);_0x53647e[_0xc0009(0x203)](_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],_0x4901a3['id']),_0x5ef5c2['experimentalKnowledgeBases'][_0xc0009(0x211)]({'name':_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':'created','id':_0x4901a3['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x17f)]++;}}catch(_0x5d99b3){_0x5ef5c2[_0xc0009(0x19d)][_0xc0009(0x211)]({'name':_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':'error','error':_0x5d99b3[_0xc0009(0x1ad)]}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x17e)]++;}}for(const _0xf1cebc of _0x59ca95){try{const _0x1af5f7=_0x5a3acc[_0xc0009(0x1c6)](_0xf1cebc['def'][_0xc0009(0x266)]),_0x586ff7=yamlExperimentalArtifactToApi(_0xf1cebc['def'],_0xffbd1);if(_0x1af5f7)await this[_0xc0009(0x26e)][_0xc0009(0x222)](_0x1af5f7['id'],_0x586ff7),_0x3ea53e['set'](_0xf1cebc['def']['name'],_0x1af5f7['id']),_0x5ef5c2['experimentalArtifacts'][_0xc0009(0x211)]({'name':_0xf1cebc[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':'updated','id':_0x1af5f7['id']}),_0x5ef5c2['counts'][_0xc0009(0x1d6)][_0xc0009(0x1a4)]++;else{const _0x1e3c3b=await this[_0xc0009(0x26e)][_0xc0009(0x214)](_0x586ff7);_0x3ea53e[_0xc0009(0x203)](_0xf1cebc['def']['name'],_0x1e3c3b['id']),_0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0xf1cebc[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x17f),'id':_0x1e3c3b['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x17f)]++;}}catch(_0x3a559b){_0x5ef5c2['experimentalArtifacts'][_0xc0009(0x211)]({'name':_0xf1cebc[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x3a559b[_0xc0009(0x1ad)]}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)]['errors']++;}}for(const _0x5dc002 of _0x45d816){_0x592b51=[];try{const _0x72deee=_0x33329e[_0xc0009(0x1c6)](_0x5dc002[_0xc0009(0x271)][_0xc0009(0x266)]),_0x35d516=await agentDefToRequest(_0x5dc002[_0xc0009(0x271)],_0x5dc002[_0xc0009(0x21c)],_0x5dc002[_0xc0009(0x217)],_0x16adff);if(_0x72deee)await this['client']['updateAgentResponse'](_0x72deee['id'],_0x35d516),_0x379c7a['set'](_0x5dc002['yaml'][_0xc0009(0x266)],_0x72deee['id']),_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x5dc002[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'agentId':_0x72deee['id'],'warnings':_0x592b51[_0xc0009(0x219)]>0x0?_0x592b51:undefined}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)][_0xc0009(0x1a4)]++;else{const _0x36b48c=await this['client'][_0xc0009(0x23c)](_0x35d516);_0x379c7a[_0xc0009(0x203)](_0x5dc002['yaml'][_0xc0009(0x266)],_0x36b48c['id']),_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x5dc002['yaml']['name'],'action':_0xc0009(0x17f),'agentId':_0x36b48c['id'],'warnings':_0x592b51['length']>0x0?_0x592b51:undefined}),_0x5ef5c2['counts'][_0xc0009(0x1e3)]['created']++;}}catch(_0x40467b){_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x5dc002[_0xc0009(0x271)]['name'],'action':'error','error':_0x40467b['message'],'warnings':_0x592b51['length']>0x0?_0x592b51:undefined}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)][_0xc0009(0x17e)]++;}}for(const _0x1dc016 of _0x28a987){try{const _0x4b5403=_0x4ead06[_0xc0009(0x1c6)](_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)]),_0x563434=await yamlPromptToApi(_0x1dc016[_0xc0009(0x271)],_0xffbd1,_0x16adff);if(!_0x563434){_0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':'Agent\x20reference\x20not\x20found'}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e9)][_0xc0009(0x17e)]++;continue;}if(_0x4b5403)await this[_0xc0009(0x26e)][_0xc0009(0x252)](_0x4b5403['id'],_0x563434),_0x41e09d['set'](_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],_0x4b5403['id']),_0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0x1dc016['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x4b5403['id']}),_0x5ef5c2[_0xc0009(0x234)]['prompts']['updated']++;else{const _0x5cec1b=await this['client'][_0xc0009(0x207)](_0x563434);_0x41e09d[_0xc0009(0x203)](_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],_0x5cec1b['id']),_0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x17f),'id':_0x5cec1b['id']}),_0x5ef5c2['counts']['prompts'][_0xc0009(0x17f)]++;}}catch(_0x17f8ac){_0x5ef5c2['prompts'][_0xc0009(0x211)]({'name':_0x1dc016['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x17f8ac[_0xc0009(0x1ad)]}),_0x5ef5c2[_0xc0009(0x234)]['prompts'][_0xc0009(0x17e)]++;}}for(const _0x39fc4c of _0x4d03f8){try{const _0x24b861=_0x23c33f[_0xc0009(0x1c6)](_0x39fc4c[_0xc0009(0x271)][_0xc0009(0x259)]),_0x58a089=await yamlIntegrationToApi(_0x39fc4c['yaml'],_0xffbd1,_0x16adff);if(_0x24b861){await this[_0xc0009(0x26e)]['deleteIntegration'](_0x24b861['id']);const _0x27cc52=await this[_0xc0009(0x26e)]['createIntegration'](_0x58a089);_0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x39fc4c['yaml'][_0xc0009(0x259)],'action':_0xc0009(0x1a4),'id':_0x27cc52['id']}),_0x5ef5c2[_0xc0009(0x234)]['integrations'][_0xc0009(0x1a4)]++;}else{const _0x14c3e5=await this['client'][_0xc0009(0x23d)](_0x58a089);_0x5ef5c2['integrations'][_0xc0009(0x211)]({'name':_0x39fc4c[_0xc0009(0x271)][_0xc0009(0x259)],'action':'created','id':_0x14c3e5['id']}),_0x5ef5c2[_0xc0009(0x234)]['integrations']['created']++;}}catch(_0x2f0730){_0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x39fc4c[_0xc0009(0x271)]['service_type'],'action':_0xc0009(0x21b),'error':_0x2f0730[_0xc0009(0x1ad)]}),_0x5ef5c2['counts'][_0xc0009(0x26a)][_0xc0009(0x17e)]++;}}return _0x5ef5c2;}async[a96_0x5d9617(0x239)](_0x235526,_0x4a2cb6,_0x5dbb50,_0x3e5269){const _0x3c5bef=a96_0x5d9617,{projectId:_0xbf7384,project:_0x3efaa1}=await this[_0x3c5bef(0x22a)](_0x235526),_0x4c305a=_0x3efaa1['attributes'][_0x3c5bef(0x266)],_0x5d811b=await this[_0x3c5bef(0x26e)][_0x3c5bef(0x250)](_0xbf7384),_0x43591e=_0x5d811b['find'](_0xf4602f=>_0xf4602f['attributes'][_0x3c5bef(0x266)]===_0x4a2cb6);if(!_0x43591e)throw new SDKError(ErrorCode[_0x3c5bef(0x245)],_0x3c5bef(0x1b2)+_0x4a2cb6,undefined,{'helpText':_0x3c5bef(0x25c)+_0x5d811b[_0x3c5bef(0x28b)](_0x23efb0=>_0x23efb0[_0x3c5bef(0x1eb)][_0x3c5bef(0x266)])[_0x3c5bef(0x237)](',\x20')});let _0x5f2400;if(_0x5dbb50)_0x5f2400=_0x5dbb50;else{const _0x265938=a96_0xa96e78[_0x3c5bef(0x237)](process['cwd'](),_0x3c5bef(0x1e3)),_0x2d9a9c=getSanitizedPathWithMigration(_0x265938,_0x4c305a);_0x2d9a9c[_0x3c5bef(0x25e)]&&this['logger'][_0x3c5bef(0x1c1)](_0x3c5bef(0x1ab)+a96_0xa96e78[_0x3c5bef(0x21e)](_0x2d9a9c[_0x3c5bef(0x18c)])+_0x3c5bef(0x224)+a96_0xa96e78['basename'](_0x2d9a9c[_0x3c5bef(0x246)])),_0x5f2400=_0x2d9a9c[_0x3c5bef(0x246)];}const _0x5c4bf2=getSanitizedPathWithMigration(_0x5f2400,_0x4a2cb6);_0x5c4bf2[_0x3c5bef(0x25e)]&&this[_0x3c5bef(0x282)]['info'](_0x3c5bef(0x1bd)+a96_0xa96e78[_0x3c5bef(0x21e)](_0x5c4bf2[_0x3c5bef(0x18c)])+_0x3c5bef(0x224)+a96_0xa96e78[_0x3c5bef(0x21e)](_0x5c4bf2['path']));const _0x3a426e=_0x5c4bf2[_0x3c5bef(0x246)],_0x2a7e99=new Map(),_0x58ce2a=new Map(),_0x3cb453=await this[_0x3c5bef(0x26e)]['listKnowledgeBases'](_0xbf7384),_0x3be644=await this[_0x3c5bef(0x26e)][_0x3c5bef(0x196)](_0xbf7384),_0x373814=await this[_0x3c5bef(0x26e)]['listExperimentalKnowledgeBases'](_0xbf7384),_0x4f1e09=new Map(),_0x52ab13=new Map();for(const _0x3ab23a of _0x3cb453){_0x2a7e99['set'](_0x3ab23a['id'],_0x3ab23a[_0x3c5bef(0x1eb)]['name']);}for(const _0x4b4740 of _0x3be644){_0x4f1e09[_0x3c5bef(0x203)](_0x4b4740['id'],_0x4b4740[_0x3c5bef(0x1eb)][_0x3c5bef(0x266)]);}for(const _0x1a4396 of _0x373814){_0x52ab13[_0x3c5bef(0x203)](_0x1a4396['id'],_0x1a4396[_0x3c5bef(0x1eb)][_0x3c5bef(0x266)]);}for(const _0x1f666b of _0x5d811b){_0x58ce2a[_0x3c5bef(0x203)](_0x1f666b['id'],_0x1f666b['attributes']['name']);}const _0x2de5e2={'resolveKnowledgeBaseName':async _0x2860b4=>_0x2a7e99[_0x3c5bef(0x1c6)](_0x2860b4),'resolveTextKnowledgeBaseName':async _0x17f42c=>_0x4f1e09[_0x3c5bef(0x1c6)](_0x17f42c),'resolveAgentName':async _0x24b134=>_0x58ce2a[_0x3c5bef(0x1c6)](_0x24b134),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'resolveExperimentalKnowledgeBaseName':async _0x1143a9=>_0x52ab13[_0x3c5bef(0x1c6)](_0x1143a9),'onWarning':_0x3c388a=>this[_0x3c5bef(0x282)][_0x3c5bef(0x290)](_0x3c388a)},_0x1622d4=a96_0xa96e78[_0x3c5bef(0x237)](_0x3a426e,_0x3c5bef(0x262)),_0x110917=a96_0xa96e78[_0x3c5bef(0x237)](_0x3a426e,_0x3c5bef(0x264)),_0xb84192=a96_0xa96e78[_0x3c5bef(0x237)](_0x3a426e,_0x3c5bef(0x261)),_0x41474b=!a96_0x1974b2['existsSync'](_0x110917);if(_0x3e5269?.[_0x3c5bef(0x184)])return{'agentName':_0x4a2cb6,'outputPath':_0x3a426e,'isNew':_0x41474b,'hasChanges':!![]};a96_0x1974b2['mkdirSync'](_0x5f2400,{'recursive':!![]}),a96_0x1974b2[_0x3c5bef(0x19e)](_0x3a426e,{'recursive':!![]});const _0x7b2ab6=a96_0xa96e78[_0x3c5bef(0x237)](_0x5f2400,_0x3c5bef(0x23e));!a96_0x1974b2['existsSync'](_0x7b2ab6)&&a96_0x1974b2[_0x3c5bef(0x1f4)](_0x7b2ab6,createAgentConfigContent(_0x235526));const {yaml:_0x39a61d,systemPrompt:_0x2a8cf5,starterMessage:_0x43fdec}=await agentResponseToDef(_0x43591e,_0x2de5e2);let _0x2788eb=_0x41474b;if(!_0x41474b){const _0x356ee2=a96_0x1974b2[_0x3c5bef(0x1b5)](_0x1622d4)?a96_0x1974b2[_0x3c5bef(0x1af)](_0x1622d4,'utf-8'):'',_0x5220f8=a96_0x1974b2[_0x3c5bef(0x1af)](_0x110917,_0x3c5bef(0x26f));_0x2788eb=_0x356ee2!==_0x2a8cf5||_0x5220f8!==toAgentYamlString(_0x39a61d);}a96_0x1974b2['writeFileSync'](_0x1622d4,_0x2a8cf5),a96_0x1974b2[_0x3c5bef(0x1f4)](_0x110917,toAgentYamlString(_0x39a61d));if(_0x43fdec&&_0x43fdec[_0x3c5bef(0x1ec)]('\x0a'))a96_0x1974b2['writeFileSync'](_0xb84192,_0x43fdec);else a96_0x1974b2['existsSync'](_0xb84192)&&a96_0x1974b2['unlinkSync'](_0xb84192);return{'agentName':_0x4a2cb6,'outputPath':_0x3a426e,'isNew':_0x41474b,'hasChanges':_0x2788eb};}async['pushAgent'](_0x4b5390,_0x355fcf){const _0xc7b8af=a96_0x5d9617;let _0x3da30f;isAgentYamlPath(_0x4b5390)?_0x3da30f=getAgentDirFromYamlPath(_0x4b5390):_0x3da30f=_0x4b5390;const {config:_0x6aced3}=findAgentConfig(_0x3da30f),_0x46fc3d=await this[_0xc7b8af(0x260)](_0x6aced3[_0xc7b8af(0x198)]),_0x22ebf5=a96_0xa96e78[_0xc7b8af(0x237)](_0x3da30f,_0xc7b8af(0x264)),_0x211738=a96_0xa96e78[_0xc7b8af(0x237)](_0x3da30f,_0xc7b8af(0x262)),_0x45ed88=a96_0xa96e78[_0xc7b8af(0x237)](_0x3da30f,_0xc7b8af(0x261));if(!a96_0x1974b2['existsSync'](_0x22ebf5))throw new SDKError(ErrorCode[_0xc7b8af(0x1f0)],_0xc7b8af(0x1bc)+_0x3da30f,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x259683=parseAgentYaml(a96_0x1974b2['readFileSync'](_0x22ebf5,_0xc7b8af(0x26f)),_0x22ebf5),_0x2ccea1=a96_0x1974b2[_0xc7b8af(0x1b5)](_0x211738)?a96_0x1974b2['readFileSync'](_0x211738,_0xc7b8af(0x26f)):'',_0x271fbc=a96_0x1974b2['existsSync'](_0x45ed88)?a96_0x1974b2[_0xc7b8af(0x1af)](_0x45ed88,_0xc7b8af(0x26f)):_0x259683['starter_message'];if(_0x355fcf?.[_0xc7b8af(0x184)])return{'agentName':_0x259683['name'],'action':'created','projectId':_0x46fc3d};const _0x275ed7=await this[_0xc7b8af(0x26e)]['listAgentsFull'](_0x46fc3d),_0x5450b7=await this[_0xc7b8af(0x26e)]['listKnowledgeBases'](_0x46fc3d),_0x56e485=await this['client'][_0xc7b8af(0x196)](_0x46fc3d),_0x2e467e=await this['client'][_0xc7b8af(0x275)](_0x46fc3d),_0xe7362a=await this[_0xc7b8af(0x26e)]['getParentSegmentKnowledgeBase'](_0x46fc3d),_0x39f888=new Map(),_0x21a43d=new Map(),_0xd66a7b=new Map(),_0xba9014=new Map();for(const _0x46e15e of _0x5450b7){_0x39f888[_0xc7b8af(0x203)](_0x46e15e['attributes']['name'],_0x46e15e['id']);}for(const _0x310526 of _0x56e485){_0x21a43d[_0xc7b8af(0x203)](_0x310526[_0xc7b8af(0x1eb)][_0xc7b8af(0x266)],_0x310526['id']);}for(const _0x2ffeb0 of _0x2e467e){_0xd66a7b[_0xc7b8af(0x203)](_0x2ffeb0[_0xc7b8af(0x1eb)][_0xc7b8af(0x266)],_0x2ffeb0['id']);}for(const _0x3801e0 of _0x275ed7){_0xba9014[_0xc7b8af(0x203)](_0x3801e0[_0xc7b8af(0x1eb)][_0xc7b8af(0x266)],_0x3801e0['id']);}const _0x4fafd7=[],_0x2e1c59={'projectId':_0x46fc3d,'resolveKnowledgeBaseId':async _0x28601a=>_0x39f888[_0xc7b8af(0x1c6)](_0x28601a),'resolveTextKnowledgeBaseId':async _0x31952b=>_0x21a43d[_0xc7b8af(0x1c6)](_0x31952b),'resolveAgentId':async _0xadf2f1=>_0xba9014[_0xc7b8af(0x1c6)](_0xadf2f1),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0xe7362a?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x36ce37=>_0xd66a7b['get'](_0x36ce37),'onWarning':_0x38c613=>{const _0x19ef0b=_0xc7b8af;this[_0x19ef0b(0x282)][_0x19ef0b(0x290)](_0x38c613),_0x4fafd7['push'](_0x38c613);}};try{const _0x402b97=_0x275ed7['find'](_0x3b5580=>_0x3b5580[_0xc7b8af(0x1eb)]['name']===_0x259683['name']),_0x27c03e=await agentDefToRequest(_0x259683,_0x2ccea1,_0x271fbc,_0x2e1c59);if(_0x402b97)return await this[_0xc7b8af(0x26e)][_0xc7b8af(0x181)](_0x402b97['id'],_0x27c03e),{'agentName':_0x259683[_0xc7b8af(0x266)],'action':_0xc7b8af(0x1a4),'projectId':_0x46fc3d,'agentId':_0x402b97['id'],'warnings':_0x4fafd7[_0xc7b8af(0x219)]>0x0?_0x4fafd7:undefined};else{const _0x3522e4=await this[_0xc7b8af(0x26e)]['createAgentResponse'](_0x27c03e);return{'agentName':_0x259683[_0xc7b8af(0x266)],'action':_0xc7b8af(0x17f),'projectId':_0x46fc3d,'agentId':_0x3522e4['id'],'warnings':_0x4fafd7[_0xc7b8af(0x219)]>0x0?_0x4fafd7:undefined};}}catch(_0x11a5d0){return{'agentName':_0x259683[_0xc7b8af(0x266)],'action':'error','projectId':_0x46fc3d,'error':_0x11a5d0[_0xc7b8af(0x1ad)],'warnings':_0x4fafd7[_0xc7b8af(0x219)]>0x0?_0x4fafd7:undefined};}}async[a96_0x5d9617(0x1aa)](_0x4085d3,_0x3dbd55,_0x3b3e06){const _0x343f7f=a96_0x5d9617,_0x10e06f=a96_0x1974b2[_0x343f7f(0x1b5)](_0x4085d3)&&a96_0x1974b2[_0x343f7f(0x1b5)](a96_0xa96e78[_0x343f7f(0x237)](_0x4085d3,_0x343f7f(0x23e)));let _0x2f9f56;const _0x7650f7=[],_0x1e84fd=[],_0x28cd5a=[],_0x29fcc6=[],_0x1dabf9=[],_0x35e971=[],_0x390954=[];if(_0x10e06f){const _0x2bbf4e=loadAgentConfig(a96_0xa96e78['join'](_0x4085d3,_0x343f7f(0x23e)));_0x2f9f56=_0x2bbf4e[_0x343f7f(0x198)];const _0x46619c=a96_0x1974b2['readdirSync'](_0x4085d3,{'withFileTypes':!![]});for(const _0x2b396f of _0x46619c){if(!_0x2b396f[_0x343f7f(0x22f)]())continue;if([_0x343f7f(0x183),_0x343f7f(0x232),'experimental_artifacts',_0x343f7f(0x1e9),_0x343f7f(0x26a)][_0x343f7f(0x1ec)](_0x2b396f['name']))continue;const _0x352d68=a96_0xa96e78['join'](_0x4085d3,_0x2b396f[_0x343f7f(0x266)]);if(isAgentDir(_0x352d68)){const _0x16c5c9=a96_0xa96e78[_0x343f7f(0x237)](_0x352d68,_0x343f7f(0x264)),_0xd85968=a96_0xa96e78[_0x343f7f(0x237)](_0x352d68,_0x343f7f(0x262)),_0x16e3a1=a96_0xa96e78[_0x343f7f(0x237)](_0x352d68,'starter_message.md'),_0x23dbe2=parseAgentYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x16c5c9,_0x343f7f(0x26f)),_0x16c5c9),_0x15169f=a96_0x1974b2[_0x343f7f(0x1b5)](_0xd85968)?a96_0x1974b2[_0x343f7f(0x1af)](_0xd85968,_0x343f7f(0x26f)):'',_0x1a934e=a96_0x1974b2['existsSync'](_0x16e3a1)?a96_0x1974b2[_0x343f7f(0x1af)](_0x16e3a1,'utf-8'):_0x23dbe2['starter_message'];_0x7650f7[_0x343f7f(0x211)]({'name':_0x23dbe2[_0x343f7f(0x266)],'dir':_0x352d68,'yaml':_0x23dbe2,'systemPrompt':_0x15169f,'starterMessage':_0x1a934e});}}const _0x19ae5d=getKnowledgeBasesDir(_0x4085d3);if(a96_0x1974b2['existsSync'](_0x19ae5d)){const _0x3a183c=a96_0x1974b2['readdirSync'](_0x19ae5d);for(const _0x54f1d5 of _0x3a183c){const _0x3da3a1=a96_0xa96e78[_0x343f7f(0x237)](_0x19ae5d,_0x54f1d5);if(_0x54f1d5[_0x343f7f(0x1e5)](_0x343f7f(0x1ee))){const _0x23b6c8=parseKnowledgeBaseYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x3da3a1,'utf-8'),_0x3da3a1);_0x1e84fd[_0x343f7f(0x211)]({'name':_0x23b6c8[_0x343f7f(0x266)],'path':_0x3da3a1,'yaml':_0x23b6c8});}else{if(_0x54f1d5[_0x343f7f(0x1e5)]('.md')){const _0x464365=a96_0x1974b2[_0x343f7f(0x1af)](_0x3da3a1,_0x343f7f(0x26f)),{name:_0x419ec7,text:_0x532ad7}=parseTextKnowledgeBaseMd(_0x464365,_0x54f1d5);_0x28cd5a[_0x343f7f(0x211)]({'name':_0x419ec7,'path':_0x3da3a1,'text':_0x532ad7});}}}}const _0x37998d=getPromptsDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x37998d)){const _0x1fd8f2=a96_0x1974b2['readdirSync'](_0x37998d)[_0x343f7f(0x20e)](_0x23d808=>_0x23d808[_0x343f7f(0x1e5)](_0x343f7f(0x1ee)));for(const _0x421257 of _0x1fd8f2){const _0xba90e0=a96_0xa96e78[_0x343f7f(0x237)](_0x37998d,_0x421257),_0xa0dd6d=parsePromptYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0xba90e0,_0x343f7f(0x26f)),_0xba90e0);_0x29fcc6['push']({'name':_0xa0dd6d[_0x343f7f(0x266)],'path':_0xba90e0,'yaml':_0xa0dd6d});}}const _0x180ae5=getIntegrationsDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x180ae5)){const _0x39ed91=a96_0x1974b2[_0x343f7f(0x1b6)](_0x180ae5)[_0x343f7f(0x20e)](_0x460d6d=>_0x460d6d[_0x343f7f(0x1e5)](_0x343f7f(0x1ee)));for(const _0x56a782 of _0x39ed91){const _0x3d3594=a96_0xa96e78[_0x343f7f(0x237)](_0x180ae5,_0x56a782),_0x2de39a=parseIntegrationYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x3d3594,_0x343f7f(0x26f)),_0x3d3594);SAFE_INTEGRATION_TYPES[_0x343f7f(0x1ec)](_0x2de39a[_0x343f7f(0x259)][_0x343f7f(0x1f9)]())?_0x1dabf9['push']({'name':_0x2de39a[_0x343f7f(0x266)],'path':_0x3d3594,'yaml':_0x2de39a}):this[_0x343f7f(0x282)][_0x343f7f(0x290)](_0x343f7f(0x25f)+_0x2de39a['name']+_0x343f7f(0x204)+_0x2de39a[_0x343f7f(0x259)]+_0x343f7f(0x27d)+(_0x343f7f(0x1ef)+SAFE_INTEGRATION_TYPES[_0x343f7f(0x237)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x115f4e=getExperimentalKnowledgeBasesDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x115f4e)){const _0x4269e2=a96_0x1974b2[_0x343f7f(0x1b6)](_0x115f4e,{'withFileTypes':!![]});for(const _0x34465b of _0x4269e2){if(!_0x34465b['isDirectory']())continue;const _0x5edbee=a96_0xa96e78[_0x343f7f(0x237)](_0x115f4e,_0x34465b[_0x343f7f(0x266)]),_0x23f650=a96_0xa96e78[_0x343f7f(0x237)](_0x5edbee,_0x34465b[_0x343f7f(0x266)]+_0x343f7f(0x1ee));if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x23f650)){const _0x3163bb=parseExperimentalKnowledgeBaseYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x23f650,_0x343f7f(0x26f)),_0x23f650),_0x81b47c=a96_0xa96e78[_0x343f7f(0x237)](_0x5edbee,'functions'),_0x5acba0=[];if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x81b47c)){const _0x50558c=a96_0x1974b2['readdirSync'](_0x81b47c,{'withFileTypes':!![]});for(const _0x386bac of _0x50558c){if(!_0x386bac[_0x343f7f(0x22f)]())continue;const _0x2a347c=a96_0xa96e78[_0x343f7f(0x237)](_0x81b47c,_0x386bac[_0x343f7f(0x266)]),_0x50429d=a96_0xa96e78[_0x343f7f(0x237)](_0x2a347c,_0x343f7f(0x233)),_0x3d752f=a96_0xa96e78[_0x343f7f(0x237)](_0x2a347c,_0x343f7f(0x27b));if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x50429d)&&a96_0x1974b2[_0x343f7f(0x1b5)](_0x3d752f)){const _0x3265b8=a96_0x1974b2['readFileSync'](_0x50429d,_0x343f7f(0x26f)),_0x3f76bd=a96_0x1974b2['readFileSync'](_0x3d752f,_0x343f7f(0x26f));_0x5acba0[_0x343f7f(0x211)]({'name':_0x386bac[_0x343f7f(0x266)],'code':_0x3265b8,'json_schema':_0x3f76bd});}}}const _0x4d349a={..._0x3163bb,'functions':_0x5acba0};_0x35e971['push']({'name':_0x3163bb['name'],'path':_0x5edbee,'def':_0x4d349a});}}}const _0x147148=getExperimentalArtifactsDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x147148)){const _0x22dd92=a96_0x1974b2[_0x343f7f(0x1b6)](_0x147148,{'withFileTypes':!![]});for(const _0x2fb384 of _0x22dd92){if(!_0x2fb384['isDirectory']())continue;const _0x196e62=a96_0xa96e78[_0x343f7f(0x237)](_0x147148,_0x2fb384[_0x343f7f(0x266)]),_0x3b8e8b=a96_0xa96e78[_0x343f7f(0x237)](_0x196e62,_0x2fb384[_0x343f7f(0x266)]+_0x343f7f(0x1ee));if(a96_0x1974b2['existsSync'](_0x3b8e8b)){const _0x5647cd=parseExperimentalArtifactYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x3b8e8b,_0x343f7f(0x26f)),_0x3b8e8b),_0x278e8c=a96_0xa96e78['join'](_0x196e62,'code.js'),_0x76158b=a96_0x1974b2[_0x343f7f(0x1b5)](_0x278e8c)?a96_0x1974b2[_0x343f7f(0x1af)](_0x278e8c,'utf-8'):'',_0x35cd02=a96_0xa96e78[_0x343f7f(0x237)](_0x196e62,_0x343f7f(0x194)),_0x4fbeb4=[];if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x35cd02)){const _0x1b7804=a96_0x1974b2['readdirSync'](_0x35cd02);for(const _0x40269e of _0x1b7804){const _0x486314=a96_0xa96e78[_0x343f7f(0x237)](_0x35cd02,_0x40269e);if(a96_0x1974b2[_0x343f7f(0x1bb)](_0x486314)[_0x343f7f(0x221)]()){const _0x4b97b0=a96_0x1974b2['readFileSync'](_0x486314,_0x343f7f(0x26f));_0x4fbeb4[_0x343f7f(0x211)]({'file_name':_0x40269e,'text_content':_0x4b97b0});}}}const _0x12628b={..._0x5647cd,'code':_0x76158b,'files':_0x4fbeb4};_0x390954[_0x343f7f(0x211)]({'name':_0x5647cd[_0x343f7f(0x266)],'path':_0x196e62,'def':_0x12628b});}}}}else{const _0x2fe475=await this[_0x343f7f(0x260)](_0x4085d3),_0x4a0d44=await this[_0x343f7f(0x26e)]['getProject'](_0x2fe475);_0x2f9f56=_0x4a0d44[_0x343f7f(0x1eb)]['name'];const _0x1ad7c8=await this[_0x343f7f(0x26e)]['listAgentsFull'](_0x2fe475),_0x1d5510=await this[_0x343f7f(0x26e)][_0x343f7f(0x1cb)](_0x2fe475),_0x1c95ea=await this[_0x343f7f(0x26e)][_0x343f7f(0x196)](_0x2fe475),_0xdc0743=await this[_0x343f7f(0x26e)][_0x343f7f(0x1c4)](_0x2fe475),_0x167e59=await this['client'][_0x343f7f(0x276)](_0x2fe475),_0x4aa04e=await this[_0x343f7f(0x26e)][_0x343f7f(0x275)](_0x2fe475),_0x42d238=await this[_0x343f7f(0x26e)]['listExperimentalArtifacts'](_0x2fe475),_0x3ad5a6=new Map(),_0x1839ba=new Map(),_0x29e9b0=new Map(),_0x2de2e2=new Map(),_0x4bda66=new Map(),_0x10cb9a=new Map();for(const _0x475ad1 of _0x1d5510){_0x3ad5a6[_0x343f7f(0x203)](_0x475ad1['id'],_0x475ad1[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}for(const _0x18f45a of _0x1c95ea){_0x1839ba[_0x343f7f(0x203)](_0x18f45a['id'],_0x18f45a['attributes']['name']);}for(const _0x425d6a of _0x1ad7c8){_0x29e9b0['set'](_0x425d6a['id'],_0x425d6a[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}for(const _0x39a319 of _0xdc0743){_0x2de2e2[_0x343f7f(0x203)](_0x39a319['id'],_0x39a319[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}for(const _0x5bda1c of _0x4aa04e){_0x4bda66[_0x343f7f(0x203)](_0x5bda1c['id'],_0x5bda1c['attributes'][_0x343f7f(0x266)]);}for(const _0x566c3e of _0x42d238){_0x10cb9a[_0x343f7f(0x203)](_0x566c3e['id'],_0x566c3e[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}const _0x22005d={'resolveKnowledgeBaseName':async _0x523756=>_0x3ad5a6['get'](_0x523756),'resolveTextKnowledgeBaseName':async _0x839643=>_0x1839ba[_0x343f7f(0x1c6)](_0x839643),'resolveAgentName':async _0x2650c4=>_0x29e9b0[_0x343f7f(0x1c6)](_0x2650c4),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x20b6ed=>_0x2de2e2[_0x343f7f(0x1c6)](_0x20b6ed),'resolveExperimentalKnowledgeBaseName':async _0x24f62c=>_0x4bda66[_0x343f7f(0x1c6)](_0x24f62c),'onWarning':_0x243ad8=>this[_0x343f7f(0x282)][_0x343f7f(0x290)](_0x243ad8)};for(const _0x117bcd of _0x1ad7c8){const _0x2a6b35=await agentResponseToDef(_0x117bcd,_0x22005d),{yaml:_0x5f2e8b,systemPrompt:_0x1cc7de,starterMessage:_0x4b004f}=_0x2a6b35;_0x7650f7[_0x343f7f(0x211)]({'name':_0x5f2e8b['name'],'dir':'','yaml':_0x5f2e8b,'systemPrompt':_0x1cc7de,'starterMessage':_0x4b004f});}for(const _0x13a920 of _0x1d5510){const _0x3de599=apiKnowledgeBaseToYaml(_0x13a920);_0x1e84fd['push']({'name':_0x3de599[_0x343f7f(0x266)],'path':'','yaml':_0x3de599});}for(const _0xcbc8e4 of _0x1c95ea){_0x28cd5a[_0x343f7f(0x211)]({'name':_0xcbc8e4[_0x343f7f(0x1eb)]['name'],'path':'','text':_0xcbc8e4[_0x343f7f(0x1eb)][_0x343f7f(0x206)]});}for(const _0x117d2f of _0xdc0743){const _0x1e2830=await apiPromptToYaml(_0x117d2f,_0x22005d);_0x1e2830&&_0x29fcc6[_0x343f7f(0x211)]({'name':_0x1e2830['name'],'path':'','yaml':_0x1e2830});}for(const _0x31d34a of _0x167e59){if(!_0x31d34a[_0x343f7f(0x1eb)][_0x343f7f(0x227)]&&SAFE_INTEGRATION_TYPES[_0x343f7f(0x1ec)](_0x31d34a[_0x343f7f(0x1eb)]['serviceType'][_0x343f7f(0x1f9)]())){const _0x4df4f6=await apiIntegrationToYaml(_0x31d34a,_0x22005d);_0x1dabf9[_0x343f7f(0x211)]({'name':_0x31d34a[_0x343f7f(0x1eb)][_0x343f7f(0x19a)][_0x343f7f(0x1f9)](),'path':'','yaml':_0x4df4f6});}}for(const _0x5632ab of _0x4aa04e){const _0x24bec6=apiExperimentalKnowledgeBaseToYaml(_0x5632ab);_0x35e971[_0x343f7f(0x211)]({'name':_0x24bec6[_0x343f7f(0x266)],'path':'','def':_0x24bec6});}for(const _0x213cb3 of _0x42d238){const _0x18654a=apiExperimentalArtifactToYaml(_0x213cb3);_0x390954[_0x343f7f(0x211)]({'name':_0x18654a[_0x343f7f(0x266)],'path':'','def':_0x18654a});}}const _0x482670={'sourceProjectName':_0x2f9f56,'newProjectName':_0x3dbd55,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x102169=await this['client'][_0x343f7f(0x20b)](),_0x487409=_0x102169['find'](_0x27f000=>_0x27f000[_0x343f7f(0x1eb)][_0x343f7f(0x266)]===_0x3dbd55);if(_0x487409)throw new SDKError(ErrorCode[_0x343f7f(0x1c0)],_0x343f7f(0x213)+_0x3dbd55+_0x343f7f(0x22d),undefined,{'helpText':_0x343f7f(0x230)});if(_0x3b3e06?.[_0x343f7f(0x184)])return _0x482670[_0x343f7f(0x234)]['agents']['created']=_0x7650f7[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x283)][_0x343f7f(0x17f)]=_0x1e84fd[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x212)][_0x343f7f(0x17f)]=_0x28cd5a[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x19d)][_0x343f7f(0x17f)]=_0x35e971['length'],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1d6)][_0x343f7f(0x17f)]=_0x390954[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1e9)][_0x343f7f(0x17f)]=_0x29fcc6[_0x343f7f(0x219)],_0x482670['counts'][_0x343f7f(0x26a)][_0x343f7f(0x17f)]=_0x1dabf9['length'],_0x482670;const _0x43fdb7=await this[_0x343f7f(0x26e)][_0x343f7f(0x28f)]({'name':_0x3dbd55}),_0xcf1220=_0x43fdb7['id'];_0x482670[_0x343f7f(0x20f)]=_0xcf1220;const _0x28653e=new Map(),_0x263cb9=new Map(),_0x2b8a2e=new Map(),_0x1e6788=new Map(),_0x2d6298=new Map(),_0x5d6d7b=new Map(),_0x2d8030=new Map(),_0x3e868c=new Map(),_0x11eb90=new Set(),_0x17a0ac=new Set();for(const _0x1582dd of _0x7650f7){for(const _0x4534ef of _0x1582dd[_0x343f7f(0x271)][_0x343f7f(0x225)]||[]){if(_0x4534ef[_0x343f7f(0x23f)]===_0x343f7f(0x24c)&&_0x4534ef[_0x343f7f(0x1ba)]){const _0x4f33ba=parseRef(_0x4534ef[_0x343f7f(0x1ba)]);if(_0x4f33ba)_0x11eb90[_0x343f7f(0x240)](_0x4f33ba[_0x343f7f(0x266)]);}else{if(_0x4534ef[_0x343f7f(0x23f)]==='web_search'&&_0x4534ef['target']){const _0xcf6bf4=parseRef(_0x4534ef[_0x343f7f(0x1ba)]);if(_0xcf6bf4)_0x17a0ac[_0x343f7f(0x240)](_0xcf6bf4['name']);}}}}for(const _0x21bf5b of _0x11eb90){try{const _0x27611e=await this['client'][_0x343f7f(0x1f8)]({'projectId':_0xcf1220,'name':_0x21bf5b});_0x2d6298[_0x343f7f(0x203)](_0x21bf5b,_0x27611e['id']),_0x482670[_0x343f7f(0x291)]['push']({'name':_0x21bf5b,'action':'created','id':_0x27611e['id']}),_0x482670['counts'][_0x343f7f(0x291)][_0x343f7f(0x17f)]++;}catch(_0x1d4982){_0x482670[_0x343f7f(0x291)][_0x343f7f(0x211)]({'name':_0x21bf5b,'action':_0x343f7f(0x21b),'error':_0x1d4982['message']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x291)][_0x343f7f(0x17e)]++;}}for(const _0x5dc214 of _0x17a0ac){try{const _0x36c082=await this['client'][_0x343f7f(0x1c2)]({'projectId':_0xcf1220,'name':_0x5dc214});_0x5d6d7b[_0x343f7f(0x203)](_0x5dc214,_0x36c082['id']),_0x482670[_0x343f7f(0x231)][_0x343f7f(0x211)]({'name':_0x5dc214,'action':_0x343f7f(0x17f),'id':_0x36c082['id']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x231)][_0x343f7f(0x17f)]++;}catch(_0x225417){_0x482670['webSearchTools']['push']({'name':_0x5dc214,'action':_0x343f7f(0x21b),'error':_0x225417[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x231)][_0x343f7f(0x17e)]++;}}const _0x1a5fcf=await this[_0x343f7f(0x26e)]['getParentSegmentKnowledgeBase'](_0xcf1220);let _0x3c5115=[];const _0x107d26={'projectId':_0xcf1220,'resolveKnowledgeBaseId':async _0x4a8926=>_0x28653e['get'](_0x4a8926),'resolveTextKnowledgeBaseId':async _0x52a35e=>_0x263cb9[_0x343f7f(0x1c6)](_0x52a35e),'resolveExperimentalKnowledgeBaseId':async _0x25ba39=>_0x2d8030['get'](_0x25ba39),'resolveAgentId':async _0x3ead6a=>_0x2b8a2e[_0x343f7f(0x1c6)](_0x3ead6a),'resolveWebSearchToolId':async _0x16a718=>_0x5d6d7b['get'](_0x16a718),'resolveImageGeneratorId':async _0x2611af=>_0x2d6298[_0x343f7f(0x1c6)](_0x2611af),'resolvePromptId':async _0x335ca8=>_0x1e6788[_0x343f7f(0x1c6)](_0x335ca8),'resolveParentSegmentKBId':async()=>_0x1a5fcf?.['id'],'onWarning':_0x377bc7=>{const _0x335ef7=_0x343f7f;this[_0x335ef7(0x282)]['warn'](_0x377bc7),_0x3c5115[_0x335ef7(0x211)](_0x377bc7);}};for(const _0x52e5c7 of _0x1e84fd){try{const _0x48bd1c=yamlKnowledgeBaseToApi(_0x52e5c7[_0x343f7f(0x271)],_0xcf1220),_0x213937=await this[_0x343f7f(0x26e)][_0x343f7f(0x1fd)](_0x48bd1c);_0x28653e[_0x343f7f(0x203)](_0x52e5c7[_0x343f7f(0x271)][_0x343f7f(0x266)],_0x213937['id']),_0x482670[_0x343f7f(0x283)][_0x343f7f(0x211)]({'name':_0x52e5c7[_0x343f7f(0x271)]['name'],'action':_0x343f7f(0x17f),'id':_0x213937['id']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x283)][_0x343f7f(0x17f)]++;}catch(_0x20bc59){_0x482670[_0x343f7f(0x283)][_0x343f7f(0x211)]({'name':_0x52e5c7['yaml'][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0x20bc59[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x283)]['errors']++;}}for(const _0x3c9508 of _0x28cd5a){try{const _0x3cdd32=yamlTextKnowledgeBaseToApi({'name':_0x3c9508[_0x343f7f(0x266)],'text':_0x3c9508[_0x343f7f(0x206)]},_0xcf1220),_0x1665cc=await this[_0x343f7f(0x26e)][_0x343f7f(0x274)](_0x3cdd32);_0x263cb9[_0x343f7f(0x203)](_0x3c9508[_0x343f7f(0x266)],_0x1665cc['id']),_0x482670['textKnowledgeBases']['push']({'name':_0x3c9508[_0x343f7f(0x266)],'action':'created','id':_0x1665cc['id']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x212)][_0x343f7f(0x17f)]++;}catch(_0x2d04ef){_0x482670['textKnowledgeBases'][_0x343f7f(0x211)]({'name':_0x3c9508['name'],'action':'error','error':_0x2d04ef[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x212)]['errors']++;}}for(const _0x312bca of _0x390954){try{const _0x36ad52=yamlExperimentalArtifactToApi(_0x312bca[_0x343f7f(0x1ea)],_0xcf1220),_0x2514e5=await this['client'][_0x343f7f(0x214)](_0x36ad52);_0x3e868c['set'](_0x312bca[_0x343f7f(0x1ea)]['name'],_0x2514e5['id']),_0x482670[_0x343f7f(0x1d6)][_0x343f7f(0x211)]({'name':_0x312bca[_0x343f7f(0x1ea)]['name'],'action':_0x343f7f(0x17f),'id':_0x2514e5['id']}),_0x482670['counts'][_0x343f7f(0x1d6)][_0x343f7f(0x17f)]++;}catch(_0x5a03dc){_0x482670[_0x343f7f(0x1d6)][_0x343f7f(0x211)]({'name':_0x312bca[_0x343f7f(0x1ea)][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0x5a03dc[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1d6)][_0x343f7f(0x17e)]++;}}for(const _0x46327e of _0x35e971){try{const _0x381c6c=yamlExperimentalKnowledgeBaseToApi(_0x46327e[_0x343f7f(0x1ea)],_0xcf1220),_0x4e38f8=await this['client'][_0x343f7f(0x19f)](_0x381c6c);_0x2d8030[_0x343f7f(0x203)](_0x46327e[_0x343f7f(0x1ea)]['name'],_0x4e38f8['id']),_0x482670[_0x343f7f(0x19d)][_0x343f7f(0x211)]({'name':_0x46327e[_0x343f7f(0x1ea)][_0x343f7f(0x266)],'action':_0x343f7f(0x17f),'id':_0x4e38f8['id']}),_0x482670['counts'][_0x343f7f(0x19d)][_0x343f7f(0x17f)]++;}catch(_0x9a1f36){_0x482670['experimentalKnowledgeBases'][_0x343f7f(0x211)]({'name':_0x46327e['def'][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0x9a1f36['message']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x19d)]['errors']++;}}const _0x4e7402=[..._0x7650f7][_0x343f7f(0x22e)]((_0xd62b3a,_0x5113fa)=>{const _0x122db5=_0x343f7f,_0xde31df=_0xd62b3a[_0x122db5(0x271)]['tools']?.[_0x122db5(0x205)](_0x3a892a=>_0x3a892a[_0x122db5(0x23f)]===_0x122db5(0x256))??![],_0x595e19=_0x5113fa['yaml'][_0x122db5(0x225)]?.[_0x122db5(0x205)](_0x428379=>_0x428379[_0x122db5(0x23f)]===_0x122db5(0x256))??![];if(_0xde31df&&!_0x595e19)return 0x1;if(!_0xde31df&&_0x595e19)return-0x1;return 0x0;});for(const _0x148d48 of _0x4e7402){_0x3c5115=[];try{const _0x5e8cff=_0x148d48[_0x343f7f(0x271)][_0x343f7f(0x225)]?.['filter'](_0x4dbb60=>{const _0x37d233=_0x343f7f;if(_0x4dbb60[_0x37d233(0x23f)]===_0x37d233(0x256)&&_0x4dbb60[_0x37d233(0x1ba)]){const _0xa0d677=parseRef(_0x4dbb60[_0x37d233(0x1ba)]);return _0xa0d677?.['name']===_0x148d48[_0x37d233(0x271)][_0x37d233(0x266)];}return![];})??[];if(_0x5e8cff[_0x343f7f(0x219)]>0x0){const _0x3f553f=_0x343f7f(0x279)+_0x148d48[_0x343f7f(0x271)][_0x343f7f(0x266)]+_0x343f7f(0x23b)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger']['warn'](_0x3f553f),_0x3c5115[_0x343f7f(0x211)](_0x3f553f);}const _0x3db7f7=await agentDefToRequest(_0x148d48['yaml'],_0x148d48[_0x343f7f(0x21c)],_0x148d48['starterMessage'],_0x107d26),_0x22e7ac=await this['client'][_0x343f7f(0x23c)](_0x3db7f7);_0x2b8a2e[_0x343f7f(0x203)](_0x148d48['yaml'][_0x343f7f(0x266)],_0x22e7ac['id']),_0x482670[_0x343f7f(0x1e3)][_0x343f7f(0x211)]({'agentName':_0x148d48['yaml'][_0x343f7f(0x266)],'action':_0x343f7f(0x17f),'agentId':_0x22e7ac['id'],'warnings':_0x3c5115[_0x343f7f(0x219)]>0x0?_0x3c5115:undefined}),_0x482670[_0x343f7f(0x234)]['agents'][_0x343f7f(0x17f)]++;}catch(_0xb9845a){_0x482670[_0x343f7f(0x1e3)][_0x343f7f(0x211)]({'agentName':_0x148d48['yaml'][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0xb9845a[_0x343f7f(0x1ad)],'warnings':_0x3c5115[_0x343f7f(0x219)]>0x0?_0x3c5115:undefined}),_0x482670[_0x343f7f(0x234)]['agents'][_0x343f7f(0x17e)]++;}}for(const _0x318ce8 of _0x29fcc6){try{const _0x90b250=await yamlPromptToApi(_0x318ce8[_0x343f7f(0x271)],_0xcf1220,_0x107d26);if(!_0x90b250){_0x482670[_0x343f7f(0x1e9)]['push']({'name':_0x318ce8['yaml']['name'],'action':'error','error':_0x343f7f(0x28d)}),_0x482670['counts'][_0x343f7f(0x1e9)]['errors']++;continue;}const _0x2093dc=await this[_0x343f7f(0x26e)][_0x343f7f(0x207)](_0x90b250);_0x1e6788[_0x343f7f(0x203)](_0x318ce8[_0x343f7f(0x271)]['name'],_0x2093dc['id']),_0x482670[_0x343f7f(0x1e9)][_0x343f7f(0x211)]({'name':_0x318ce8[_0x343f7f(0x271)]['name'],'action':_0x343f7f(0x17f),'id':_0x2093dc['id']}),_0x482670['counts'][_0x343f7f(0x1e9)]['created']++;}catch(_0x22c95b){_0x482670['prompts'][_0x343f7f(0x211)]({'name':_0x318ce8['yaml']['name'],'action':_0x343f7f(0x21b),'error':_0x22c95b[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1e9)][_0x343f7f(0x17e)]++;}}for(const _0xb4e0e4 of _0x1dabf9){try{const _0x33f5ca=await yamlIntegrationToApi(_0xb4e0e4[_0x343f7f(0x271)],_0xcf1220,_0x107d26),_0x434307=await this[_0x343f7f(0x26e)][_0x343f7f(0x23d)](_0x33f5ca);_0x482670[_0x343f7f(0x26a)][_0x343f7f(0x211)]({'name':_0xb4e0e4[_0x343f7f(0x271)][_0x343f7f(0x259)],'action':'created','id':_0x434307['id']}),_0x482670['counts'][_0x343f7f(0x26a)]['created']++;}catch(_0x2998b7){_0x482670[_0x343f7f(0x26a)][_0x343f7f(0x211)]({'name':_0xb4e0e4[_0x343f7f(0x271)][_0x343f7f(0x259)],'action':'error','error':_0x2998b7['message']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x26a)]['errors']++;}}return _0x482670;}}
1
+ const a97_0x5796d4=a97_0xb400;(function(_0x109c9b,_0x13a64a){const _0x1d765f=a97_0xb400,_0x730b92=_0x109c9b();while(!![]){try{const _0x3bcbd4=-parseInt(_0x1d765f(0x161))/0x1*(-parseInt(_0x1d765f(0x155))/0x2)+parseInt(_0x1d765f(0xd8))/0x3+-parseInt(_0x1d765f(0x14c))/0x4+-parseInt(_0x1d765f(0x185))/0x5*(parseInt(_0x1d765f(0x164))/0x6)+-parseInt(_0x1d765f(0xad))/0x7*(-parseInt(_0x1d765f(0xf5))/0x8)+-parseInt(_0x1d765f(0x86))/0x9*(parseInt(_0x1d765f(0x14a))/0xa)+-parseInt(_0x1d765f(0x19e))/0xb;if(_0x3bcbd4===_0x13a64a)break;else _0x730b92['push'](_0x730b92['shift']());}catch(_0x29d35a){_0x730b92['push'](_0x730b92['shift']());}}}(a97_0x10df,0xb601e));import{LLMApiClient}from'../client/llm-api-client.js';import*as a97_0x14cb22 from'node:fs';import*as a97_0x53f5e9 from'node:path';function a97_0xb400(_0x4bb2e4,_0xe7620c){_0x4bb2e4=_0x4bb2e4-0x82;const _0x10dfe7=a97_0x10df();let _0xb40038=_0x10dfe7[_0x4bb2e4];return _0xb40038;}import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';function a97_0x10df(){const _0x1a5a5c=['path','listProjects','\x20---\x0a','Unsupported\x20backup\x20version:\x20','updateTextKnowledgeBase','\x27.\x20This\x20should\x20not\x20happen.','.md','startChat','project.json','NOT_FOUND','agents.json','variables','newProjectId','\x27\x20(','medium','already\x20exists','unchanged','#\x20prompt.md\x0a','listWebSearchTools','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','warn','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','getCurrentProject','agent','info','INTERNAL','Unable\x20to\x20create\x20project\x20after\x20','chatIgnoreManagedActions','isManaged','message','10YqsyXP','isFile','1536908dbnHZD','conflict','target','history','LLM_PROJECT_NOT_FOUND','isDir','createTextKnowledgeBase','.yml','includes','2581238PWJlYr','profile','PERMISSION_DENIED','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','yaml','restoreProject','serviceType','client','setCurrentProject','writeFileSync','loadJsonFile','text_content','1ndxWKE','Multiple\x20agents\x20found\x20with\x20name\x20\x27','clearDefaultAgent','12NSebml','isDirectory','No\x20tdx.json\x20found\x20in\x20','get',')\x20can\x20be\x20cloned.','stringify','site','pullProject','AGENT_NOT_FOUND','.llm','(dry-run)','unlinkSync','basename','reasoningEffort','createImageGenerator','\x20→\x20','none','push','set','webSearchTools','prompt.md','getProject','localeCompare','statSync','json_schema','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.','createProject','errors','size','signal','project','some','textKnowledgeBases','641230BKnthu','):\x20','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','starter_message.md','jsonSchemaHint','parse','getDefaultProjectName','renamed','chatId','listAgents','chatWelcomeMessage','resolveProjectId','createKnowledgeBase','version','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','Renamed\x20experimental\x20KB\x20directory:\x20','pullAgent','dry-run-','listAgentsFull','updatePrompt','new','updateExperimentalKnowledgeBase','length','Renamed\x20folder:\x20','starter_message','1934163rqRNMH','createIntegration','chat_parent_segment','integrations.json','prompts','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','createExperimentalKnowledgeBase','duplicate','2470383NNxUyy','modelType','deleteAgent','readdirSync','counts','agent.yml','agentId','listExperimentalArtifacts','listTextKnowledgeBases','promptId','ExperimentalKnowledgeBase','Removed\x20deleted\x20directory:\x20','listChats','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','resolveProjectName','pushProject','Renamed\x20experimental\x20artifact\x20directory:\x20','deleteIntegration','oldPath','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','createPrompt','add','chat_generic','experimentalArtifacts','error','getBackupMetadata','Renamed\x20prompt\x20file:\x20','chats','knowledge_bases','low','cwd','Renamed\x20agent\x20folder:\x20','Project\x20not\x20found:\x20','def','currentProjectId','Unresolved\x20dependencies:\x20','join','1786687EenEwt','getChatInfo','\x0a\x0a#\x20agent.yml\x0a','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','listExperimentalKnowledgeBases','experimental_artifacts','\x0a---\x20schema:\x20','resolveAgentId','listToolTargets','toISOString','Skipping\x20integration\x20\x27','slackMessageMode','knowledgebases.json','createAgentResponse','web_search','Removed\x20deleted\x20file:\x20','dir','experimentalKnowledgeBases','high','INVALID_ARGUMENT','displayName','filter','getOrCreateDefaultProject','exportedFrom','Renamed\x20KB\x20file:\x20','getDefaultAgent','sort','claude-4.5-sonnet','pushAgent','status','service_type','file_name','KnowledgeBase','Project\x20\x22','existsSync','created','\x0a---\x20function:\x20','\x22\x20already\x20exists','metadata','createExperimentalArtifact','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','listIntegrations','knowledgeBases','872043fuRIiJ','text','getChatHistory','rmSync','availableModels','getChatLog','action','tdx_','agents','functions','files','cloneProject','template','models','readFileSync','prompts.json','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','has','ALREADY_EXISTS','code','nameToId','actions','toLowerCase','imageGenerators','\x20in\x20project\x20','tdx_default_','dryRun','find','llm_project','8RkBsZB','endsWith','mkdirSync','type','experimental_knowledge_bases','TextKnowledgeBase','attributes','chat','updateAgent','\x0a---\x20code\x20---\x0a','code.js','total','tdDatabaseName','setDefaultAgent','UNAUTHENTICATED','systemPrompt','event','createAgent','tools','Agent\x20not\x20found:\x20','utf-8','map','tdx.json','continueChat','split','Agent\x20reference\x20not\x20found','getAgent','integrations','Multiple\x20projects\x20found\x20with\x20name\x20\x27','json_schema.json','deleteProject','updateKnowledgeBase','dirname','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','name','projectName','starterMessage','---\x20file:\x20','listPrompts','temperature','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','createWebSearchTool','image_gen','context','Renamed\x20integration\x20file:\x20','Only\x20safe\x20types\x20(','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','updated','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','listKnowledgeBases','tables','logger','Invalid\x20agent\x20reference\x20format:\x20','projects','agent.yml\x20not\x20found\x20in\x20'];a97_0x10df=function(){return _0x1a5a5c;};return a97_0x10df();}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=[a97_0x5796d4(0x9e),'chat_agent_console',a97_0x5796d4(0x1a0)];export class LLMSDK{[a97_0x5796d4(0xaa)];[a97_0x5796d4(0x15c)];['context'];['logger']=Logger['of']('sdk.llm');constructor(_0x1e158c){const _0x4db701=a97_0x5796d4;this[_0x4db701(0x15c)]=new LLMApiClient(_0x1e158c),this['context']=_0x1e158c;}[a97_0x5796d4(0x18b)](){const _0x5eeb10=a97_0x5796d4,_0x617de5=getSanitizedUsername();return _0x5eeb10(0xf1)+_0x617de5;}async[a97_0x5796d4(0x15d)](_0x593da5){const _0x1fd49e=a97_0x5796d4,{projectId:_0x428a09}=await this[_0x1fd49e(0x95)](_0x593da5);this[_0x1fd49e(0xaa)]=_0x428a09;}[a97_0x5796d4(0x142)](){return this['currentProjectId'];}async[a97_0x5796d4(0x102)](_0x27e035){const _0x3a93bd=a97_0x5796d4,_0x2331a4=this[_0x3a93bd(0x120)]['profile'];let _0x20a119,_0x37c832;if(_0x27e035[_0x3a93bd(0x154)]('/')){const _0x4c7a7f=_0x27e035[_0x3a93bd(0x10d)]('/');if(_0x4c7a7f[_0x3a93bd(0x19b)]!==0x2)throw new SDKError(ErrorCode[_0x3a93bd(0xc0)],_0x3a93bd(0x129)+_0x27e035,undefined,{'helpText':_0x3a93bd(0x193)});const [_0x20a041,_0x4c5b8a]=_0x4c7a7f;_0x20a119=await this[_0x3a93bd(0x190)](_0x20a041),_0x37c832=_0x4c5b8a;}else _0x20a119=this[_0x3a93bd(0xaa)]||(await this[_0x3a93bd(0xc3)]())['id'],_0x37c832=_0x27e035;const _0x58761d=await this[_0x3a93bd(0xb4)](_0x37c832,_0x20a119),_0x220daa=await this[_0x3a93bd(0x15c)][_0x3a93bd(0x10f)](_0x58761d);writeCachedLLMAgent(_0x220daa['attributes'][_0x3a93bd(0x117)],_0x58761d,_0x20a119,_0x2331a4);}[a97_0x5796d4(0xc6)](){const _0x360fdf=a97_0x5796d4,_0x45d978=this[_0x360fdf(0x120)][_0x360fdf(0x156)];return readCachedLLMAgent(_0x45d978)||undefined;}[a97_0x5796d4(0x163)](){const _0x38c55f=a97_0x5796d4,_0x19e330=this[_0x38c55f(0x120)][_0x38c55f(0x156)];clearCachedLLMAgent(_0x19e330);}async[a97_0x5796d4(0xe5)](){const _0x5f2671=a97_0x5796d4,_0x457b28=await this[_0x5f2671(0x15c)]['getUserSettings'](),_0x2480dc=[];for(const _0x26224f of _0x457b28['availableModelNames']){const _0x39e8c9=_0x457b28[_0x5f2671(0xdc)][_0x26224f];_0x39e8c9&&_0x2480dc[_0x5f2671(0x175)]({'name':_0x26224f,'displayName':_0x39e8c9[_0x5f2671(0xc1)]});}return _0x2480dc;}async[a97_0x5796d4(0x17e)](_0x1680a3){const _0x27df74=a97_0x5796d4;return await this[_0x27df74(0x15c)]['createProject'](_0x1680a3);}async[a97_0x5796d4(0x113)](_0xdff4a3){const _0x7fe94f=a97_0x5796d4,{projectId:_0x410487}=await this[_0x7fe94f(0x95)](_0xdff4a3);await this[_0x7fe94f(0x15c)][_0x7fe94f(0x113)](_0x410487);}async[a97_0x5796d4(0x12a)](_0x2e58b7=0x32){const _0x50a617=a97_0x5796d4;return await this[_0x50a617(0x15c)][_0x50a617(0x12d)](_0x2e58b7);}async[a97_0x5796d4(0xc3)](_0x541d0d){const _0x3f919d=a97_0x5796d4,_0x28b21d=_0x541d0d||this['getDefaultProjectName'](),_0xb15c83=this[_0x3f919d(0x120)][_0x3f919d(0x156)];if(!_0x541d0d){const _0xb2ac6c=readCachedLLMProject(_0xb15c83);if(_0xb2ac6c&&_0xb2ac6c[_0x3f919d(0x117)]===_0x28b21d)try{const _0x43b16b=await this[_0x3f919d(0x15c)][_0x3f919d(0x179)](_0xb2ac6c['id']);if(_0x43b16b['attributes'][_0x3f919d(0x117)]===_0x28b21d)return _0x43b16b;}catch{}}const _0x10ca0b=await this['client'][_0x3f919d(0x12d)](),_0x2bb221=_0x10ca0b[_0x3f919d(0xf3)](_0x2e594c=>_0x2e594c[_0x3f919d(0xfb)][_0x3f919d(0x117)]===_0x28b21d);if(_0x2bb221)return!_0x541d0d&&writeCachedLLMProject(_0x28b21d,_0x2bb221['id'],_0xb15c83),_0x2bb221;const _0x20fd23=await this['client'][_0x3f919d(0x17e)]({'name':_0x28b21d,'description':_0x3f919d(0x116)+getSanitizedUsername()+')'});return!_0x541d0d&&writeCachedLLMProject(_0x28b21d,_0x20fd23['id'],_0xb15c83),_0x20fd23;}async[a97_0x5796d4(0x190)](_0x5dab59){const _0x1fd659=a97_0x5796d4,_0x180ac8=await this['client']['listProjects'](),_0x3e3f66=_0x180ac8['filter'](_0x2b4e10=>_0x2b4e10[_0x1fd659(0xfb)][_0x1fd659(0x117)]===_0x5dab59);if(_0x3e3f66[_0x1fd659(0x19b)]===0x0)throw new SDKError(ErrorCode[_0x1fd659(0x150)],_0x1fd659(0xa8)+_0x5dab59,undefined,{'helpText':_0x1fd659(0x141)});if(_0x3e3f66[_0x1fd659(0x19b)]>0x1)throw new SDKError(ErrorCode[_0x1fd659(0x145)],_0x1fd659(0x111)+_0x5dab59+_0x1fd659(0x131));return _0x3e3f66[0x0]['id'];}async[a97_0x5796d4(0x95)](_0x337ad4){const _0x43e0d9=a97_0x5796d4,_0x7fba91=await this[_0x43e0d9(0x15c)][_0x43e0d9(0x12d)](),_0x4d8eb3=_0x7fba91[_0x43e0d9(0xf3)](_0x4d5314=>_0x4d5314[_0x43e0d9(0xfb)][_0x43e0d9(0x117)]===_0x337ad4);if(_0x4d8eb3)return{'projectId':_0x4d8eb3['id'],'project':_0x4d8eb3};throw new SDKError(ErrorCode[_0x43e0d9(0x150)],_0x43e0d9(0xa8)+_0x337ad4,undefined,{'helpText':_0x43e0d9(0x141)});}async['getOrCreateDefaultAgent'](_0x128b41=a97_0x5796d4(0xc8),_0x145067=0x0,_0x1bb512){const _0xd464b9=a97_0x5796d4,_0x2e4c3f=0xa;let _0x30715a=0x0,_0xd95a4c;while(_0x30715a<_0x2e4c3f){try{const _0x1a6255=await this[_0xd464b9(0xc3)](_0xd95a4c),_0x5acec7=_0x1a6255['id'],_0x4953ba=[_0xd464b9(0x174),'minimal',_0xd464b9(0xa5),_0xd464b9(0x13a),_0xd464b9(0xbf)],_0x36024f=_0x145067===0x0?_0xd464b9(0xdf)+_0x128b41:_0xd464b9(0xdf)+_0x128b41+'_reasoning_'+_0x4953ba[_0x145067],_0x3941d7=await this[_0xd464b9(0x15c)][_0xd464b9(0x18e)](_0x5acec7),_0x586916=_0x3941d7[_0xd464b9(0xf3)](_0x39a3d0=>_0x39a3d0[_0xd464b9(0xfb)][_0xd464b9(0x117)]===_0x36024f);if(_0x586916)return _0x586916;const _0xe9c724=_0x145067>0x0?0x1:_0x1bb512;return await this[_0xd464b9(0x15c)]['createAgent']({'name':_0x36024f,'projectId':_0x5acec7,'modelType':_0x128b41,'systemPrompt':'','temperature':_0xe9c724,'reasoningEffort':_0x145067>0x0?_0x145067:undefined});}catch(_0x48b559){if(_0x48b559 instanceof HTTPClientError){const _0x42482c=_0x48b559[_0xd464b9(0xca)];if(_0x42482c>=0x190&&_0x42482c<0x1f4){if(_0x42482c===0x191)throw new SDKError(ErrorCode[_0xd464b9(0x103)],_0xd464b9(0xb0),_0x48b559);else{if(_0x42482c===0x193)throw new SDKError(ErrorCode[_0xd464b9(0x157)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x48b559);}throw _0x48b559;}}if(errorContains(_0x48b559,_0xd464b9(0x13b),_0xd464b9(0x85),_0xd464b9(0x14d))){_0x30715a++;if(_0x30715a>=_0x2e4c3f)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0xd464b9(0x146)+_0x2e4c3f+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x48b559);const _0x11dc2b=this[_0xd464b9(0x18b)]();_0xd95a4c=_0x11dc2b+'_'+generateRandomHex();continue;}throw _0x48b559;}}throw new SDKError(ErrorCode['INTERNAL'],_0xd464b9(0x9b));}async[a97_0x5796d4(0xb4)](_0x35f352,_0x197904){const _0x358c1c=a97_0x5796d4,_0x604b12=_0x197904||this[_0x358c1c(0xaa)],_0x278d14=await this[_0x358c1c(0x15c)][_0x358c1c(0x18e)](_0x604b12),_0x5664ca=_0x278d14[_0x358c1c(0xc2)](_0x25cf14=>_0x25cf14[_0x358c1c(0xfb)][_0x358c1c(0x117)]===_0x35f352);if(_0x5664ca['length']===0x0){const _0xc7d4cd=_0x604b12?_0x358c1c(0xf0)+_0x604b12:'';throw new SDKError(ErrorCode[_0x358c1c(0x16c)],'Agent\x20not\x20found:\x20'+_0x35f352+_0xc7d4cd,undefined,{'helpText':_0x604b12?_0x358c1c(0x13f):_0x358c1c(0x17d)});}if(_0x5664ca[_0x358c1c(0x19b)]>0x1)throw new SDKError(ErrorCode[_0x358c1c(0x145)],_0x358c1c(0x162)+_0x35f352+_0x358c1c(0x131));return _0x5664ca[0x0]['id'];}async[a97_0x5796d4(0xe0)](_0x6873d7){const _0x3c5a89=a97_0x5796d4,_0x58881b=_0x6873d7||this[_0x3c5a89(0xaa)];return await this[_0x3c5a89(0x15c)]['listAgents'](_0x58881b);}async['agentsFull'](_0x10447e){const _0x4bd268=a97_0x5796d4;return await this[_0x4bd268(0x15c)]['listAgentsFull'](_0x10447e);}async['agent'](_0x3c37e7){const _0x28f0c4=a97_0x5796d4;return await this[_0x28f0c4(0x15c)]['getAgent'](_0x3c37e7);}async[a97_0x5796d4(0x106)](_0x41b930){return await this['client']['createAgent'](_0x41b930);}async[a97_0x5796d4(0xfd)](_0x3e4d4e,_0x298b57){const _0x4e9219=a97_0x5796d4;return await this[_0x4e9219(0x15c)]['updateAgent'](_0x3e4d4e,_0x298b57);}async[a97_0x5796d4(0x88)](_0x5dfd2c){const _0x2d68a7=a97_0x5796d4;await this[_0x2d68a7(0x15c)][_0x2d68a7(0x88)](_0x5dfd2c);}async[a97_0x5796d4(0x133)](_0x2bdcdf){const _0x18ef49=a97_0x5796d4;return await this[_0x18ef49(0x15c)][_0x18ef49(0x133)]({'agentId':_0x2bdcdf});}async*[a97_0x5796d4(0xfc)](_0x30c04d,_0xec99ea){const _0x482345=a97_0x5796d4;let _0x46013e=_0xec99ea?.[_0x482345(0x18d)];const _0x3fac33=_0xec99ea?.[_0x482345(0x8c)];if(!_0x46013e){if(!_0x3fac33)throw new Error(_0x482345(0x187));const _0x275244=await this['client']['startChat']({'agentId':_0x3fac33});_0x46013e=_0x275244['id'],yield{'type':_0x482345(0xd3),'data':{'chatId':_0x46013e,'agentId':_0x3fac33,'projectId':_0x275244[_0x482345(0xfb)]['projectId']}};}for await(const _0x4ef30f of this[_0x482345(0x15c)][_0x482345(0x10c)](_0x46013e,_0x30c04d,_0xec99ea?.[_0x482345(0x181)])){yield{'type':_0x482345(0x105),'data':_0x4ef30f};}}async[a97_0x5796d4(0xa3)](_0x43c341=0x32){const _0xcaa4e1=a97_0x5796d4;return await this['client'][_0xcaa4e1(0x92)](_0x43c341);}async[a97_0x5796d4(0x14f)](_0x58277e){const _0x2b9fab=a97_0x5796d4;return await this[_0x2b9fab(0x15c)][_0x2b9fab(0xda)](_0x58277e);}async[a97_0x5796d4(0xdd)](_0x71013e){const _0x328a19=a97_0x5796d4;return await this[_0x328a19(0x15c)][_0x328a19(0xdd)](_0x71013e);}async['chatInfo'](_0x2f5de3){const _0x596acc=a97_0x5796d4;return await this[_0x596acc(0x15c)][_0x596acc(0xae)](_0x2f5de3);}async['backupProject'](_0x280240,_0x10e871,_0x5a546a){const _0x3a8d8e=a97_0x5796d4,_0x2bd3b9=_0x5a546a?.[_0x3a8d8e(0xf2)]??![],{projectId:_0x3a6aa6,project:_0x64e793}=await this[_0x3a8d8e(0x95)](_0x280240),_0x3a5907=_0x64e793['attributes'][_0x3a8d8e(0x117)],_0x28eb59=_0x10e871||_0x3a5907+_0x3a8d8e(0x16d);if(a97_0x14cb22[_0x3a8d8e(0xcf)](_0x28eb59)&&!_0x2bd3b9)throw new SDKError(ErrorCode[_0x3a8d8e(0xea)],'Output\x20directory\x20already\x20exists:\x20'+_0x28eb59,undefined,{'helpText':_0x3a8d8e(0x93)});const _0x5795ef=await this[_0x3a8d8e(0x15c)]['listAgentsFull'](_0x3a6aa6),_0x3b7990=await this[_0x3a8d8e(0x15c)][_0x3a8d8e(0x126)](_0x3a6aa6),_0x1a2cbe=await this['client'][_0x3a8d8e(0x11b)](_0x3a6aa6),_0x1185af=await this[_0x3a8d8e(0x15c)]['listIntegrations'](_0x3a6aa6);if(!_0x2bd3b9){a97_0x14cb22['mkdirSync'](_0x28eb59,{'recursive':!![]});const _0x1da19a={'version':'1.0','exportedAt':new Date()[_0x3a8d8e(0xb6)](),'exportedFrom':{'site':this['context'][_0x3a8d8e(0x16a)],'projectId':_0x3a6aa6,'projectName':_0x3a5907},'project':_0x64e793};a97_0x14cb22['writeFileSync'](a97_0x53f5e9[_0x3a8d8e(0xac)](_0x28eb59,_0x3a8d8e(0x134)),JSON[_0x3a8d8e(0x169)](_0x1da19a,null,0x2)),a97_0x14cb22[_0x3a8d8e(0x15e)](a97_0x53f5e9[_0x3a8d8e(0xac)](_0x28eb59,_0x3a8d8e(0x136)),JSON['stringify'](_0x5795ef,null,0x2)),a97_0x14cb22[_0x3a8d8e(0x15e)](a97_0x53f5e9[_0x3a8d8e(0xac)](_0x28eb59,_0x3a8d8e(0xb9)),JSON[_0x3a8d8e(0x169)](_0x3b7990,null,0x2)),a97_0x14cb22[_0x3a8d8e(0x15e)](a97_0x53f5e9[_0x3a8d8e(0xac)](_0x28eb59,_0x3a8d8e(0xe7)),JSON[_0x3a8d8e(0x169)](_0x1a2cbe,null,0x2)),a97_0x14cb22['writeFileSync'](a97_0x53f5e9[_0x3a8d8e(0xac)](_0x28eb59,'integrations.json'),JSON[_0x3a8d8e(0x169)](_0x1185af,null,0x2));}return{'projectName':_0x3a5907,'outputDir':_0x28eb59,'counts':{'agents':_0x5795ef[_0x3a8d8e(0x19b)],'knowledgeBases':_0x3b7990[_0x3a8d8e(0x19b)],'prompts':_0x1a2cbe[_0x3a8d8e(0x19b)],'integrations':_0x1185af[_0x3a8d8e(0x19b)]}};}async[a97_0x5796d4(0x15a)](_0x110f01,_0x5c89d7){const _0xed6179=a97_0x5796d4,_0x3e5455=_0x5c89d7?.[_0xed6179(0xf2)]??![],_0x130d82=this[_0xed6179(0xa1)](_0x110f01),_0x1700ef=_0x130d82[_0xed6179(0xc4)]['site'],_0x481b4b=this['context'][_0xed6179(0x16a)],_0x384479=_0x1700ef!==_0x481b4b?_0x1700ef:undefined,_0x1b98f7=this['loadJsonFile'](a97_0x53f5e9['join'](_0x110f01,_0xed6179(0x136)),[]),_0xaf9230=this['loadJsonFile'](a97_0x53f5e9['join'](_0x110f01,'knowledgebases.json'),[]),_0x3adcb0=this['loadJsonFile'](a97_0x53f5e9[_0xed6179(0xac)](_0x110f01,_0xed6179(0xe7)),[]),_0x219a0a=this['loadJsonFile'](a97_0x53f5e9[_0xed6179(0xac)](_0x110f01,_0xed6179(0x1a1)),[]),_0x4b02ea=_0x5c89d7?.[_0xed6179(0x117)]||_0x130d82[_0xed6179(0xc4)][_0xed6179(0x118)];if(_0x3e5455){const _0x53a0ab=new Map(),_0x44adac=[..._0x1b98f7],_0x8a52e2=_0x1b98f7[_0xed6179(0x19b)]+0x1;let _0x3e4948=0x0;while(_0x44adac[_0xed6179(0x19b)]>0x0&&_0x3e4948<_0x8a52e2){_0x3e4948++;const _0x2a0989=[];for(const _0xbde7cc of _0x44adac){canCreateAgent(_0xbde7cc,_0x53a0ab)?_0x53a0ab[_0xed6179(0x176)](_0xbde7cc['id'],_0xed6179(0x196)+_0xbde7cc['id']):_0x2a0989[_0xed6179(0x175)](_0xbde7cc);}if(_0x2a0989[_0xed6179(0x19b)]===_0x44adac[_0xed6179(0x19b)])throw new SDKError(ErrorCode[_0xed6179(0x145)],_0xed6179(0xd5),undefined,{'helpText':_0xed6179(0x9a)});_0x44adac[_0xed6179(0x19b)]=0x0,_0x44adac[_0xed6179(0x175)](..._0x2a0989);}const _0x16dab5=_0x3adcb0[_0xed6179(0xc2)](_0x59c9be=>_0x53a0ab[_0xed6179(0xe9)](_0x59c9be[_0xed6179(0xfb)][_0xed6179(0x8c)]))[_0xed6179(0x19b)];return{'projectName':_0x4b02ea,'projectId':_0xed6179(0x16e),'counts':{'agents':_0x1b98f7[_0xed6179(0x19b)],'knowledgeBases':_0xaf9230['length'],'prompts':_0x16dab5,'integrations':_0x219a0a[_0xed6179(0x19b)]},'sourceSite':_0x384479};}const _0x59fa65=await this[_0xed6179(0x15c)][_0xed6179(0x17e)]({'name':_0x4b02ea,'description':_0x130d82[_0xed6179(0x182)][_0xed6179(0xfb)]['description']}),_0x252587=_0x59fa65['id'],_0x3bd614=new Map(),_0x22a274=new Map(),_0x26ae80=new Map();for(const _0x373de6 of _0xaf9230){const _0x3fbf7d=await this[_0xed6179(0x15c)][_0xed6179(0x191)]({'projectId':_0x252587,'name':_0x373de6[_0xed6179(0xfb)][_0xed6179(0x117)],'tdDatabaseName':_0x373de6[_0xed6179(0xfb)][_0xed6179(0x101)],'tables':_0x373de6[_0xed6179(0xfb)][_0xed6179(0x127)]});_0x3bd614[_0xed6179(0x176)](_0x373de6['id'],_0x3fbf7d['id']);}const _0x55d3e3=[..._0x1b98f7],_0x4d954a=_0x1b98f7[_0xed6179(0x19b)]+0x1;let _0x347650=0x0;while(_0x55d3e3[_0xed6179(0x19b)]>0x0&&_0x347650<_0x4d954a){_0x347650++;const _0x175ece=[];for(const _0x2d4070 of _0x55d3e3){if(canCreateAgent(_0x2d4070,_0x22a274)){const _0x3705bb=remapToolIds(_0x2d4070[_0xed6179(0xfb)][_0xed6179(0x107)],_0x3bd614,_0x22a274),_0xaa148d=remapVariableIds(_0x2d4070[_0xed6179(0xfb)][_0xed6179(0x137)],_0x3bd614),_0x24b0dd=await this[_0xed6179(0x15c)]['createAgentResponse']({'name':_0x2d4070[_0xed6179(0xfb)]['name'],'projectId':_0x252587,'systemPrompt':_0x2d4070['attributes']['systemPrompt'],'starterMessage':_0x2d4070[_0xed6179(0xfb)][_0xed6179(0x119)],'modelType':migrateModelType(_0x2d4070['attributes'][_0xed6179(0x87)]),'maxToolIterations':_0x2d4070[_0xed6179(0xfb)]['maxToolIterations'],'temperature':_0x2d4070[_0xed6179(0xfb)][_0xed6179(0x11c)],'reasoningEffort':_0x2d4070[_0xed6179(0xfb)][_0xed6179(0x171)],'outputs':_0x2d4070[_0xed6179(0xfb)]['outputs'],'tools':_0x3705bb,'variables':_0xaa148d});_0x22a274['set'](_0x2d4070['id'],_0x24b0dd['id']);}else _0x175ece['push'](_0x2d4070);}if(_0x175ece['length']===_0x55d3e3[_0xed6179(0x19b)])throw new SDKError(ErrorCode[_0xed6179(0x145)],_0xed6179(0xd5),undefined,{'helpText':_0xed6179(0x9a)});_0x55d3e3[_0xed6179(0x19b)]=0x0,_0x55d3e3[_0xed6179(0x175)](..._0x175ece);}for(const _0x3fed0b of _0x3adcb0){const _0x14424a=_0x22a274['get'](_0x3fed0b[_0xed6179(0xfb)]['agentId']);if(!_0x14424a)continue;const _0xe0a480=await this[_0xed6179(0x15c)]['createPrompt']({'projectId':_0x252587,'agentId':_0x14424a,'name':_0x3fed0b[_0xed6179(0xfb)][_0xed6179(0x117)],'systemPrompt':_0x3fed0b[_0xed6179(0xfb)]['systemPrompt'],'template':_0x3fed0b[_0xed6179(0xfb)][_0xed6179(0xe4)],'jsonSchemaHint':_0x3fed0b[_0xed6179(0xfb)][_0xed6179(0x189)]});_0x26ae80[_0xed6179(0x176)](_0x3fed0b['id'],_0xe0a480['id']);}for(const _0x1358bc of _0x219a0a){const _0xc7cfe4=_0x1358bc[_0xed6179(0xfb)][_0xed6179(0xed)][_0xed6179(0x10a)](_0x3872a8=>({..._0x3872a8,'promptId':_0x26ae80['get'](_0x3872a8[_0xed6179(0x8f)])||_0x3872a8[_0xed6179(0x8f)]}));await this[_0xed6179(0x15c)][_0xed6179(0x19f)]({'projectId':_0x252587,'serviceType':_0x1358bc[_0xed6179(0xfb)]['serviceType'],'actions':_0xc7cfe4,'slackMessageMode':_0x1358bc['attributes'][_0xed6179(0xb8)],'chatIgnoreManagedActions':_0x1358bc['attributes'][_0xed6179(0x147)],'chatWelcomeMessage':_0x1358bc[_0xed6179(0xfb)][_0xed6179(0x18f)],'webhookCorsOrigins':_0x1358bc['attributes']['webhookCorsOrigins']});}return{'projectName':_0x4b02ea,'projectId':_0x252587,'counts':{'agents':_0x22a274[_0xed6179(0x180)],'knowledgeBases':_0x3bd614[_0xed6179(0x180)],'prompts':_0x26ae80['size'],'integrations':_0x219a0a['length']},'sourceSite':_0x384479};}[a97_0x5796d4(0x15f)](_0x47e0be,_0x3832fc){const _0x551b0b=a97_0x5796d4;if(!a97_0x14cb22['existsSync'](_0x47e0be))return _0x3832fc;return JSON['parse'](a97_0x14cb22[_0x551b0b(0xe6)](_0x47e0be,'utf-8'));}['getBackupMetadata'](_0x156207){const _0x313d63=a97_0x5796d4;if(!a97_0x14cb22[_0x313d63(0xcf)](_0x156207))throw new SDKError(ErrorCode[_0x313d63(0x135)],'Backup\x20folder\x20not\x20found:\x20'+_0x156207,undefined,{'helpText':_0x313d63(0x94)});const _0x4e5a6b=a97_0x53f5e9[_0x313d63(0xac)](_0x156207,_0x313d63(0x134));if(!a97_0x14cb22[_0x313d63(0xcf)](_0x4e5a6b))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x313d63(0x11d)+_0x156207,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x448a8d=JSON[_0x313d63(0x18a)](a97_0x14cb22[_0x313d63(0xe6)](_0x4e5a6b,'utf-8'));if(!isSupportedBackupVersion(_0x448a8d['version']))throw new SDKError(ErrorCode[_0x313d63(0xc0)],_0x313d63(0x12f)+_0x448a8d[_0x313d63(0x192)],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x448a8d;}async[a97_0x5796d4(0x16b)](_0x29edde,_0x103735,_0x42c586){const _0x536d56=a97_0x5796d4,{projectId:_0x132431,project:_0x487930}=await this[_0x536d56(0x95)](_0x29edde),_0x2bd83a=_0x487930[_0x536d56(0xfb)][_0x536d56(0x117)];let _0x2a38e0;if(_0x103735)_0x2a38e0=_0x103735;else{const _0x52c434=a97_0x53f5e9[_0x536d56(0xac)](process['cwd'](),_0x536d56(0xe0)),_0x79ca7d=getSanitizedPathWithMigration(_0x52c434,_0x2bd83a);_0x79ca7d['renamed']&&this[_0x536d56(0x128)][_0x536d56(0x144)](_0x536d56(0x19c)+a97_0x53f5e9[_0x536d56(0x170)](_0x79ca7d[_0x536d56(0x99)])+_0x536d56(0x173)+a97_0x53f5e9[_0x536d56(0x170)](_0x79ca7d[_0x536d56(0x12c)])),_0x2a38e0=_0x79ca7d['path'];}const _0x53f668=await this[_0x536d56(0x15c)][_0x536d56(0x197)](_0x132431),_0x1c40b3=await this['client'][_0x536d56(0x126)](_0x132431),_0x1ec9a4=await this[_0x536d56(0x15c)][_0x536d56(0x8e)](_0x132431),_0x28cf46=await this[_0x536d56(0x15c)]['listImageGenerators'](_0x132431),_0x379520=await this[_0x536d56(0x15c)][_0x536d56(0x13e)](_0x132431),_0x460bef=await this[_0x536d56(0x15c)][_0x536d56(0x11b)](_0x132431),_0x289345=await this['client'][_0x536d56(0xd6)](_0x132431),_0x2ae0d5=await this[_0x536d56(0x15c)][_0x536d56(0xb1)](_0x132431),_0x2243cf=await this['client'][_0x536d56(0x8d)](_0x132431),_0x15f97=_0x289345[_0x536d56(0xc2)](_0x24c389=>!_0x24c389[_0x536d56(0xfb)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x536d56(0x154)](_0x24c389[_0x536d56(0xfb)][_0x536d56(0x15b)][_0x536d56(0xee)]())),_0x377e00=new Map(),_0x8d0d9a=new Map(),_0x204538=new Map(),_0x2bbc38=new Map(),_0x50568b=new Map(),_0x581712=new Map(),_0x57095e=new Map();for(const _0x360c2a of _0x53f668){_0x377e00[_0x536d56(0x176)](_0x360c2a['id'],_0x360c2a[_0x536d56(0xfb)][_0x536d56(0x117)]);}for(const _0x3042a8 of _0x1c40b3){_0x8d0d9a['set'](_0x3042a8['id'],_0x3042a8[_0x536d56(0xfb)][_0x536d56(0x117)]);}for(const _0x5a4200 of _0x1ec9a4){_0x204538[_0x536d56(0x176)](_0x5a4200['id'],_0x5a4200[_0x536d56(0xfb)][_0x536d56(0x117)]);}for(const _0x1a3b3f of _0x28cf46){_0x2bbc38[_0x536d56(0x176)](_0x1a3b3f['id'],_0x1a3b3f[_0x536d56(0xfb)]['name']);}for(const _0x487d72 of _0x379520){_0x50568b['set'](_0x487d72['id'],_0x487d72[_0x536d56(0xfb)][_0x536d56(0x117)]);}for(const _0x5f273f of _0x460bef){_0x581712['set'](_0x5f273f['id'],_0x5f273f[_0x536d56(0xfb)][_0x536d56(0x117)]);}for(const _0x5b820c of _0x2ae0d5){_0x57095e['set'](_0x5b820c['id'],_0x5b820c[_0x536d56(0xfb)]['name']);}const _0x1891b8={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x8d0d9a,'TextKnowledgeBase':_0x204538,'Agent':_0x377e00,'WebSearchTool':_0x50568b,'ImageGenerator':_0x2bbc38,'ExperimentalKnowledgeBase':_0x57095e}),'resolvePromptName':async _0x252024=>_0x581712[_0x536d56(0x167)](_0x252024),'onWarning':_0x42b56f=>this[_0x536d56(0x128)][_0x536d56(0x140)](_0x42b56f)},_0x355083={'projectName':_0x2bd83a,'outputDir':_0x2a38e0,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x212ae9=[],_0x23ffbc=[];for(const _0x5cc5cd of _0x53f668){const _0x17be8c=getSanitizedPathWithMigration(_0x2a38e0,_0x5cc5cd['attributes']['name']);_0x17be8c[_0x536d56(0x18c)]&&this['logger'][_0x536d56(0x144)](_0x536d56(0xa7)+a97_0x53f5e9['basename'](_0x17be8c[_0x536d56(0x99)])+'\x20→\x20'+a97_0x53f5e9['basename'](_0x17be8c[_0x536d56(0x12c)]));const _0x21751d=_0x17be8c[_0x536d56(0x12c)],_0x360767=a97_0x53f5e9['join'](_0x21751d,'prompt.md'),_0x3f431f=a97_0x53f5e9['join'](_0x21751d,_0x536d56(0x8b)),_0x24c317=a97_0x53f5e9['join'](_0x21751d,_0x536d56(0x188)),{yaml:_0x3b3cc7,systemPrompt:_0x4d1be7,starterMessage:_0x1f4de6}=await agentResponseToDef(_0x5cc5cd,_0x1891b8),_0xe6d6b5=toAgentYamlString(_0x3b3cc7),_0x2b134d=!a97_0x14cb22[_0x536d56(0xcf)](_0x3f431f);let _0x7718ad=_0x2b134d,_0x3dd726;if(!_0x2b134d){const _0x59b854=a97_0x14cb22[_0x536d56(0xcf)](_0x360767)?a97_0x14cb22[_0x536d56(0xe6)](_0x360767,'utf-8'):'',_0x2345b8=a97_0x14cb22[_0x536d56(0xe6)](_0x3f431f,_0x536d56(0x109)),_0xfca57e=_0x536d56(0x13d)+_0x59b854+'\x0a\x0a#\x20agent.yml\x0a'+_0x2345b8,_0x2e1afd='#\x20prompt.md\x0a'+_0x4d1be7+_0x536d56(0xaf)+_0xe6d6b5,_0x194f76=generateDiff(_0xfca57e,_0x2e1afd);_0x7718ad=hasChanges(_0x194f76),_0x7718ad&&(_0x3dd726=formatDiffWithColors(_0x194f76));}_0x212ae9[_0x536d56(0x175)]({'path':_0x21751d,'content':'','isDir':!![]}),_0x212ae9[_0x536d56(0x175)]({'path':_0x360767,'content':_0x4d1be7}),_0x212ae9['push']({'path':_0x3f431f,'content':_0xe6d6b5});_0x1f4de6&&_0x1f4de6[_0x536d56(0x154)]('\x0a')&&_0x212ae9[_0x536d56(0x175)]({'path':_0x24c317,'content':_0x1f4de6});_0x355083[_0x536d56(0xe0)][_0x536d56(0x175)]({'agentName':_0x5cc5cd[_0x536d56(0xfb)]['name'],'outputPath':_0x21751d,'isNew':_0x2b134d,'hasChanges':_0x7718ad,'diff':_0x3dd726}),_0x355083['counts']['agents'][_0x536d56(0x100)]++;if(_0x2b134d)_0x355083[_0x536d56(0x8a)][_0x536d56(0xe0)][_0x536d56(0x199)]++;else{if(_0x7718ad)_0x355083[_0x536d56(0x8a)][_0x536d56(0xe0)]['updated']++;else _0x355083[_0x536d56(0x8a)]['agents'][_0x536d56(0x13c)]++;}}for(const _0x4038c2 of _0x1c40b3){if(_0x4038c2[_0x536d56(0xfb)]['isManaged'])continue;const _0x568e07=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2a38e0),_0x4038c2[_0x536d56(0xfb)][_0x536d56(0x117)],'.yml');_0x568e07[_0x536d56(0x18c)]&&this[_0x536d56(0x128)][_0x536d56(0x144)](_0x536d56(0xc5)+a97_0x53f5e9[_0x536d56(0x170)](_0x568e07[_0x536d56(0x99)])+_0x536d56(0x173)+a97_0x53f5e9[_0x536d56(0x170)](_0x568e07[_0x536d56(0x12c)]));const _0x1a5206=_0x568e07['path'],_0x2aad22=apiKnowledgeBaseToYaml(_0x4038c2),_0x37e0c1=toKnowledgeBaseYamlString(_0x2aad22),_0x6ad63b=!a97_0x14cb22[_0x536d56(0xcf)](_0x1a5206);let _0x2a45d9=_0x6ad63b,_0x5c3b25;if(!_0x6ad63b){const _0x381a19=a97_0x14cb22[_0x536d56(0xe6)](_0x1a5206,'utf-8'),_0xd9fc7=generateDiff(_0x381a19,_0x37e0c1);_0x2a45d9=hasChanges(_0xd9fc7),_0x2a45d9&&(_0x5c3b25=formatDiffWithColors(_0xd9fc7));}_0x212ae9['push']({'path':_0x1a5206,'content':_0x37e0c1}),_0x355083[_0x536d56(0xd7)][_0x536d56(0x175)]({'name':_0x4038c2['attributes']['name'],'outputPath':_0x1a5206,'isNew':_0x6ad63b,'hasChanges':_0x2a45d9,'diff':_0x5c3b25}),_0x355083[_0x536d56(0x8a)]['knowledgeBases'][_0x536d56(0x100)]++;if(_0x6ad63b)_0x355083[_0x536d56(0x8a)][_0x536d56(0xd7)][_0x536d56(0x199)]++;else{if(_0x2a45d9)_0x355083['counts'][_0x536d56(0xd7)][_0x536d56(0x124)]++;else _0x355083[_0x536d56(0x8a)][_0x536d56(0xd7)][_0x536d56(0x13c)]++;}}for(const _0x105a52 of _0x1ec9a4){if(_0x105a52[_0x536d56(0xfb)][_0x536d56(0x148)])continue;const _0x57d47c=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2a38e0),_0x105a52[_0x536d56(0xfb)][_0x536d56(0x117)],_0x536d56(0x132));_0x57d47c['renamed']&&this[_0x536d56(0x128)][_0x536d56(0x144)]('Renamed\x20text\x20KB\x20file:\x20'+a97_0x53f5e9[_0x536d56(0x170)](_0x57d47c['oldPath'])+_0x536d56(0x173)+a97_0x53f5e9[_0x536d56(0x170)](_0x57d47c['path']));const _0x38b8c3=_0x57d47c[_0x536d56(0x12c)],_0x1a52b3=toTextKnowledgeBaseMd(_0x105a52[_0x536d56(0xfb)]['name'],_0x105a52[_0x536d56(0xfb)]['text']),_0x3264ed=!a97_0x14cb22['existsSync'](_0x38b8c3);let _0x39dd2e=_0x3264ed,_0x1fbf27;if(!_0x3264ed){const _0x4d3283=a97_0x14cb22[_0x536d56(0xe6)](_0x38b8c3,'utf-8'),_0x31ae69=generateDiff(_0x4d3283,_0x1a52b3);_0x39dd2e=hasChanges(_0x31ae69),_0x39dd2e&&(_0x1fbf27=formatDiffWithColors(_0x31ae69));}_0x212ae9[_0x536d56(0x175)]({'path':_0x38b8c3,'content':_0x1a52b3}),_0x355083[_0x536d56(0x184)]['push']({'name':_0x105a52[_0x536d56(0xfb)]['name'],'outputPath':_0x38b8c3,'isNew':_0x3264ed,'hasChanges':_0x39dd2e,'diff':_0x1fbf27}),_0x355083[_0x536d56(0x8a)][_0x536d56(0x184)][_0x536d56(0x100)]++;if(_0x3264ed)_0x355083[_0x536d56(0x8a)][_0x536d56(0x184)][_0x536d56(0x199)]++;else{if(_0x39dd2e)_0x355083[_0x536d56(0x8a)][_0x536d56(0x184)]['updated']++;else _0x355083[_0x536d56(0x8a)]['textKnowledgeBases'][_0x536d56(0x13c)]++;}}for(const _0x4f431b of _0x460bef){if(_0x4f431b[_0x536d56(0xfb)]['isManaged'])continue;const _0x44aeaf=getSanitizedPathWithMigration(getPromptsDir(_0x2a38e0),_0x4f431b[_0x536d56(0xfb)][_0x536d56(0x117)],_0x536d56(0x153));_0x44aeaf[_0x536d56(0x18c)]&&this[_0x536d56(0x128)][_0x536d56(0x144)](_0x536d56(0xa2)+a97_0x53f5e9['basename'](_0x44aeaf['oldPath'])+_0x536d56(0x173)+a97_0x53f5e9[_0x536d56(0x170)](_0x44aeaf[_0x536d56(0x12c)]));const _0x3e18f3=_0x44aeaf[_0x536d56(0x12c)],_0x2f4eb8=await apiPromptToYaml(_0x4f431b,_0x1891b8);if(!_0x2f4eb8)continue;const _0x260655=toPromptYamlString(_0x2f4eb8),_0x31bd2f=!a97_0x14cb22[_0x536d56(0xcf)](_0x3e18f3);let _0x421be2=_0x31bd2f,_0x3de2fe;if(!_0x31bd2f){const _0xf5bbbe=a97_0x14cb22['readFileSync'](_0x3e18f3,_0x536d56(0x109)),_0x5b22d7=generateDiff(_0xf5bbbe,_0x260655);_0x421be2=hasChanges(_0x5b22d7),_0x421be2&&(_0x3de2fe=formatDiffWithColors(_0x5b22d7));}_0x212ae9[_0x536d56(0x175)]({'path':_0x3e18f3,'content':_0x260655}),_0x355083['prompts'][_0x536d56(0x175)]({'name':_0x4f431b['attributes']['name'],'outputPath':_0x3e18f3,'isNew':_0x31bd2f,'hasChanges':_0x421be2,'diff':_0x3de2fe}),_0x355083['counts'][_0x536d56(0x82)][_0x536d56(0x100)]++;if(_0x31bd2f)_0x355083[_0x536d56(0x8a)][_0x536d56(0x82)][_0x536d56(0x199)]++;else{if(_0x421be2)_0x355083[_0x536d56(0x8a)][_0x536d56(0x82)][_0x536d56(0x124)]++;else _0x355083[_0x536d56(0x8a)][_0x536d56(0x82)]['unchanged']++;}}for(const _0x370bbb of _0x15f97){const _0x451242=_0x370bbb[_0x536d56(0xfb)]['serviceType'][_0x536d56(0xee)](),_0xbd0682=getSanitizedPathWithMigration(getIntegrationsDir(_0x2a38e0),_0x451242,_0x536d56(0x153));_0xbd0682['renamed']&&this[_0x536d56(0x128)][_0x536d56(0x144)](_0x536d56(0x121)+a97_0x53f5e9[_0x536d56(0x170)](_0xbd0682[_0x536d56(0x99)])+'\x20→\x20'+a97_0x53f5e9[_0x536d56(0x170)](_0xbd0682[_0x536d56(0x12c)]));const _0x18d954=_0xbd0682[_0x536d56(0x12c)],_0x49aa53=await apiIntegrationToYaml(_0x370bbb,_0x1891b8),_0x59ab16=toIntegrationYamlString(_0x49aa53),_0x50fbf3=!a97_0x14cb22[_0x536d56(0xcf)](_0x18d954);let _0x175738=_0x50fbf3,_0x470f67;if(!_0x50fbf3){const _0x391d65=a97_0x14cb22['readFileSync'](_0x18d954,'utf-8'),_0x318bbe=generateDiff(_0x391d65,_0x59ab16);_0x175738=hasChanges(_0x318bbe),_0x175738&&(_0x470f67=formatDiffWithColors(_0x318bbe));}_0x212ae9['push']({'path':_0x18d954,'content':_0x59ab16}),_0x355083[_0x536d56(0x110)][_0x536d56(0x175)]({'name':_0x451242,'outputPath':_0x18d954,'isNew':_0x50fbf3,'hasChanges':_0x175738,'diff':_0x470f67}),_0x355083[_0x536d56(0x8a)][_0x536d56(0x110)][_0x536d56(0x100)]++;if(_0x50fbf3)_0x355083[_0x536d56(0x8a)][_0x536d56(0x110)][_0x536d56(0x199)]++;else{if(_0x175738)_0x355083[_0x536d56(0x8a)]['integrations'][_0x536d56(0x124)]++;else _0x355083[_0x536d56(0x8a)]['integrations'][_0x536d56(0x13c)]++;}}for(const _0x517f0b of _0x2ae0d5){if(_0x517f0b['attributes'][_0x536d56(0x148)])continue;const _0x3ec712=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x2a38e0),_0x517f0b[_0x536d56(0xfb)]['name']);_0x3ec712[_0x536d56(0x18c)]&&this[_0x536d56(0x128)][_0x536d56(0x144)](_0x536d56(0x194)+a97_0x53f5e9[_0x536d56(0x170)](_0x3ec712['oldPath'])+'\x20→\x20'+a97_0x53f5e9['basename'](_0x3ec712[_0x536d56(0x12c)]));const _0xacd566=_0x3ec712['path'],_0x13e6f4=a97_0x53f5e9[_0x536d56(0xac)](_0xacd566,sanitizeForFilesystem(_0x517f0b[_0x536d56(0xfb)][_0x536d56(0x117)])+_0x536d56(0x153)),_0x120113=a97_0x53f5e9[_0x536d56(0xac)](_0xacd566,_0x536d56(0xe1)),_0x430492=apiExperimentalKnowledgeBaseToYaml(_0x517f0b),_0x47fb0d=toExperimentalKnowledgeBaseYamlString(_0x430492),_0xb28e66=!a97_0x14cb22[_0x536d56(0xcf)](_0xacd566);let _0x67fd13=_0xb28e66,_0x1edb42,_0x38f56a=_0x47fb0d;const _0x2da4b2=[..._0x430492[_0x536d56(0xe1)]][_0x536d56(0xc7)]((_0x1f62a7,_0x3d9f04)=>_0x1f62a7[_0x536d56(0x117)][_0x536d56(0x17a)](_0x3d9f04['name']));for(const _0x31cfe9 of _0x2da4b2){_0x38f56a+='\x0a---\x20function:\x20'+_0x31cfe9['name']+_0x536d56(0x12e)+_0x31cfe9[_0x536d56(0xeb)]+_0x536d56(0xb3)+_0x31cfe9[_0x536d56(0x117)]+'\x20---\x0a'+_0x31cfe9[_0x536d56(0x17c)]+'\x0a';}if(!_0xb28e66){let _0x8c2a49='';a97_0x14cb22[_0x536d56(0xcf)](_0x13e6f4)&&(_0x8c2a49=a97_0x14cb22[_0x536d56(0xe6)](_0x13e6f4,'utf-8'));if(a97_0x14cb22[_0x536d56(0xcf)](_0x120113)){const _0xfb7858=a97_0x14cb22[_0x536d56(0x89)](_0x120113,{'withFileTypes':!![]}),_0x39cc47=_0xfb7858[_0x536d56(0xc2)](_0x39744d=>_0x39744d['isDirectory']())['sort']((_0xaf6780,_0x4fa873)=>_0xaf6780[_0x536d56(0x117)][_0x536d56(0x17a)](_0x4fa873[_0x536d56(0x117)]));for(const _0x3ab5d8 of _0x39cc47){const _0x559a21=a97_0x53f5e9[_0x536d56(0xac)](_0x120113,_0x3ab5d8[_0x536d56(0x117)],_0x536d56(0xff)),_0xd70e80=a97_0x53f5e9[_0x536d56(0xac)](_0x120113,_0x3ab5d8['name'],_0x536d56(0x112));a97_0x14cb22[_0x536d56(0xcf)](_0x559a21)&&(_0x8c2a49+='\x0a---\x20function:\x20'+_0x3ab5d8['name']+'\x20---\x0a'+a97_0x14cb22[_0x536d56(0xe6)](_0x559a21,_0x536d56(0x109))+'\x0a'),a97_0x14cb22[_0x536d56(0xcf)](_0xd70e80)&&(_0x8c2a49+='---\x20schema:\x20'+_0x3ab5d8['name']+_0x536d56(0x12e)+a97_0x14cb22[_0x536d56(0xe6)](_0xd70e80,_0x536d56(0x109))+'\x0a');}}const _0x24c796=generateDiff(_0x8c2a49,_0x38f56a);_0x67fd13=hasChanges(_0x24c796),_0x67fd13&&(_0x1edb42=formatDiffWithColors(_0x24c796));}_0x212ae9[_0x536d56(0x175)]({'path':_0xacd566,'content':'','isDir':!![]}),_0x212ae9[_0x536d56(0x175)]({'path':_0x13e6f4,'content':_0x47fb0d}),_0x212ae9['push']({'path':_0x120113,'content':'','isDir':!![]});for(const _0x4f6553 of _0x430492['functions']){const _0x289b7e=a97_0x53f5e9[_0x536d56(0xac)](_0x120113,sanitizeForFilesystem(_0x4f6553[_0x536d56(0x117)])),_0x21086f=a97_0x53f5e9[_0x536d56(0xac)](_0x289b7e,'code.js'),_0x54b0e7=a97_0x53f5e9['join'](_0x289b7e,_0x536d56(0x112));_0x212ae9[_0x536d56(0x175)]({'path':_0x289b7e,'content':'','isDir':!![]}),_0x212ae9[_0x536d56(0x175)]({'path':_0x21086f,'content':_0x4f6553[_0x536d56(0xeb)]}),_0x212ae9[_0x536d56(0x175)]({'path':_0x54b0e7,'content':_0x4f6553[_0x536d56(0x17c)]});}if(a97_0x14cb22[_0x536d56(0xcf)](_0x120113)){const _0x24f64d=a97_0x14cb22[_0x536d56(0x89)](_0x120113,{'withFileTypes':!![]}),_0x71abb4=new Set(_0x430492[_0x536d56(0xe1)]['map'](_0x3f84db=>sanitizeForFilesystem(_0x3f84db[_0x536d56(0x117)])));for(const _0x252836 of _0x24f64d){if(_0x252836[_0x536d56(0x165)]()&&!_0x71abb4[_0x536d56(0xe9)](_0x252836[_0x536d56(0x117)])){const _0x2e32de=a97_0x53f5e9['join'](_0x120113,_0x252836['name']);_0x23ffbc[_0x536d56(0x175)]({'path':_0x2e32de,'isDir':!![]});}}}_0x355083[_0x536d56(0xbe)][_0x536d56(0x175)]({'name':_0x517f0b[_0x536d56(0xfb)][_0x536d56(0x117)],'outputPath':_0xacd566,'isNew':_0xb28e66,'hasChanges':_0x67fd13,'diff':_0x1edb42}),_0x355083['counts'][_0x536d56(0xbe)]['total']++;if(_0xb28e66)_0x355083[_0x536d56(0x8a)][_0x536d56(0xbe)][_0x536d56(0x199)]++;else{if(_0x67fd13)_0x355083[_0x536d56(0x8a)][_0x536d56(0xbe)][_0x536d56(0x124)]++;else _0x355083[_0x536d56(0x8a)][_0x536d56(0xbe)][_0x536d56(0x13c)]++;}}for(const _0x582cf9 of _0x2243cf){if(_0x582cf9[_0x536d56(0xfb)][_0x536d56(0x148)])continue;const _0x201bf5=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x2a38e0),_0x582cf9[_0x536d56(0xfb)]['name']);_0x201bf5['renamed']&&this['logger'][_0x536d56(0x144)](_0x536d56(0x97)+a97_0x53f5e9[_0x536d56(0x170)](_0x201bf5[_0x536d56(0x99)])+_0x536d56(0x173)+a97_0x53f5e9[_0x536d56(0x170)](_0x201bf5[_0x536d56(0x12c)]));const _0x422109=_0x201bf5[_0x536d56(0x12c)],_0x207a4e=a97_0x53f5e9[_0x536d56(0xac)](_0x422109,sanitizeForFilesystem(_0x582cf9[_0x536d56(0xfb)]['name'])+_0x536d56(0x153)),_0x3d6cd2=a97_0x53f5e9[_0x536d56(0xac)](_0x422109,_0x536d56(0xff)),_0x48c853=a97_0x53f5e9[_0x536d56(0xac)](_0x422109,_0x536d56(0xe2)),_0x247f16=apiExperimentalArtifactToYaml(_0x582cf9),_0x255fff=toExperimentalArtifactYamlString(_0x247f16),_0x3c5cad=!a97_0x14cb22[_0x536d56(0xcf)](_0x422109);let _0x21b521=_0x3c5cad,_0x2d5534,_0x5a8d6e=_0x255fff+(_0x536d56(0xfe)+_0x247f16[_0x536d56(0xeb)]+'\x0a');const _0x388110=[..._0x247f16[_0x536d56(0xe2)]][_0x536d56(0xc7)]((_0x51ad8a,_0x171389)=>_0x51ad8a[_0x536d56(0xcc)][_0x536d56(0x17a)](_0x171389['file_name']));for(const _0x1b7a94 of _0x388110){_0x5a8d6e+=_0x536d56(0x11a)+_0x1b7a94[_0x536d56(0xcc)]+_0x536d56(0x12e)+_0x1b7a94[_0x536d56(0x160)]+'\x0a';}if(!_0x3c5cad){let _0x25f9a5='';a97_0x14cb22['existsSync'](_0x207a4e)&&(_0x25f9a5=a97_0x14cb22[_0x536d56(0xe6)](_0x207a4e,_0x536d56(0x109)));a97_0x14cb22['existsSync'](_0x3d6cd2)&&(_0x25f9a5+='\x0a---\x20code\x20---\x0a'+a97_0x14cb22[_0x536d56(0xe6)](_0x3d6cd2,'utf-8')+'\x0a');if(a97_0x14cb22['existsSync'](_0x48c853)){const _0x23b9ea=a97_0x14cb22[_0x536d56(0x89)](_0x48c853),_0x52e8c5=_0x23b9ea[_0x536d56(0xc2)](_0x1ee7d5=>{const _0x189e8f=_0x536d56,_0x1c3223=a97_0x53f5e9[_0x189e8f(0xac)](_0x48c853,_0x1ee7d5);return a97_0x14cb22[_0x189e8f(0x17b)](_0x1c3223)['isFile']();})[_0x536d56(0xc7)]((_0x8915b4,_0x19ef88)=>_0x8915b4[_0x536d56(0x17a)](_0x19ef88));for(const _0x42c6b8 of _0x52e8c5){const _0x15f305=a97_0x53f5e9[_0x536d56(0xac)](_0x48c853,_0x42c6b8);_0x25f9a5+=_0x536d56(0x11a)+_0x42c6b8+_0x536d56(0x12e)+a97_0x14cb22[_0x536d56(0xe6)](_0x15f305,'utf-8')+'\x0a';}}const _0x1bc730=generateDiff(_0x25f9a5,_0x5a8d6e);_0x21b521=hasChanges(_0x1bc730),_0x21b521&&(_0x2d5534=formatDiffWithColors(_0x1bc730));}_0x212ae9[_0x536d56(0x175)]({'path':_0x422109,'content':'','isDir':!![]}),_0x212ae9['push']({'path':_0x207a4e,'content':_0x255fff}),_0x212ae9['push']({'path':_0x3d6cd2,'content':_0x247f16['code']});if(_0x247f16['files'][_0x536d56(0x19b)]>0x0){_0x212ae9[_0x536d56(0x175)]({'path':_0x48c853,'content':'','isDir':!![]});for(const _0x31d594 of _0x247f16[_0x536d56(0xe2)]){const _0x78af79=a97_0x53f5e9['join'](_0x48c853,_0x31d594[_0x536d56(0xcc)]);_0x212ae9['push']({'path':_0x78af79,'content':_0x31d594[_0x536d56(0x160)]});}}if(a97_0x14cb22[_0x536d56(0xcf)](_0x48c853)){const _0x26a84a=a97_0x14cb22[_0x536d56(0x89)](_0x48c853),_0x424f05=new Set(_0x247f16[_0x536d56(0xe2)][_0x536d56(0x10a)](_0x54c23a=>_0x54c23a['file_name']));for(const _0x49c37b of _0x26a84a){const _0x2ebe38=a97_0x53f5e9[_0x536d56(0xac)](_0x48c853,_0x49c37b);a97_0x14cb22[_0x536d56(0x17b)](_0x2ebe38)[_0x536d56(0x14b)]()&&!_0x424f05[_0x536d56(0xe9)](_0x49c37b)&&_0x23ffbc[_0x536d56(0x175)]({'path':_0x2ebe38});}}_0x355083[_0x536d56(0x9f)][_0x536d56(0x175)]({'name':_0x582cf9[_0x536d56(0xfb)][_0x536d56(0x117)],'outputPath':_0x422109,'isNew':_0x3c5cad,'hasChanges':_0x21b521,'diff':_0x2d5534}),_0x355083[_0x536d56(0x8a)]['experimentalArtifacts'][_0x536d56(0x100)]++;if(_0x3c5cad)_0x355083[_0x536d56(0x8a)][_0x536d56(0x9f)][_0x536d56(0x199)]++;else{if(_0x21b521)_0x355083[_0x536d56(0x8a)][_0x536d56(0x9f)][_0x536d56(0x124)]++;else _0x355083[_0x536d56(0x8a)][_0x536d56(0x9f)]['unchanged']++;}}if(_0x42c586?.[_0x536d56(0xf2)])return _0x355083;a97_0x14cb22[_0x536d56(0xf7)](_0x2a38e0,{'recursive':!![]}),a97_0x14cb22[_0x536d56(0xf7)](getKnowledgeBasesDir(_0x2a38e0),{'recursive':!![]}),a97_0x14cb22[_0x536d56(0xf7)](getPromptsDir(_0x2a38e0),{'recursive':!![]}),a97_0x14cb22[_0x536d56(0xf7)](getIntegrationsDir(_0x2a38e0),{'recursive':!![]}),a97_0x14cb22[_0x536d56(0xf7)](getExperimentalKnowledgeBasesDir(_0x2a38e0),{'recursive':!![]}),a97_0x14cb22[_0x536d56(0xf7)](getExperimentalArtifactsDir(_0x2a38e0),{'recursive':!![]});const _0x551cb4=a97_0x53f5e9['join'](_0x2a38e0,'tdx.json');a97_0x14cb22[_0x536d56(0x15e)](_0x551cb4,createAgentConfigContent(_0x2bd83a));for(const _0x594f7c of _0x212ae9){if(_0x594f7c[_0x536d56(0x151)])a97_0x14cb22[_0x536d56(0xf7)](_0x594f7c[_0x536d56(0x12c)],{'recursive':!![]});else{const _0x35e0a1=a97_0x53f5e9[_0x536d56(0x115)](_0x594f7c[_0x536d56(0x12c)]);!a97_0x14cb22[_0x536d56(0xcf)](_0x35e0a1)&&a97_0x14cb22[_0x536d56(0xf7)](_0x35e0a1,{'recursive':!![]}),a97_0x14cb22['writeFileSync'](_0x594f7c[_0x536d56(0x12c)],_0x594f7c['content']);}}for(const _0xd8472d of _0x23ffbc){_0xd8472d[_0x536d56(0x151)]?(a97_0x14cb22[_0x536d56(0xdb)](_0xd8472d[_0x536d56(0x12c)],{'recursive':!![],'force':!![]}),this[_0x536d56(0x128)][_0x536d56(0x144)](_0x536d56(0x91)+a97_0x53f5e9[_0x536d56(0x170)](a97_0x53f5e9['dirname'](_0xd8472d['path']))+'/'+a97_0x53f5e9['basename'](_0xd8472d[_0x536d56(0x12c)]))):(a97_0x14cb22[_0x536d56(0xdb)](_0xd8472d[_0x536d56(0x12c)],{'force':!![]}),this[_0x536d56(0x128)]['info'](_0x536d56(0xbc)+a97_0x53f5e9[_0x536d56(0x170)](a97_0x53f5e9[_0x536d56(0x115)](_0xd8472d['path']))+'/'+a97_0x53f5e9[_0x536d56(0x170)](_0xd8472d[_0x536d56(0x12c)])));}return _0x355083;}async[a97_0x5796d4(0x96)](_0x6a98e0,_0x47fcc1){const _0x3c207f=a97_0x5796d4,_0x2789e6=a97_0x53f5e9['join'](_0x6a98e0,_0x3c207f(0x10b));if(!a97_0x14cb22[_0x3c207f(0xcf)](_0x2789e6))throw new SDKError(ErrorCode[_0x3c207f(0xc0)],_0x3c207f(0x166)+_0x6a98e0,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x2e3191=loadAgentConfig(_0x2789e6),_0x2abe08=await this[_0x3c207f(0x190)](_0x2e3191[_0x3c207f(0xf4)]),_0x22e366=await this['client'][_0x3c207f(0x179)](_0x2abe08),_0x48ae61=_0x22e366[_0x3c207f(0xfb)]['name'],_0x5030ed={'projectName':_0x48ae61,'projectId':_0x2abe08,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0xf71632=[],_0x71c404=[],_0x1e00ba=[],_0x35eb8c=[],_0x2e04b2=[],_0x56535e=[],_0x4cd0f3=a97_0x14cb22['readdirSync'](_0x6a98e0,{'withFileTypes':!![]});for(const _0x4b947d of _0x4cd0f3){if(!_0x4b947d[_0x3c207f(0x165)]())continue;if([_0x3c207f(0xa4),_0x3c207f(0x82),_0x3c207f(0x110),_0x3c207f(0xf9),'experimental_artifacts'][_0x3c207f(0x154)](_0x4b947d[_0x3c207f(0x117)]))continue;const _0x3a77a2=a97_0x53f5e9[_0x3c207f(0xac)](_0x6a98e0,_0x4b947d['name']);if(isAgentDir(_0x3a77a2)){const _0x57ebb4=a97_0x53f5e9[_0x3c207f(0xac)](_0x3a77a2,_0x3c207f(0x8b)),_0x282534=a97_0x53f5e9['join'](_0x3a77a2,_0x3c207f(0x178)),_0x32ba76=a97_0x53f5e9['join'](_0x3a77a2,_0x3c207f(0x188)),_0x598caa=parseAgentYaml(a97_0x14cb22[_0x3c207f(0xe6)](_0x57ebb4,_0x3c207f(0x109)),_0x57ebb4),_0x5dc97b=a97_0x14cb22[_0x3c207f(0xcf)](_0x282534)?a97_0x14cb22[_0x3c207f(0xe6)](_0x282534,_0x3c207f(0x109)):'',_0x46f35a=a97_0x14cb22[_0x3c207f(0xcf)](_0x32ba76)?a97_0x14cb22[_0x3c207f(0xe6)](_0x32ba76,_0x3c207f(0x109)):_0x598caa[_0x3c207f(0x19d)];_0xf71632['push']({'name':_0x598caa[_0x3c207f(0x117)],'dir':_0x3a77a2,'yaml':_0x598caa,'systemPrompt':_0x5dc97b,'starterMessage':_0x46f35a});}}const _0x4856a7=getKnowledgeBasesDir(_0x6a98e0);if(a97_0x14cb22[_0x3c207f(0xcf)](_0x4856a7)){const _0x4c04d9=a97_0x14cb22[_0x3c207f(0x89)](_0x4856a7);for(const _0x533857 of _0x4c04d9){const _0x32375b=a97_0x53f5e9[_0x3c207f(0xac)](_0x4856a7,_0x533857);if(_0x533857[_0x3c207f(0xf6)](_0x3c207f(0x153))){const _0xd793d5=parseKnowledgeBaseYaml(a97_0x14cb22['readFileSync'](_0x32375b,_0x3c207f(0x109)),_0x32375b);_0x71c404[_0x3c207f(0x175)]({'name':_0xd793d5[_0x3c207f(0x117)],'path':_0x32375b,'yaml':_0xd793d5});}else{if(_0x533857['endsWith'](_0x3c207f(0x132))){const _0x330e2b=a97_0x14cb22['readFileSync'](_0x32375b,_0x3c207f(0x109)),{name:_0x28816e,text:_0x23d75d}=parseTextKnowledgeBaseMd(_0x330e2b,_0x533857);_0x1e00ba[_0x3c207f(0x175)]({'name':_0x28816e,'path':_0x32375b,'text':_0x23d75d});}}}}const _0x343136=getPromptsDir(_0x6a98e0);if(a97_0x14cb22['existsSync'](_0x343136)){const _0x115407=a97_0x14cb22['readdirSync'](_0x343136)[_0x3c207f(0xc2)](_0x3f416f=>_0x3f416f['endsWith']('.yml'));for(const _0x469f82 of _0x115407){const _0x2e2dc9=a97_0x53f5e9[_0x3c207f(0xac)](_0x343136,_0x469f82),_0x58e090=parsePromptYaml(a97_0x14cb22[_0x3c207f(0xe6)](_0x2e2dc9,_0x3c207f(0x109)),_0x2e2dc9);_0x35eb8c[_0x3c207f(0x175)]({'name':_0x58e090[_0x3c207f(0x117)],'path':_0x2e2dc9,'yaml':_0x58e090});}}const _0xb406e8=[],_0x154c22=getIntegrationsDir(_0x6a98e0);if(a97_0x14cb22[_0x3c207f(0xcf)](_0x154c22)){const _0x58659b=a97_0x14cb22['readdirSync'](_0x154c22)['filter'](_0x2697a8=>_0x2697a8[_0x3c207f(0xf6)](_0x3c207f(0x153)));for(const _0x37f2d4 of _0x58659b){const _0x16b6a6=a97_0x53f5e9['join'](_0x154c22,_0x37f2d4),_0x5d6ffb=parseIntegrationYaml(a97_0x14cb22['readFileSync'](_0x16b6a6,_0x3c207f(0x109)),_0x16b6a6);if(!SAFE_INTEGRATION_TYPES[_0x3c207f(0x154)](_0x5d6ffb['service_type']['toLowerCase']())){this['logger'][_0x3c207f(0x140)](_0x3c207f(0xb7)+_0x5d6ffb[_0x3c207f(0x117)]+_0x3c207f(0x139)+_0x5d6ffb[_0x3c207f(0xcb)]+_0x3c207f(0x186)+(_0x3c207f(0x122)+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x3c207f(0xe8));continue;}_0xb406e8[_0x3c207f(0x175)]({'name':_0x5d6ffb[_0x3c207f(0x117)],'path':_0x16b6a6,'yaml':_0x5d6ffb});}}const _0x786a53=getExperimentalKnowledgeBasesDir(_0x6a98e0);if(a97_0x14cb22['existsSync'](_0x786a53)){const _0xce63b5=a97_0x14cb22[_0x3c207f(0x89)](_0x786a53,{'withFileTypes':!![]});for(const _0x56d7f0 of _0xce63b5){if(!_0x56d7f0['isDirectory']())continue;const _0x1e52bb=a97_0x53f5e9[_0x3c207f(0xac)](_0x786a53,_0x56d7f0['name']),_0x2faa34=a97_0x53f5e9['join'](_0x1e52bb,_0x56d7f0['name']+_0x3c207f(0x153)),_0x44a0ab=a97_0x53f5e9[_0x3c207f(0xac)](_0x1e52bb,_0x3c207f(0xe1));if(!a97_0x14cb22[_0x3c207f(0xcf)](_0x2faa34))continue;const _0x5e8966=parseExperimentalKnowledgeBaseYaml(a97_0x14cb22['readFileSync'](_0x2faa34,_0x3c207f(0x109)),_0x2faa34),_0x48562f=[];if(a97_0x14cb22['existsSync'](_0x44a0ab)){const _0x127dd6=a97_0x14cb22[_0x3c207f(0x89)](_0x44a0ab,{'withFileTypes':!![]});for(const _0x2bfe81 of _0x127dd6){if(!_0x2bfe81['isDirectory']())continue;const _0x32d017=a97_0x53f5e9[_0x3c207f(0xac)](_0x44a0ab,_0x2bfe81[_0x3c207f(0x117)]),_0x20e52f=a97_0x53f5e9['join'](_0x32d017,_0x3c207f(0xff)),_0x59e224=a97_0x53f5e9['join'](_0x32d017,'json_schema.json');a97_0x14cb22['existsSync'](_0x20e52f)&&a97_0x14cb22[_0x3c207f(0xcf)](_0x59e224)&&_0x48562f[_0x3c207f(0x175)]({'name':_0x2bfe81[_0x3c207f(0x117)],'code':a97_0x14cb22[_0x3c207f(0xe6)](_0x20e52f,_0x3c207f(0x109)),'json_schema':a97_0x14cb22[_0x3c207f(0xe6)](_0x59e224,_0x3c207f(0x109))});}}const _0x12eefe={..._0x5e8966,'variables':_0x5e8966[_0x3c207f(0x137)]||[],'functions':_0x48562f};_0x2e04b2['push']({'name':_0x5e8966[_0x3c207f(0x117)],'dir':_0x1e52bb,'def':_0x12eefe});}}const _0x3121e4=getExperimentalArtifactsDir(_0x6a98e0);if(a97_0x14cb22['existsSync'](_0x3121e4)){const _0x342665=a97_0x14cb22[_0x3c207f(0x89)](_0x3121e4,{'withFileTypes':!![]});for(const _0x689d27 of _0x342665){if(!_0x689d27[_0x3c207f(0x165)]())continue;const _0x281411=a97_0x53f5e9[_0x3c207f(0xac)](_0x3121e4,_0x689d27[_0x3c207f(0x117)]),_0x18019e=a97_0x53f5e9[_0x3c207f(0xac)](_0x281411,_0x689d27[_0x3c207f(0x117)]+_0x3c207f(0x153)),_0x77f855=a97_0x53f5e9[_0x3c207f(0xac)](_0x281411,_0x3c207f(0xff)),_0x34ee1b=a97_0x53f5e9[_0x3c207f(0xac)](_0x281411,_0x3c207f(0xe2));if(!a97_0x14cb22['existsSync'](_0x18019e)||!a97_0x14cb22[_0x3c207f(0xcf)](_0x77f855))continue;const _0xae63ec=parseExperimentalArtifactYaml(a97_0x14cb22[_0x3c207f(0xe6)](_0x18019e,_0x3c207f(0x109)),_0x18019e),_0x4278f8=a97_0x14cb22[_0x3c207f(0xe6)](_0x77f855,_0x3c207f(0x109)),_0x492b46=[];if(a97_0x14cb22[_0x3c207f(0xcf)](_0x34ee1b)){const _0x599491=a97_0x14cb22['readdirSync'](_0x34ee1b);for(const _0xf3415c of _0x599491){const _0x22ad66=a97_0x53f5e9['join'](_0x34ee1b,_0xf3415c);a97_0x14cb22[_0x3c207f(0x17b)](_0x22ad66)[_0x3c207f(0x14b)]()&&_0x492b46['push']({'file_name':_0xf3415c,'text_content':a97_0x14cb22['readFileSync'](_0x22ad66,_0x3c207f(0x109))});}}const _0x5c549b={..._0xae63ec,'code':_0x4278f8,'files':_0x492b46};_0x56535e['push']({'name':_0xae63ec[_0x3c207f(0x117)],'dir':_0x281411,'def':_0x5c549b});}}const _0x1ca1f9=await this['client'][_0x3c207f(0x197)](_0x2abe08),_0xe9c3fd=await this[_0x3c207f(0x15c)][_0x3c207f(0x126)](_0x2abe08),_0x51df5e=await this[_0x3c207f(0x15c)][_0x3c207f(0x8e)](_0x2abe08),_0x2f927c=await this['client'][_0x3c207f(0x11b)](_0x2abe08),_0x3d8b84=await this[_0x3c207f(0x15c)][_0x3c207f(0xd6)](_0x2abe08),_0x5a79d8=await this[_0x3c207f(0x15c)][_0x3c207f(0xb1)](_0x2abe08),_0x38a350=await this[_0x3c207f(0x15c)]['listExperimentalArtifacts'](_0x2abe08),_0x5c5f61=await fetchAllToolTargetMaps((_0x51149c,_0x208b26)=>this[_0x3c207f(0x15c)]['listToolTargets'](_0x51149c,_0x208b26),_0x2abe08),_0x4fb599=new Map(),_0x57fec6=new Map(),_0x28a7e5=new Map(),_0x5f27fe=new Map(),_0xc0130a=new Map(),_0x40e74b=new Map(),_0x5e55b4=new Map();for(const _0x299748 of _0x1ca1f9){_0x4fb599[_0x3c207f(0x176)](_0x299748[_0x3c207f(0xfb)][_0x3c207f(0x117)],_0x299748);}for(const _0x39a942 of _0xe9c3fd){_0x57fec6[_0x3c207f(0x176)](_0x39a942[_0x3c207f(0xfb)][_0x3c207f(0x117)],_0x39a942);}for(const _0x3b89d5 of _0x51df5e){_0x28a7e5[_0x3c207f(0x176)](_0x3b89d5['attributes']['name'],_0x3b89d5);}for(const _0x3694d7 of _0x2f927c){_0x5f27fe['set'](_0x3694d7[_0x3c207f(0xfb)][_0x3c207f(0x117)],_0x3694d7);}for(const _0x693fec of _0x3d8b84){_0xc0130a[_0x3c207f(0x176)](_0x693fec['attributes'][_0x3c207f(0x15b)][_0x3c207f(0xee)](),_0x693fec);}for(const _0x4dc395 of _0x5a79d8){_0x40e74b[_0x3c207f(0x176)](_0x4dc395[_0x3c207f(0xfb)][_0x3c207f(0x117)],_0x4dc395);}for(const _0x417f09 of _0x38a350){_0x5e55b4['set'](_0x417f09[_0x3c207f(0xfb)][_0x3c207f(0x117)],_0x417f09);}const _0x407def=new Map(),_0x21bb02=new Map();for(const _0x31a030 of _0x1ca1f9){_0x407def[_0x3c207f(0x176)](_0x31a030[_0x3c207f(0xfb)][_0x3c207f(0x117)],_0x31a030['id']),_0x21bb02[_0x3c207f(0x176)](_0x31a030['id'],_0x31a030[_0x3c207f(0xfb)][_0x3c207f(0x117)]);}const _0x2ca307=new Map(),_0x1d9d3b=new Map();for(const _0x3de7fe of _0x2f927c){_0x2ca307[_0x3c207f(0x176)](_0x3de7fe[_0x3c207f(0xfb)]['name'],_0x3de7fe['id']),_0x1d9d3b['set'](_0x3de7fe['id'],_0x3de7fe[_0x3c207f(0xfb)][_0x3c207f(0x117)]);}const _0xcf111a=_0x5c5f61[_0x3c207f(0xec)][_0x3c207f(0xcd)]||new Map(),_0x25e081=_0x5c5f61[_0x3c207f(0xec)][_0x3c207f(0xfa)]||new Map(),_0xc43a47=_0x5c5f61[_0x3c207f(0xec)][_0x3c207f(0x90)]||new Map(),_0x136e4b=new Map(),_0x2765e6={'resolveToolTargetName':buildNameResolver({..._0x5c5f61['idToName'],'Agent':_0x21bb02}),'resolvePromptName':async _0xa2864f=>_0x1d9d3b[_0x3c207f(0x167)](_0xa2864f),'onWarning':_0x362d48=>this['logger']['warn'](_0x362d48)};let _0x45a91d=[];const _0xc0f49e={'projectId':_0x2abe08,'resolveToolTargetId':buildIdResolver({..._0x5c5f61[_0x3c207f(0xec)],'Agent':_0x407def}),'resolvePromptId':async _0x5b2d77=>_0x2ca307[_0x3c207f(0x167)](_0x5b2d77),'onWarning':_0x3957ca=>{const _0x23c549=_0x3c207f;this['logger'][_0x23c549(0x140)](_0x3957ca),_0x45a91d['push'](_0x3957ca);}},{resolved:_0x2c7bb7,unresolved:_0x256ebb}=resolveAgentDependencies(_0xf71632,new Set(_0x4fb599['keys']()));for(const {agent:_0x4058cb,missingDeps:_0x40c346}of _0x256ebb){_0x5030ed['agents'][_0x3c207f(0x175)]({'agentName':_0x4058cb['yaml'][_0x3c207f(0x117)],'action':_0x3c207f(0xa0),'error':_0x3c207f(0xab)+_0x40c346[_0x3c207f(0xac)](',\x20')+_0x3c207f(0x125)}),_0x5030ed['counts'][_0x3c207f(0xe0)]['errors']++;}for(const _0x4a4323 of _0x71c404){const _0xec4591=_0x57fec6[_0x3c207f(0x167)](_0x4a4323[_0x3c207f(0x159)][_0x3c207f(0x117)]),_0x36afd4=a97_0x14cb22['readFileSync'](_0x4a4323[_0x3c207f(0x12c)],_0x3c207f(0x109));if(_0xec4591){const _0x5be507=apiKnowledgeBaseToYaml(_0xec4591),_0x12c333=toKnowledgeBaseYamlString(_0x5be507),_0x3837a4=generateDiff(_0x12c333,_0x36afd4),_0x11e6f5=hasChanges(_0x3837a4);_0x11e6f5?(_0x5030ed[_0x3c207f(0xd7)][_0x3c207f(0x175)]({'name':_0x4a4323[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0x124),'id':_0xec4591['id'],'diff':formatDiffWithColors(_0x3837a4)}),_0x5030ed[_0x3c207f(0x8a)]['knowledgeBases'][_0x3c207f(0x124)]++):(_0x5030ed['knowledgeBases'][_0x3c207f(0x175)]({'name':_0x4a4323['yaml'][_0x3c207f(0x117)],'action':_0x3c207f(0x13c),'id':_0xec4591['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xd7)][_0x3c207f(0x13c)]++);}else _0x5030ed[_0x3c207f(0xd7)][_0x3c207f(0x175)]({'name':_0x4a4323['yaml'][_0x3c207f(0x117)],'action':_0x3c207f(0xd0)}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xd7)][_0x3c207f(0xd0)]++;}for(const _0x53c939 of _0x1e00ba){const _0x5d0fc7=_0x28a7e5[_0x3c207f(0x167)](_0x53c939[_0x3c207f(0x117)]),_0x4367c3=a97_0x14cb22[_0x3c207f(0xe6)](_0x53c939[_0x3c207f(0x12c)],_0x3c207f(0x109));if(_0x5d0fc7){const _0xdacfbe=toTextKnowledgeBaseMd(_0x5d0fc7[_0x3c207f(0xfb)]['name'],_0x5d0fc7[_0x3c207f(0xfb)][_0x3c207f(0xd9)]),_0x362072=generateDiff(_0xdacfbe,_0x4367c3),_0x435f8c=hasChanges(_0x362072);_0x435f8c?(_0x5030ed[_0x3c207f(0x184)][_0x3c207f(0x175)]({'name':_0x53c939['name'],'action':_0x3c207f(0x124),'id':_0x5d0fc7['id'],'diff':formatDiffWithColors(_0x362072)}),_0x5030ed[_0x3c207f(0x8a)]['textKnowledgeBases'][_0x3c207f(0x124)]++):(_0x5030ed[_0x3c207f(0x184)][_0x3c207f(0x175)]({'name':_0x53c939['name'],'action':'unchanged','id':_0x5d0fc7['id']}),_0x5030ed[_0x3c207f(0x8a)]['textKnowledgeBases']['unchanged']++);}else _0x5030ed[_0x3c207f(0x184)][_0x3c207f(0x175)]({'name':_0x53c939['name'],'action':_0x3c207f(0xd0)}),_0x5030ed['counts'][_0x3c207f(0x184)][_0x3c207f(0xd0)]++;}for(const _0x408923 of _0x2c7bb7){const _0x31cac9=_0x4fb599[_0x3c207f(0x167)](_0x408923[_0x3c207f(0x159)][_0x3c207f(0x117)]),_0x590946=a97_0x53f5e9[_0x3c207f(0xac)](_0x408923[_0x3c207f(0xbd)],_0x3c207f(0x8b)),_0x57c663=a97_0x14cb22[_0x3c207f(0xe6)](_0x590946,'utf-8'),_0x206835=_0x408923[_0x3c207f(0x104)],_0x5d7d39=_0x3c207f(0x13d)+_0x206835+'\x0a\x0a#\x20agent.yml\x0a'+_0x57c663;if(_0x31cac9){const {yaml:_0x3024b4,systemPrompt:_0x27a272}=await agentResponseToDef(_0x31cac9,_0x2765e6),_0x1576df=toAgentYamlString(_0x3024b4),_0xacb9a1=_0x3c207f(0x13d)+_0x27a272+_0x3c207f(0xaf)+_0x1576df,_0x585440=generateDiff(_0xacb9a1,_0x5d7d39),_0x19e9fe=hasChanges(_0x585440);_0x19e9fe?(_0x5030ed[_0x3c207f(0xe0)][_0x3c207f(0x175)]({'agentName':_0x408923[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0x124),'agentId':_0x31cac9['id'],'diff':formatDiffWithColors(_0x585440)}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xe0)][_0x3c207f(0x124)]++):(_0x5030ed[_0x3c207f(0xe0)][_0x3c207f(0x175)]({'agentName':_0x408923[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0x13c),'agentId':_0x31cac9['id']}),_0x5030ed['counts'][_0x3c207f(0xe0)][_0x3c207f(0x13c)]++);}else _0x5030ed[_0x3c207f(0xe0)][_0x3c207f(0x175)]({'agentName':_0x408923[_0x3c207f(0x159)]['name'],'action':_0x3c207f(0xd0)}),_0x5030ed['counts']['agents']['created']++;}for(const _0x137218 of _0x35eb8c){const _0x4fa549=_0x5f27fe[_0x3c207f(0x167)](_0x137218['yaml'][_0x3c207f(0x117)]),_0xbae2e0=a97_0x14cb22[_0x3c207f(0xe6)](_0x137218[_0x3c207f(0x12c)],_0x3c207f(0x109));if(_0x4fa549){const _0x496bde=await apiPromptToYaml(_0x4fa549,_0x2765e6);if(!_0x496bde){_0x5030ed[_0x3c207f(0x82)][_0x3c207f(0x175)]({'name':_0x137218[_0x3c207f(0x159)]['name'],'action':_0x3c207f(0x124),'id':_0x4fa549['id']}),_0x5030ed[_0x3c207f(0x8a)]['prompts'][_0x3c207f(0x124)]++;continue;}const _0x2d548f=toPromptYamlString(_0x496bde),_0x55b8a9=generateDiff(_0x2d548f,_0xbae2e0),_0x31101e=hasChanges(_0x55b8a9);_0x31101e?(_0x5030ed[_0x3c207f(0x82)][_0x3c207f(0x175)]({'name':_0x137218[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0x124),'id':_0x4fa549['id'],'diff':formatDiffWithColors(_0x55b8a9)}),_0x5030ed['counts'][_0x3c207f(0x82)]['updated']++):(_0x5030ed[_0x3c207f(0x82)][_0x3c207f(0x175)]({'name':_0x137218[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':'unchanged','id':_0x4fa549['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x82)][_0x3c207f(0x13c)]++);}else _0x5030ed[_0x3c207f(0x82)]['push']({'name':_0x137218[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0xd0)}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x82)][_0x3c207f(0xd0)]++;}for(const _0x59256b of _0xb406e8){const _0x195ac1=_0xc0130a[_0x3c207f(0x167)](_0x59256b['yaml']['service_type']),_0x41bbd4=a97_0x14cb22[_0x3c207f(0xe6)](_0x59256b['path'],_0x3c207f(0x109));if(_0x195ac1){const _0x4fdfbe=await apiIntegrationToYaml(_0x195ac1,_0x2765e6),_0x104e68=toIntegrationYamlString(_0x4fdfbe),_0x545d85=generateDiff(_0x104e68,_0x41bbd4),_0x5bef91=hasChanges(_0x545d85);_0x5bef91?(_0x5030ed['integrations'][_0x3c207f(0x175)]({'name':_0x59256b[_0x3c207f(0x159)][_0x3c207f(0xcb)],'action':'updated','id':_0x195ac1['id'],'diff':formatDiffWithColors(_0x545d85)}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x110)][_0x3c207f(0x124)]++):(_0x5030ed[_0x3c207f(0x110)][_0x3c207f(0x175)]({'name':_0x59256b[_0x3c207f(0x159)][_0x3c207f(0xcb)],'action':'unchanged','id':_0x195ac1['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x110)]['unchanged']++);}else _0x5030ed[_0x3c207f(0x110)][_0x3c207f(0x175)]({'name':_0x59256b[_0x3c207f(0x159)]['service_type'],'action':'created'}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x110)]['created']++;}for(const _0x3d8f69 of _0x2e04b2){const _0x4e4207=_0x40e74b[_0x3c207f(0x167)](_0x3d8f69[_0x3c207f(0xa9)]['name']),_0x4574f9=toExperimentalKnowledgeBaseYamlString(_0x3d8f69[_0x3c207f(0xa9)]);let _0x2d343=_0x4574f9;for(const _0x5a8c50 of _0x3d8f69[_0x3c207f(0xa9)][_0x3c207f(0xe1)]){_0x2d343+=_0x3c207f(0xd1)+_0x5a8c50[_0x3c207f(0x117)]+_0x3c207f(0x12e)+_0x5a8c50['code']+_0x3c207f(0xb3)+_0x5a8c50['name']+'\x20---\x0a'+_0x5a8c50['json_schema']+'\x0a';}if(_0x4e4207){const _0x6e1c64=apiExperimentalKnowledgeBaseToYaml(_0x4e4207),_0x3c5d2d=toExperimentalKnowledgeBaseYamlString(_0x6e1c64);let _0x5026c1=_0x3c5d2d;for(const _0x41d061 of _0x6e1c64[_0x3c207f(0xe1)]){_0x5026c1+=_0x3c207f(0xd1)+_0x41d061['name']+_0x3c207f(0x12e)+_0x41d061[_0x3c207f(0xeb)]+_0x3c207f(0xb3)+_0x41d061[_0x3c207f(0x117)]+_0x3c207f(0x12e)+_0x41d061[_0x3c207f(0x17c)]+'\x0a';}const _0x43d973=generateDiff(_0x5026c1,_0x2d343),_0x21395c=hasChanges(_0x43d973);_0x21395c?(_0x5030ed[_0x3c207f(0xbe)][_0x3c207f(0x175)]({'name':_0x3d8f69[_0x3c207f(0xa9)][_0x3c207f(0x117)],'action':'updated','id':_0x4e4207['id'],'diff':formatDiffWithColors(_0x43d973)}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xbe)][_0x3c207f(0x124)]++):(_0x5030ed[_0x3c207f(0xbe)][_0x3c207f(0x175)]({'name':_0x3d8f69[_0x3c207f(0xa9)]['name'],'action':_0x3c207f(0x13c),'id':_0x4e4207['id']}),_0x5030ed[_0x3c207f(0x8a)]['experimentalKnowledgeBases'][_0x3c207f(0x13c)]++);}else _0x5030ed[_0x3c207f(0xbe)]['push']({'name':_0x3d8f69[_0x3c207f(0xa9)][_0x3c207f(0x117)],'action':'created'}),_0x5030ed[_0x3c207f(0x8a)]['experimentalKnowledgeBases']['created']++;}for(const _0x49a393 of _0x56535e){const _0x72a85b=_0x5e55b4['get'](_0x49a393['def'][_0x3c207f(0x117)]),_0x3a579d=toExperimentalArtifactYamlString(_0x49a393['def']);let _0x29fa00=_0x3a579d+(_0x3c207f(0xfe)+_0x49a393[_0x3c207f(0xa9)][_0x3c207f(0xeb)]+'\x0a');for(const _0x23422f of _0x49a393[_0x3c207f(0xa9)][_0x3c207f(0xe2)]){_0x29fa00+=_0x3c207f(0x11a)+_0x23422f[_0x3c207f(0xcc)]+_0x3c207f(0x12e)+_0x23422f[_0x3c207f(0x160)]+'\x0a';}if(_0x72a85b){const _0x19ef54=apiExperimentalArtifactToYaml(_0x72a85b),_0x1b183f=toExperimentalArtifactYamlString(_0x19ef54);let _0x102094=_0x1b183f+('\x0a---\x20code\x20---\x0a'+_0x19ef54[_0x3c207f(0xeb)]+'\x0a');for(const _0x2857b8 of _0x19ef54[_0x3c207f(0xe2)]){_0x102094+=_0x3c207f(0x11a)+_0x2857b8[_0x3c207f(0xcc)]+'\x20---\x0a'+_0x2857b8[_0x3c207f(0x160)]+'\x0a';}const _0x47089c=generateDiff(_0x102094,_0x29fa00),_0x9daa9e=hasChanges(_0x47089c);_0x9daa9e?(_0x5030ed[_0x3c207f(0x9f)]['push']({'name':_0x49a393['def']['name'],'action':_0x3c207f(0x124),'id':_0x72a85b['id'],'diff':formatDiffWithColors(_0x47089c)}),_0x5030ed['counts'][_0x3c207f(0x9f)][_0x3c207f(0x124)]++):(_0x5030ed[_0x3c207f(0x9f)][_0x3c207f(0x175)]({'name':_0x49a393[_0x3c207f(0xa9)][_0x3c207f(0x117)],'action':_0x3c207f(0x13c),'id':_0x72a85b['id']}),_0x5030ed[_0x3c207f(0x8a)]['experimentalArtifacts'][_0x3c207f(0x13c)]++);}else _0x5030ed[_0x3c207f(0x9f)][_0x3c207f(0x175)]({'name':_0x49a393[_0x3c207f(0xa9)][_0x3c207f(0x117)],'action':_0x3c207f(0xd0)}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x9f)][_0x3c207f(0xd0)]++;}if(_0x47fcc1?.[_0x3c207f(0xf2)])return _0x5030ed;_0x5030ed[_0x3c207f(0xd7)]=[],_0x5030ed[_0x3c207f(0x184)]=[],_0x5030ed[_0x3c207f(0x82)]=[],_0x5030ed[_0x3c207f(0x110)]=[],_0x5030ed['experimentalKnowledgeBases']=[],_0x5030ed[_0x3c207f(0x9f)]=[];const _0x3c87c0=_0x5030ed[_0x3c207f(0xe0)]['filter'](_0x596dfb=>_0x596dfb[_0x3c207f(0xde)]===_0x3c207f(0xa0));_0x5030ed['agents']=_0x3c87c0,_0x5030ed['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3c87c0['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x54af82 of _0x71c404){try{const _0x5db9ce=_0x57fec6['get'](_0x54af82[_0x3c207f(0x159)]['name']),_0x384b31=yamlKnowledgeBaseToApi(_0x54af82[_0x3c207f(0x159)],_0x2abe08);if(_0x5db9ce)await this[_0x3c207f(0x15c)][_0x3c207f(0x114)](_0x5db9ce['id'],_0x384b31),_0xcf111a[_0x3c207f(0x176)](_0x54af82[_0x3c207f(0x159)][_0x3c207f(0x117)],_0x5db9ce['id']),_0x5030ed['knowledgeBases'][_0x3c207f(0x175)]({'name':_0x54af82[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':'updated','id':_0x5db9ce['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xd7)][_0x3c207f(0x124)]++;else{const _0x1e3653=await this[_0x3c207f(0x15c)][_0x3c207f(0x191)](_0x384b31);_0xcf111a[_0x3c207f(0x176)](_0x54af82[_0x3c207f(0x159)]['name'],_0x1e3653['id']),_0x5030ed[_0x3c207f(0xd7)][_0x3c207f(0x175)]({'name':_0x54af82[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0xd0),'id':_0x1e3653['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xd7)]['created']++;}}catch(_0x392fcc){_0x5030ed[_0x3c207f(0xd7)][_0x3c207f(0x175)]({'name':_0x54af82['yaml'][_0x3c207f(0x117)],'action':_0x3c207f(0xa0),'error':_0x392fcc[_0x3c207f(0x149)]}),_0x5030ed['counts']['knowledgeBases'][_0x3c207f(0x17f)]++;}}for(const _0x34f936 of _0x1e00ba){try{const _0x3798f4=_0x28a7e5[_0x3c207f(0x167)](_0x34f936[_0x3c207f(0x117)]),_0x6d4ea5=yamlTextKnowledgeBaseToApi({'name':_0x34f936[_0x3c207f(0x117)],'text':_0x34f936['text']},_0x2abe08);if(_0x3798f4)await this[_0x3c207f(0x15c)][_0x3c207f(0x130)](_0x3798f4['id'],_0x6d4ea5),_0x25e081[_0x3c207f(0x176)](_0x34f936['name'],_0x3798f4['id']),_0x5030ed[_0x3c207f(0x184)][_0x3c207f(0x175)]({'name':_0x34f936['name'],'action':_0x3c207f(0x124),'id':_0x3798f4['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x184)][_0x3c207f(0x124)]++;else{const _0x173a2d=await this[_0x3c207f(0x15c)][_0x3c207f(0x152)](_0x6d4ea5);_0x25e081['set'](_0x34f936[_0x3c207f(0x117)],_0x173a2d['id']),_0x5030ed[_0x3c207f(0x184)][_0x3c207f(0x175)]({'name':_0x34f936[_0x3c207f(0x117)],'action':'created','id':_0x173a2d['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x184)][_0x3c207f(0xd0)]++;}}catch(_0x28811f){_0x5030ed[_0x3c207f(0x184)]['push']({'name':_0x34f936['name'],'action':_0x3c207f(0xa0),'error':_0x28811f[_0x3c207f(0x149)]}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x184)][_0x3c207f(0x17f)]++;}}for(const _0x33cd6f of _0x2e04b2){try{const _0x389bdf=_0x40e74b[_0x3c207f(0x167)](_0x33cd6f[_0x3c207f(0xa9)][_0x3c207f(0x117)]),_0x40379b=yamlExperimentalKnowledgeBaseToApi(_0x33cd6f['def'],_0x2abe08);if(_0x389bdf)await this[_0x3c207f(0x15c)][_0x3c207f(0x19a)](_0x389bdf['id'],_0x40379b),_0xc43a47[_0x3c207f(0x176)](_0x33cd6f['def'][_0x3c207f(0x117)],_0x389bdf['id']),_0x5030ed[_0x3c207f(0xbe)]['push']({'name':_0x33cd6f['def'][_0x3c207f(0x117)],'action':'updated','id':_0x389bdf['id']}),_0x5030ed['counts'][_0x3c207f(0xbe)][_0x3c207f(0x124)]++;else{const _0x4cdabf=await this[_0x3c207f(0x15c)][_0x3c207f(0x84)](_0x40379b);_0xc43a47[_0x3c207f(0x176)](_0x33cd6f[_0x3c207f(0xa9)]['name'],_0x4cdabf['id']),_0x5030ed[_0x3c207f(0xbe)][_0x3c207f(0x175)]({'name':_0x33cd6f['def'][_0x3c207f(0x117)],'action':_0x3c207f(0xd0),'id':_0x4cdabf['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xbe)][_0x3c207f(0xd0)]++;}}catch(_0x3252b2){_0x5030ed['experimentalKnowledgeBases']['push']({'name':_0x33cd6f[_0x3c207f(0xa9)][_0x3c207f(0x117)],'action':_0x3c207f(0xa0),'error':_0x3252b2[_0x3c207f(0x149)]}),_0x5030ed['counts'][_0x3c207f(0xbe)][_0x3c207f(0x17f)]++;}}for(const _0x567612 of _0x56535e){try{const _0x5652ac=_0x5e55b4['get'](_0x567612[_0x3c207f(0xa9)][_0x3c207f(0x117)]),_0x4b40b4=yamlExperimentalArtifactToApi(_0x567612[_0x3c207f(0xa9)],_0x2abe08);if(_0x5652ac)await this['client']['updateExperimentalArtifact'](_0x5652ac['id'],_0x4b40b4),_0x136e4b[_0x3c207f(0x176)](_0x567612[_0x3c207f(0xa9)][_0x3c207f(0x117)],_0x5652ac['id']),_0x5030ed[_0x3c207f(0x9f)][_0x3c207f(0x175)]({'name':_0x567612[_0x3c207f(0xa9)][_0x3c207f(0x117)],'action':'updated','id':_0x5652ac['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x9f)][_0x3c207f(0x124)]++;else{const _0x259fc8=await this[_0x3c207f(0x15c)][_0x3c207f(0xd4)](_0x4b40b4);_0x136e4b[_0x3c207f(0x176)](_0x567612['def'][_0x3c207f(0x117)],_0x259fc8['id']),_0x5030ed[_0x3c207f(0x9f)]['push']({'name':_0x567612['def'][_0x3c207f(0x117)],'action':_0x3c207f(0xd0),'id':_0x259fc8['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x9f)][_0x3c207f(0xd0)]++;}}catch(_0x295c99){_0x5030ed[_0x3c207f(0x9f)]['push']({'name':_0x567612[_0x3c207f(0xa9)][_0x3c207f(0x117)],'action':_0x3c207f(0xa0),'error':_0x295c99['message']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x9f)][_0x3c207f(0x17f)]++;}}for(const _0x22656f of _0x2c7bb7){_0x45a91d=[];try{const _0x3e68f7=_0x4fb599[_0x3c207f(0x167)](_0x22656f[_0x3c207f(0x159)][_0x3c207f(0x117)]),_0x3a3380=await agentDefToRequest(_0x22656f['yaml'],_0x22656f[_0x3c207f(0x104)],_0x22656f['starterMessage'],_0xc0f49e);if(_0x3e68f7)await this[_0x3c207f(0x15c)]['updateAgentResponse'](_0x3e68f7['id'],_0x3a3380),_0x407def['set'](_0x22656f[_0x3c207f(0x159)][_0x3c207f(0x117)],_0x3e68f7['id']),_0x5030ed['agents']['push']({'agentName':_0x22656f[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0x124),'agentId':_0x3e68f7['id'],'warnings':_0x45a91d[_0x3c207f(0x19b)]>0x0?_0x45a91d:undefined}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xe0)][_0x3c207f(0x124)]++;else{const _0x2083b0=await this['client'][_0x3c207f(0xba)](_0x3a3380);_0x407def[_0x3c207f(0x176)](_0x22656f['yaml']['name'],_0x2083b0['id']),_0x5030ed[_0x3c207f(0xe0)][_0x3c207f(0x175)]({'agentName':_0x22656f[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':'created','agentId':_0x2083b0['id'],'warnings':_0x45a91d['length']>0x0?_0x45a91d:undefined}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xe0)][_0x3c207f(0xd0)]++;}}catch(_0x363ea1){_0x5030ed['agents']['push']({'agentName':_0x22656f[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0xa0),'error':_0x363ea1[_0x3c207f(0x149)],'warnings':_0x45a91d[_0x3c207f(0x19b)]>0x0?_0x45a91d:undefined}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0xe0)][_0x3c207f(0x17f)]++;}}for(const _0x4ab197 of _0x35eb8c){try{const _0x4bd123=_0x5f27fe[_0x3c207f(0x167)](_0x4ab197[_0x3c207f(0x159)][_0x3c207f(0x117)]),_0x1f67ae=await yamlPromptToApi(_0x4ab197[_0x3c207f(0x159)],_0x2abe08,_0xc0f49e);if(!_0x1f67ae){_0x5030ed['prompts'][_0x3c207f(0x175)]({'name':_0x4ab197[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0xa0),'error':_0x3c207f(0x10e)}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x82)][_0x3c207f(0x17f)]++;continue;}if(_0x4bd123)await this[_0x3c207f(0x15c)][_0x3c207f(0x198)](_0x4bd123['id'],_0x1f67ae),_0x2ca307[_0x3c207f(0x176)](_0x4ab197[_0x3c207f(0x159)][_0x3c207f(0x117)],_0x4bd123['id']),_0x5030ed[_0x3c207f(0x82)]['push']({'name':_0x4ab197[_0x3c207f(0x159)][_0x3c207f(0x117)],'action':_0x3c207f(0x124),'id':_0x4bd123['id']}),_0x5030ed['counts']['prompts'][_0x3c207f(0x124)]++;else{const _0x519b61=await this['client'][_0x3c207f(0x9c)](_0x1f67ae);_0x2ca307[_0x3c207f(0x176)](_0x4ab197['yaml'][_0x3c207f(0x117)],_0x519b61['id']),_0x5030ed[_0x3c207f(0x82)][_0x3c207f(0x175)]({'name':_0x4ab197['yaml']['name'],'action':_0x3c207f(0xd0),'id':_0x519b61['id']}),_0x5030ed['counts'][_0x3c207f(0x82)][_0x3c207f(0xd0)]++;}}catch(_0x3e16b9){_0x5030ed['prompts'][_0x3c207f(0x175)]({'name':_0x4ab197['yaml']['name'],'action':_0x3c207f(0xa0),'error':_0x3e16b9['message']}),_0x5030ed[_0x3c207f(0x8a)]['prompts']['errors']++;}}for(const _0x42dcf3 of _0xb406e8){try{const _0x4550af=_0xc0130a[_0x3c207f(0x167)](_0x42dcf3[_0x3c207f(0x159)][_0x3c207f(0xcb)]),_0x4bfd82=await yamlIntegrationToApi(_0x42dcf3['yaml'],_0x2abe08,_0xc0f49e);if(_0x4550af){await this[_0x3c207f(0x15c)][_0x3c207f(0x98)](_0x4550af['id']);const _0x35ec36=await this[_0x3c207f(0x15c)][_0x3c207f(0x19f)](_0x4bfd82);_0x5030ed[_0x3c207f(0x110)][_0x3c207f(0x175)]({'name':_0x42dcf3[_0x3c207f(0x159)][_0x3c207f(0xcb)],'action':_0x3c207f(0x124),'id':_0x35ec36['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x110)][_0x3c207f(0x124)]++;}else{const _0x42a9ae=await this[_0x3c207f(0x15c)][_0x3c207f(0x19f)](_0x4bfd82);_0x5030ed['integrations']['push']({'name':_0x42dcf3[_0x3c207f(0x159)]['service_type'],'action':_0x3c207f(0xd0),'id':_0x42a9ae['id']}),_0x5030ed[_0x3c207f(0x8a)][_0x3c207f(0x110)][_0x3c207f(0xd0)]++;}}catch(_0x16fa04){_0x5030ed[_0x3c207f(0x110)][_0x3c207f(0x175)]({'name':_0x42dcf3[_0x3c207f(0x159)][_0x3c207f(0xcb)],'action':'error','error':_0x16fa04['message']}),_0x5030ed['counts'][_0x3c207f(0x110)][_0x3c207f(0x17f)]++;}}return _0x5030ed;}async[a97_0x5796d4(0x195)](_0x23a8c4,_0x2bc597,_0x373840,_0x57acf9){const _0x170f2a=a97_0x5796d4,{projectId:_0x532415,project:_0x2b453f}=await this[_0x170f2a(0x95)](_0x23a8c4),_0x328443=_0x2b453f[_0x170f2a(0xfb)][_0x170f2a(0x117)],_0x4c5807=await this['client'][_0x170f2a(0x197)](_0x532415),_0x5632b1=_0x4c5807[_0x170f2a(0xf3)](_0x346594=>_0x346594[_0x170f2a(0xfb)]['name']===_0x2bc597);if(!_0x5632b1)throw new SDKError(ErrorCode[_0x170f2a(0x16c)],_0x170f2a(0x108)+_0x2bc597,undefined,{'helpText':'Available\x20agents:\x20'+_0x4c5807[_0x170f2a(0x10a)](_0x50f5ee=>_0x50f5ee[_0x170f2a(0xfb)][_0x170f2a(0x117)])[_0x170f2a(0xac)](',\x20')});let _0x3116d9;if(_0x373840)_0x3116d9=_0x373840;else{const _0x1c4045=a97_0x53f5e9['join'](process[_0x170f2a(0xa6)](),_0x170f2a(0xe0)),_0x40dadd=getSanitizedPathWithMigration(_0x1c4045,_0x328443);_0x40dadd[_0x170f2a(0x18c)]&&this[_0x170f2a(0x128)][_0x170f2a(0x144)](_0x170f2a(0x19c)+a97_0x53f5e9['basename'](_0x40dadd[_0x170f2a(0x99)])+'\x20→\x20'+a97_0x53f5e9[_0x170f2a(0x170)](_0x40dadd[_0x170f2a(0x12c)])),_0x3116d9=_0x40dadd[_0x170f2a(0x12c)];}const _0x4c871b=getSanitizedPathWithMigration(_0x3116d9,_0x2bc597);_0x4c871b[_0x170f2a(0x18c)]&&this[_0x170f2a(0x128)][_0x170f2a(0x144)](_0x170f2a(0xa7)+a97_0x53f5e9[_0x170f2a(0x170)](_0x4c871b['oldPath'])+_0x170f2a(0x173)+a97_0x53f5e9[_0x170f2a(0x170)](_0x4c871b[_0x170f2a(0x12c)]));const _0x239208=_0x4c871b[_0x170f2a(0x12c)],_0x381dac=new Map(),_0x24f3e4=new Map(),_0x565683=await this[_0x170f2a(0x15c)]['listKnowledgeBases'](_0x532415),_0x42b8e5=await this[_0x170f2a(0x15c)][_0x170f2a(0x8e)](_0x532415),_0x593fe2=await this[_0x170f2a(0x15c)]['listExperimentalKnowledgeBases'](_0x532415),_0x51a020=new Map(),_0x3c0f6f=new Map();for(const _0xe7b0b3 of _0x565683){_0x381dac[_0x170f2a(0x176)](_0xe7b0b3['id'],_0xe7b0b3['attributes']['name']);}for(const _0x2049bc of _0x42b8e5){_0x51a020[_0x170f2a(0x176)](_0x2049bc['id'],_0x2049bc['attributes']['name']);}for(const _0xf41a80 of _0x593fe2){_0x3c0f6f['set'](_0xf41a80['id'],_0xf41a80[_0x170f2a(0xfb)][_0x170f2a(0x117)]);}for(const _0x2ca34b of _0x4c5807){_0x24f3e4['set'](_0x2ca34b['id'],_0x2ca34b['attributes'][_0x170f2a(0x117)]);}const _0x376e1b={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x381dac,'TextKnowledgeBase':_0x51a020,'Agent':_0x24f3e4,'ExperimentalKnowledgeBase':_0x3c0f6f}),'resolvePromptName':async()=>undefined,'onWarning':_0x5b7dd4=>this[_0x170f2a(0x128)][_0x170f2a(0x140)](_0x5b7dd4)},_0x5b6415=a97_0x53f5e9[_0x170f2a(0xac)](_0x239208,_0x170f2a(0x178)),_0x390f00=a97_0x53f5e9['join'](_0x239208,_0x170f2a(0x8b)),_0x1f2635=a97_0x53f5e9[_0x170f2a(0xac)](_0x239208,_0x170f2a(0x188)),_0x377751=!a97_0x14cb22[_0x170f2a(0xcf)](_0x390f00);if(_0x57acf9?.[_0x170f2a(0xf2)])return{'agentName':_0x2bc597,'outputPath':_0x239208,'isNew':_0x377751,'hasChanges':!![]};a97_0x14cb22[_0x170f2a(0xf7)](_0x3116d9,{'recursive':!![]}),a97_0x14cb22['mkdirSync'](_0x239208,{'recursive':!![]});const _0x5a7926=a97_0x53f5e9['join'](_0x3116d9,_0x170f2a(0x10b));!a97_0x14cb22['existsSync'](_0x5a7926)&&a97_0x14cb22[_0x170f2a(0x15e)](_0x5a7926,createAgentConfigContent(_0x23a8c4));const {yaml:_0x1f630b,systemPrompt:_0x2d8b25,starterMessage:_0x1a8b25}=await agentResponseToDef(_0x5632b1,_0x376e1b);let _0x4ecd6b=_0x377751;if(!_0x377751){const _0x1ed952=a97_0x14cb22[_0x170f2a(0xcf)](_0x5b6415)?a97_0x14cb22['readFileSync'](_0x5b6415,'utf-8'):'',_0x4c2ba9=a97_0x14cb22[_0x170f2a(0xe6)](_0x390f00,_0x170f2a(0x109));_0x4ecd6b=_0x1ed952!==_0x2d8b25||_0x4c2ba9!==toAgentYamlString(_0x1f630b);}a97_0x14cb22[_0x170f2a(0x15e)](_0x5b6415,_0x2d8b25),a97_0x14cb22[_0x170f2a(0x15e)](_0x390f00,toAgentYamlString(_0x1f630b));if(_0x1a8b25&&_0x1a8b25[_0x170f2a(0x154)]('\x0a'))a97_0x14cb22[_0x170f2a(0x15e)](_0x1f2635,_0x1a8b25);else a97_0x14cb22['existsSync'](_0x1f2635)&&a97_0x14cb22[_0x170f2a(0x16f)](_0x1f2635);return{'agentName':_0x2bc597,'outputPath':_0x239208,'isNew':_0x377751,'hasChanges':_0x4ecd6b};}async[a97_0x5796d4(0xc9)](_0x19f8ec,_0x1df468){const _0x170bfa=a97_0x5796d4;let _0x2cb6e0;isAgentYamlPath(_0x19f8ec)?_0x2cb6e0=getAgentDirFromYamlPath(_0x19f8ec):_0x2cb6e0=_0x19f8ec;const {config:_0x47e380}=findAgentConfig(_0x2cb6e0),_0x1d18b7=await this[_0x170bfa(0x190)](_0x47e380[_0x170bfa(0xf4)]),_0x44b145=a97_0x53f5e9[_0x170bfa(0xac)](_0x2cb6e0,_0x170bfa(0x8b)),_0x1b0f78=a97_0x53f5e9['join'](_0x2cb6e0,_0x170bfa(0x178)),_0xe52cf8=a97_0x53f5e9[_0x170bfa(0xac)](_0x2cb6e0,_0x170bfa(0x188));if(!a97_0x14cb22[_0x170bfa(0xcf)](_0x44b145))throw new SDKError(ErrorCode[_0x170bfa(0x135)],_0x170bfa(0x12b)+_0x2cb6e0,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x270912=parseAgentYaml(a97_0x14cb22[_0x170bfa(0xe6)](_0x44b145,_0x170bfa(0x109)),_0x44b145),_0x2917ea=a97_0x14cb22[_0x170bfa(0xcf)](_0x1b0f78)?a97_0x14cb22[_0x170bfa(0xe6)](_0x1b0f78,_0x170bfa(0x109)):'',_0x58ca0c=a97_0x14cb22[_0x170bfa(0xcf)](_0xe52cf8)?a97_0x14cb22[_0x170bfa(0xe6)](_0xe52cf8,_0x170bfa(0x109)):_0x270912[_0x170bfa(0x19d)];if(_0x1df468?.[_0x170bfa(0xf2)])return{'agentName':_0x270912[_0x170bfa(0x117)],'action':_0x170bfa(0xd0),'projectId':_0x1d18b7};const _0x567c1f=await this[_0x170bfa(0x15c)][_0x170bfa(0x197)](_0x1d18b7),_0x3e6392=await fetchAllToolTargetMaps((_0x1b80e1,_0x145854)=>this[_0x170bfa(0x15c)][_0x170bfa(0xb5)](_0x1b80e1,_0x145854),_0x1d18b7),_0xad49f3=new Map();for(const _0x391616 of _0x567c1f){_0xad49f3[_0x170bfa(0x176)](_0x391616[_0x170bfa(0xfb)][_0x170bfa(0x117)],_0x391616['id']);}const _0x5b2b04=[],_0x3aa3cc={'projectId':_0x1d18b7,'resolveToolTargetId':buildIdResolver({..._0x3e6392[_0x170bfa(0xec)],'Agent':_0xad49f3}),'resolvePromptId':async()=>undefined,'onWarning':_0x2b3ab0=>{const _0x1ff6ed=_0x170bfa;this['logger']['warn'](_0x2b3ab0),_0x5b2b04[_0x1ff6ed(0x175)](_0x2b3ab0);}};try{const _0x3d0c84=_0x567c1f['find'](_0x5363fb=>_0x5363fb['attributes'][_0x170bfa(0x117)]===_0x270912[_0x170bfa(0x117)]),_0x43d121=await agentDefToRequest(_0x270912,_0x2917ea,_0x58ca0c,_0x3aa3cc);if(_0x3d0c84)return await this[_0x170bfa(0x15c)]['updateAgentResponse'](_0x3d0c84['id'],_0x43d121),{'agentName':_0x270912[_0x170bfa(0x117)],'action':_0x170bfa(0x124),'projectId':_0x1d18b7,'agentId':_0x3d0c84['id'],'warnings':_0x5b2b04[_0x170bfa(0x19b)]>0x0?_0x5b2b04:undefined};else{const _0x19d9b4=await this[_0x170bfa(0x15c)][_0x170bfa(0xba)](_0x43d121);return{'agentName':_0x270912[_0x170bfa(0x117)],'action':_0x170bfa(0xd0),'projectId':_0x1d18b7,'agentId':_0x19d9b4['id'],'warnings':_0x5b2b04[_0x170bfa(0x19b)]>0x0?_0x5b2b04:undefined};}}catch(_0x59fe4b){return{'agentName':_0x270912[_0x170bfa(0x117)],'action':_0x170bfa(0xa0),'projectId':_0x1d18b7,'error':_0x59fe4b[_0x170bfa(0x149)],'warnings':_0x5b2b04[_0x170bfa(0x19b)]>0x0?_0x5b2b04:undefined};}}async[a97_0x5796d4(0xe3)](_0x1ac184,_0xdf01bc,_0x12a0d5){const _0x48f2e5=a97_0x5796d4,_0x6c2430=a97_0x14cb22['existsSync'](_0x1ac184)&&a97_0x14cb22['existsSync'](a97_0x53f5e9[_0x48f2e5(0xac)](_0x1ac184,_0x48f2e5(0x10b)));let _0x308ac1;const _0x27806e=[],_0x1d4201=[],_0x544ea5=[],_0x488216=[],_0x36d7bd=[],_0x437c46=[],_0x24f836=[];if(_0x6c2430){const _0x1fa6ae=loadAgentConfig(a97_0x53f5e9[_0x48f2e5(0xac)](_0x1ac184,_0x48f2e5(0x10b)));_0x308ac1=_0x1fa6ae[_0x48f2e5(0xf4)];const _0x2188ea=a97_0x14cb22[_0x48f2e5(0x89)](_0x1ac184,{'withFileTypes':!![]});for(const _0x19c006 of _0x2188ea){if(!_0x19c006[_0x48f2e5(0x165)]())continue;if([_0x48f2e5(0xa4),_0x48f2e5(0xf9),_0x48f2e5(0xb2),_0x48f2e5(0x82),'integrations']['includes'](_0x19c006['name']))continue;const _0x2594c5=a97_0x53f5e9['join'](_0x1ac184,_0x19c006[_0x48f2e5(0x117)]);if(isAgentDir(_0x2594c5)){const _0x2573a5=a97_0x53f5e9[_0x48f2e5(0xac)](_0x2594c5,_0x48f2e5(0x8b)),_0x37b356=a97_0x53f5e9[_0x48f2e5(0xac)](_0x2594c5,_0x48f2e5(0x178)),_0x584689=a97_0x53f5e9[_0x48f2e5(0xac)](_0x2594c5,_0x48f2e5(0x188)),_0x3411cd=parseAgentYaml(a97_0x14cb22[_0x48f2e5(0xe6)](_0x2573a5,'utf-8'),_0x2573a5),_0x1ec3e4=a97_0x14cb22[_0x48f2e5(0xcf)](_0x37b356)?a97_0x14cb22['readFileSync'](_0x37b356,_0x48f2e5(0x109)):'',_0x4bfeac=a97_0x14cb22[_0x48f2e5(0xcf)](_0x584689)?a97_0x14cb22[_0x48f2e5(0xe6)](_0x584689,_0x48f2e5(0x109)):_0x3411cd[_0x48f2e5(0x19d)];_0x27806e[_0x48f2e5(0x175)]({'name':_0x3411cd[_0x48f2e5(0x117)],'dir':_0x2594c5,'yaml':_0x3411cd,'systemPrompt':_0x1ec3e4,'starterMessage':_0x4bfeac});}}const _0x281bf5=getKnowledgeBasesDir(_0x1ac184);if(a97_0x14cb22['existsSync'](_0x281bf5)){const _0x42ce15=a97_0x14cb22[_0x48f2e5(0x89)](_0x281bf5);for(const _0x3c0848 of _0x42ce15){const _0x40c501=a97_0x53f5e9[_0x48f2e5(0xac)](_0x281bf5,_0x3c0848);if(_0x3c0848[_0x48f2e5(0xf6)](_0x48f2e5(0x153))){const _0x40eb71=parseKnowledgeBaseYaml(a97_0x14cb22[_0x48f2e5(0xe6)](_0x40c501,_0x48f2e5(0x109)),_0x40c501);_0x1d4201[_0x48f2e5(0x175)]({'name':_0x40eb71['name'],'path':_0x40c501,'yaml':_0x40eb71});}else{if(_0x3c0848[_0x48f2e5(0xf6)](_0x48f2e5(0x132))){const _0x4fb67b=a97_0x14cb22[_0x48f2e5(0xe6)](_0x40c501,_0x48f2e5(0x109)),{name:_0x52e99d,text:_0xc50b82}=parseTextKnowledgeBaseMd(_0x4fb67b,_0x3c0848);_0x544ea5[_0x48f2e5(0x175)]({'name':_0x52e99d,'path':_0x40c501,'text':_0xc50b82});}}}}const _0x280f68=getPromptsDir(_0x1ac184);if(a97_0x14cb22['existsSync'](_0x280f68)){const _0x5ca58c=a97_0x14cb22[_0x48f2e5(0x89)](_0x280f68)[_0x48f2e5(0xc2)](_0x4b27c4=>_0x4b27c4[_0x48f2e5(0xf6)](_0x48f2e5(0x153)));for(const _0x35d439 of _0x5ca58c){const _0x4bef27=a97_0x53f5e9['join'](_0x280f68,_0x35d439),_0x50e0a3=parsePromptYaml(a97_0x14cb22[_0x48f2e5(0xe6)](_0x4bef27,_0x48f2e5(0x109)),_0x4bef27);_0x488216[_0x48f2e5(0x175)]({'name':_0x50e0a3['name'],'path':_0x4bef27,'yaml':_0x50e0a3});}}const _0x26baff=getIntegrationsDir(_0x1ac184);if(a97_0x14cb22[_0x48f2e5(0xcf)](_0x26baff)){const _0x2130c1=a97_0x14cb22[_0x48f2e5(0x89)](_0x26baff)[_0x48f2e5(0xc2)](_0x441408=>_0x441408['endsWith'](_0x48f2e5(0x153)));for(const _0x58e4c7 of _0x2130c1){const _0x3c76d5=a97_0x53f5e9[_0x48f2e5(0xac)](_0x26baff,_0x58e4c7),_0x1fe996=parseIntegrationYaml(a97_0x14cb22[_0x48f2e5(0xe6)](_0x3c76d5,_0x48f2e5(0x109)),_0x3c76d5);SAFE_INTEGRATION_TYPES[_0x48f2e5(0x154)](_0x1fe996['service_type'][_0x48f2e5(0xee)]())?_0x36d7bd[_0x48f2e5(0x175)]({'name':_0x1fe996[_0x48f2e5(0x117)],'path':_0x3c76d5,'yaml':_0x1fe996}):this[_0x48f2e5(0x128)][_0x48f2e5(0x140)]('Skipping\x20integration\x20\x27'+_0x1fe996['name']+_0x48f2e5(0x139)+_0x1fe996[_0x48f2e5(0xcb)]+_0x48f2e5(0x186)+(_0x48f2e5(0x122)+SAFE_INTEGRATION_TYPES[_0x48f2e5(0xac)](',\x20')+_0x48f2e5(0x168)));}}const _0x3904b6=getExperimentalKnowledgeBasesDir(_0x1ac184);if(a97_0x14cb22[_0x48f2e5(0xcf)](_0x3904b6)){const _0x22a620=a97_0x14cb22[_0x48f2e5(0x89)](_0x3904b6,{'withFileTypes':!![]});for(const _0x2684f8 of _0x22a620){if(!_0x2684f8[_0x48f2e5(0x165)]())continue;const _0x28885b=a97_0x53f5e9[_0x48f2e5(0xac)](_0x3904b6,_0x2684f8[_0x48f2e5(0x117)]),_0x4ccea7=a97_0x53f5e9[_0x48f2e5(0xac)](_0x28885b,_0x2684f8[_0x48f2e5(0x117)]+'.yml');if(a97_0x14cb22[_0x48f2e5(0xcf)](_0x4ccea7)){const _0x259ca0=parseExperimentalKnowledgeBaseYaml(a97_0x14cb22[_0x48f2e5(0xe6)](_0x4ccea7,_0x48f2e5(0x109)),_0x4ccea7),_0x2b53e2=a97_0x53f5e9[_0x48f2e5(0xac)](_0x28885b,'functions'),_0x449983=[];if(a97_0x14cb22[_0x48f2e5(0xcf)](_0x2b53e2)){const _0x43c839=a97_0x14cb22['readdirSync'](_0x2b53e2,{'withFileTypes':!![]});for(const _0x1e38f8 of _0x43c839){if(!_0x1e38f8[_0x48f2e5(0x165)]())continue;const _0x5381f4=a97_0x53f5e9[_0x48f2e5(0xac)](_0x2b53e2,_0x1e38f8[_0x48f2e5(0x117)]),_0x11650a=a97_0x53f5e9[_0x48f2e5(0xac)](_0x5381f4,_0x48f2e5(0xff)),_0x173342=a97_0x53f5e9['join'](_0x5381f4,_0x48f2e5(0x112));if(a97_0x14cb22[_0x48f2e5(0xcf)](_0x11650a)&&a97_0x14cb22[_0x48f2e5(0xcf)](_0x173342)){const _0x39755b=a97_0x14cb22[_0x48f2e5(0xe6)](_0x11650a,_0x48f2e5(0x109)),_0x486f91=a97_0x14cb22[_0x48f2e5(0xe6)](_0x173342,_0x48f2e5(0x109));_0x449983[_0x48f2e5(0x175)]({'name':_0x1e38f8[_0x48f2e5(0x117)],'code':_0x39755b,'json_schema':_0x486f91});}}}const _0x334527={..._0x259ca0,'functions':_0x449983};_0x437c46[_0x48f2e5(0x175)]({'name':_0x259ca0[_0x48f2e5(0x117)],'path':_0x28885b,'def':_0x334527});}}}const _0xa3795a=getExperimentalArtifactsDir(_0x1ac184);if(a97_0x14cb22[_0x48f2e5(0xcf)](_0xa3795a)){const _0x5496c0=a97_0x14cb22[_0x48f2e5(0x89)](_0xa3795a,{'withFileTypes':!![]});for(const _0x33efdd of _0x5496c0){if(!_0x33efdd[_0x48f2e5(0x165)]())continue;const _0x443e1e=a97_0x53f5e9[_0x48f2e5(0xac)](_0xa3795a,_0x33efdd[_0x48f2e5(0x117)]),_0x2e6d15=a97_0x53f5e9[_0x48f2e5(0xac)](_0x443e1e,_0x33efdd['name']+'.yml');if(a97_0x14cb22[_0x48f2e5(0xcf)](_0x2e6d15)){const _0x5a1358=parseExperimentalArtifactYaml(a97_0x14cb22[_0x48f2e5(0xe6)](_0x2e6d15,'utf-8'),_0x2e6d15),_0xf53785=a97_0x53f5e9[_0x48f2e5(0xac)](_0x443e1e,_0x48f2e5(0xff)),_0x494331=a97_0x14cb22[_0x48f2e5(0xcf)](_0xf53785)?a97_0x14cb22[_0x48f2e5(0xe6)](_0xf53785,_0x48f2e5(0x109)):'',_0xe79b85=a97_0x53f5e9[_0x48f2e5(0xac)](_0x443e1e,'files'),_0x3ded75=[];if(a97_0x14cb22[_0x48f2e5(0xcf)](_0xe79b85)){const _0x288bc5=a97_0x14cb22['readdirSync'](_0xe79b85);for(const _0x19e30f of _0x288bc5){const _0x57d334=a97_0x53f5e9[_0x48f2e5(0xac)](_0xe79b85,_0x19e30f);if(a97_0x14cb22[_0x48f2e5(0x17b)](_0x57d334)[_0x48f2e5(0x14b)]()){const _0x5121fa=a97_0x14cb22['readFileSync'](_0x57d334,_0x48f2e5(0x109));_0x3ded75[_0x48f2e5(0x175)]({'file_name':_0x19e30f,'text_content':_0x5121fa});}}}const _0x59de3f={..._0x5a1358,'code':_0x494331,'files':_0x3ded75};_0x24f836['push']({'name':_0x5a1358[_0x48f2e5(0x117)],'path':_0x443e1e,'def':_0x59de3f});}}}}else{const _0x5c432c=await this[_0x48f2e5(0x190)](_0x1ac184),_0x39377c=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x179)](_0x5c432c);_0x308ac1=_0x39377c[_0x48f2e5(0xfb)][_0x48f2e5(0x117)];const _0x4076d9=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x197)](_0x5c432c),_0x1a0dfe=await this['client'][_0x48f2e5(0x126)](_0x5c432c),_0x3ec90f=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x8e)](_0x5c432c),_0x491a89=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x11b)](_0x5c432c),_0x1d88bf=await this[_0x48f2e5(0x15c)][_0x48f2e5(0xd6)](_0x5c432c),_0x21e804=await this[_0x48f2e5(0x15c)]['listExperimentalKnowledgeBases'](_0x5c432c),_0x5a8deb=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x8d)](_0x5c432c),_0x3e4193=new Map(),_0x142e53=new Map(),_0x17d18a=new Map(),_0x428f8e=new Map(),_0x2d94ea=new Map(),_0xe55782=new Map();for(const _0x234240 of _0x1a0dfe){_0x3e4193[_0x48f2e5(0x176)](_0x234240['id'],_0x234240[_0x48f2e5(0xfb)]['name']);}for(const _0xe66320 of _0x3ec90f){_0x142e53[_0x48f2e5(0x176)](_0xe66320['id'],_0xe66320[_0x48f2e5(0xfb)][_0x48f2e5(0x117)]);}for(const _0x3b8173 of _0x4076d9){_0x17d18a[_0x48f2e5(0x176)](_0x3b8173['id'],_0x3b8173['attributes'][_0x48f2e5(0x117)]);}for(const _0x203eda of _0x491a89){_0x428f8e[_0x48f2e5(0x176)](_0x203eda['id'],_0x203eda[_0x48f2e5(0xfb)][_0x48f2e5(0x117)]);}for(const _0x4e2adc of _0x21e804){_0x2d94ea['set'](_0x4e2adc['id'],_0x4e2adc[_0x48f2e5(0xfb)]['name']);}for(const _0x3ea121 of _0x5a8deb){_0xe55782['set'](_0x3ea121['id'],_0x3ea121[_0x48f2e5(0xfb)][_0x48f2e5(0x117)]);}const _0x258adc={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x3e4193,'TextKnowledgeBase':_0x142e53,'Agent':_0x17d18a,'ExperimentalKnowledgeBase':_0x2d94ea}),'resolvePromptName':async _0x468c45=>_0x428f8e[_0x48f2e5(0x167)](_0x468c45),'onWarning':_0xcb9d45=>this[_0x48f2e5(0x128)][_0x48f2e5(0x140)](_0xcb9d45)};for(const _0x331c47 of _0x4076d9){const _0x5a5f56=await agentResponseToDef(_0x331c47,_0x258adc),{yaml:_0xf91585,systemPrompt:_0x1c068f,starterMessage:_0x4f372d}=_0x5a5f56;_0x27806e[_0x48f2e5(0x175)]({'name':_0xf91585['name'],'dir':'','yaml':_0xf91585,'systemPrompt':_0x1c068f,'starterMessage':_0x4f372d});}for(const _0x395667 of _0x1a0dfe){const _0x3c3b11=apiKnowledgeBaseToYaml(_0x395667);_0x1d4201['push']({'name':_0x3c3b11[_0x48f2e5(0x117)],'path':'','yaml':_0x3c3b11});}for(const _0x55d595 of _0x3ec90f){_0x544ea5['push']({'name':_0x55d595[_0x48f2e5(0xfb)][_0x48f2e5(0x117)],'path':'','text':_0x55d595[_0x48f2e5(0xfb)][_0x48f2e5(0xd9)]});}for(const _0x277941 of _0x491a89){const _0x9027e7=await apiPromptToYaml(_0x277941,_0x258adc);_0x9027e7&&_0x488216[_0x48f2e5(0x175)]({'name':_0x9027e7[_0x48f2e5(0x117)],'path':'','yaml':_0x9027e7});}for(const _0x22c81a of _0x1d88bf){if(!_0x22c81a[_0x48f2e5(0xfb)][_0x48f2e5(0x148)]&&SAFE_INTEGRATION_TYPES[_0x48f2e5(0x154)](_0x22c81a[_0x48f2e5(0xfb)][_0x48f2e5(0x15b)]['toLowerCase']())){const _0x217a51=await apiIntegrationToYaml(_0x22c81a,_0x258adc);_0x36d7bd['push']({'name':_0x22c81a[_0x48f2e5(0xfb)][_0x48f2e5(0x15b)]['toLowerCase'](),'path':'','yaml':_0x217a51});}}for(const _0x1b2856 of _0x21e804){const _0x4b3c20=apiExperimentalKnowledgeBaseToYaml(_0x1b2856);_0x437c46[_0x48f2e5(0x175)]({'name':_0x4b3c20[_0x48f2e5(0x117)],'path':'','def':_0x4b3c20});}for(const _0x22974a of _0x5a8deb){const _0x52e00f=apiExperimentalArtifactToYaml(_0x22974a);_0x24f836[_0x48f2e5(0x175)]({'name':_0x52e00f[_0x48f2e5(0x117)],'path':'','def':_0x52e00f});}}const _0x176926={'sourceProjectName':_0x308ac1,'newProjectName':_0xdf01bc,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x53d471=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x12d)](),_0x2aa76b=_0x53d471[_0x48f2e5(0xf3)](_0x4eca8a=>_0x4eca8a[_0x48f2e5(0xfb)]['name']===_0xdf01bc);if(_0x2aa76b)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x48f2e5(0xce)+_0xdf01bc+_0x48f2e5(0xd2),undefined,{'helpText':_0x48f2e5(0x123)});if(_0x12a0d5?.[_0x48f2e5(0xf2)])return _0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0xe0)][_0x48f2e5(0xd0)]=_0x27806e[_0x48f2e5(0x19b)],_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0xd7)][_0x48f2e5(0xd0)]=_0x1d4201[_0x48f2e5(0x19b)],_0x176926['counts']['textKnowledgeBases']['created']=_0x544ea5[_0x48f2e5(0x19b)],_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0xbe)][_0x48f2e5(0xd0)]=_0x437c46[_0x48f2e5(0x19b)],_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x9f)][_0x48f2e5(0xd0)]=_0x24f836[_0x48f2e5(0x19b)],_0x176926['counts'][_0x48f2e5(0x82)][_0x48f2e5(0xd0)]=_0x488216[_0x48f2e5(0x19b)],_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x110)][_0x48f2e5(0xd0)]=_0x36d7bd[_0x48f2e5(0x19b)],_0x176926;const _0x4da7a6=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x17e)]({'name':_0xdf01bc}),_0x48050c=_0x4da7a6['id'];_0x176926[_0x48f2e5(0x138)]=_0x48050c;const _0x40bdde=new Map(),_0x38663d=new Map(),_0x1ad122=new Map(),_0x67e0f4=new Map(),_0xb77a21=new Map(),_0x4cd720=new Map(),_0x3ed60d=new Map(),_0x30116f=new Map(),_0x57e218=new Set(),_0x4c0341=new Set();for(const _0x2dbcb7 of _0x27806e){for(const _0x3c0c89 of _0x2dbcb7[_0x48f2e5(0x159)][_0x48f2e5(0x107)]||[]){if(_0x3c0c89[_0x48f2e5(0xf8)]===_0x48f2e5(0x11f)&&_0x3c0c89[_0x48f2e5(0x14e)]){const _0x1f61cb=parseRef(_0x3c0c89[_0x48f2e5(0x14e)]);if(_0x1f61cb)_0x57e218[_0x48f2e5(0x9d)](_0x1f61cb[_0x48f2e5(0x117)]);}else{if(_0x3c0c89['type']===_0x48f2e5(0xbb)&&_0x3c0c89['target']){const _0x3546ef=parseRef(_0x3c0c89[_0x48f2e5(0x14e)]);if(_0x3546ef)_0x4c0341[_0x48f2e5(0x9d)](_0x3546ef[_0x48f2e5(0x117)]);}}}}for(const _0x109eec of _0x57e218){try{const _0x419139=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x172)]({'projectId':_0x48050c,'name':_0x109eec});_0xb77a21['set'](_0x109eec,_0x419139['id']),_0x176926[_0x48f2e5(0xef)][_0x48f2e5(0x175)]({'name':_0x109eec,'action':_0x48f2e5(0xd0),'id':_0x419139['id']}),_0x176926[_0x48f2e5(0x8a)]['imageGenerators'][_0x48f2e5(0xd0)]++;}catch(_0x3fa8fe){_0x176926[_0x48f2e5(0xef)][_0x48f2e5(0x175)]({'name':_0x109eec,'action':_0x48f2e5(0xa0),'error':_0x3fa8fe[_0x48f2e5(0x149)]}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0xef)][_0x48f2e5(0x17f)]++;}}for(const _0x2ffbe2 of _0x4c0341){try{const _0x3a099e=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x11e)]({'projectId':_0x48050c,'name':_0x2ffbe2});_0x4cd720['set'](_0x2ffbe2,_0x3a099e['id']),_0x176926[_0x48f2e5(0x177)][_0x48f2e5(0x175)]({'name':_0x2ffbe2,'action':_0x48f2e5(0xd0),'id':_0x3a099e['id']}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x177)][_0x48f2e5(0xd0)]++;}catch(_0x547136){_0x176926[_0x48f2e5(0x177)][_0x48f2e5(0x175)]({'name':_0x2ffbe2,'action':'error','error':_0x547136['message']}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x177)]['errors']++;}}const _0x5bad00=await fetchAllToolTargetMaps((_0x5d746e,_0xcc1520)=>this['client']['listToolTargets'](_0x5d746e,_0xcc1520),_0x48050c);let _0xef4a56=[];const _0x5769fa={'projectId':_0x48050c,'resolveToolTargetId':buildIdResolver({..._0x5bad00[_0x48f2e5(0xec)],'KnowledgeBase':_0x40bdde,'TextKnowledgeBase':_0x38663d,'ExperimentalKnowledgeBase':_0x3ed60d,'Agent':_0x1ad122,'WebSearchTool':_0x4cd720,'ImageGenerator':_0xb77a21}),'resolvePromptId':async _0x36011a=>_0x67e0f4[_0x48f2e5(0x167)](_0x36011a),'onWarning':_0x56dbf9=>{const _0x1fb3e9=_0x48f2e5;this[_0x1fb3e9(0x128)][_0x1fb3e9(0x140)](_0x56dbf9),_0xef4a56[_0x1fb3e9(0x175)](_0x56dbf9);}};for(const _0x179007 of _0x1d4201){try{const _0x30e92e=yamlKnowledgeBaseToApi(_0x179007[_0x48f2e5(0x159)],_0x48050c),_0x25d06d=await this[_0x48f2e5(0x15c)]['createKnowledgeBase'](_0x30e92e);_0x40bdde[_0x48f2e5(0x176)](_0x179007['yaml'][_0x48f2e5(0x117)],_0x25d06d['id']),_0x176926[_0x48f2e5(0xd7)][_0x48f2e5(0x175)]({'name':_0x179007[_0x48f2e5(0x159)][_0x48f2e5(0x117)],'action':_0x48f2e5(0xd0),'id':_0x25d06d['id']}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0xd7)][_0x48f2e5(0xd0)]++;}catch(_0x2cb291){_0x176926[_0x48f2e5(0xd7)][_0x48f2e5(0x175)]({'name':_0x179007[_0x48f2e5(0x159)][_0x48f2e5(0x117)],'action':_0x48f2e5(0xa0),'error':_0x2cb291[_0x48f2e5(0x149)]}),_0x176926['counts'][_0x48f2e5(0xd7)]['errors']++;}}for(const _0x23961d of _0x544ea5){try{const _0x583e14=yamlTextKnowledgeBaseToApi({'name':_0x23961d[_0x48f2e5(0x117)],'text':_0x23961d['text']},_0x48050c),_0x14b7ed=await this[_0x48f2e5(0x15c)]['createTextKnowledgeBase'](_0x583e14);_0x38663d[_0x48f2e5(0x176)](_0x23961d[_0x48f2e5(0x117)],_0x14b7ed['id']),_0x176926['textKnowledgeBases']['push']({'name':_0x23961d[_0x48f2e5(0x117)],'action':_0x48f2e5(0xd0),'id':_0x14b7ed['id']}),_0x176926[_0x48f2e5(0x8a)]['textKnowledgeBases']['created']++;}catch(_0x3a6cfb){_0x176926['textKnowledgeBases'][_0x48f2e5(0x175)]({'name':_0x23961d[_0x48f2e5(0x117)],'action':'error','error':_0x3a6cfb[_0x48f2e5(0x149)]}),_0x176926['counts'][_0x48f2e5(0x184)][_0x48f2e5(0x17f)]++;}}for(const _0x122223 of _0x24f836){try{const _0x6df426=yamlExperimentalArtifactToApi(_0x122223[_0x48f2e5(0xa9)],_0x48050c),_0x4df5b7=await this[_0x48f2e5(0x15c)][_0x48f2e5(0xd4)](_0x6df426);_0x30116f[_0x48f2e5(0x176)](_0x122223[_0x48f2e5(0xa9)][_0x48f2e5(0x117)],_0x4df5b7['id']),_0x176926[_0x48f2e5(0x9f)][_0x48f2e5(0x175)]({'name':_0x122223[_0x48f2e5(0xa9)][_0x48f2e5(0x117)],'action':_0x48f2e5(0xd0),'id':_0x4df5b7['id']}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x9f)][_0x48f2e5(0xd0)]++;}catch(_0x1f09e0){_0x176926['experimentalArtifacts']['push']({'name':_0x122223['def']['name'],'action':'error','error':_0x1f09e0[_0x48f2e5(0x149)]}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x9f)]['errors']++;}}for(const _0x37a132 of _0x437c46){try{const _0x1027f6=yamlExperimentalKnowledgeBaseToApi(_0x37a132[_0x48f2e5(0xa9)],_0x48050c),_0x1e8823=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x84)](_0x1027f6);_0x3ed60d[_0x48f2e5(0x176)](_0x37a132['def'][_0x48f2e5(0x117)],_0x1e8823['id']),_0x176926['experimentalKnowledgeBases']['push']({'name':_0x37a132[_0x48f2e5(0xa9)][_0x48f2e5(0x117)],'action':'created','id':_0x1e8823['id']}),_0x176926['counts']['experimentalKnowledgeBases'][_0x48f2e5(0xd0)]++;}catch(_0x2201fd){_0x176926[_0x48f2e5(0xbe)][_0x48f2e5(0x175)]({'name':_0x37a132[_0x48f2e5(0xa9)][_0x48f2e5(0x117)],'action':'error','error':_0x2201fd[_0x48f2e5(0x149)]}),_0x176926['counts'][_0x48f2e5(0xbe)][_0x48f2e5(0x17f)]++;}}const _0x3a6639=[..._0x27806e][_0x48f2e5(0xc7)]((_0x1d7e12,_0x4090be)=>{const _0x359951=_0x48f2e5,_0x29c664=_0x1d7e12[_0x359951(0x159)][_0x359951(0x107)]?.[_0x359951(0x183)](_0x674acb=>_0x674acb[_0x359951(0xf8)]===_0x359951(0x143))??![],_0x29193b=_0x4090be[_0x359951(0x159)][_0x359951(0x107)]?.[_0x359951(0x183)](_0x34e597=>_0x34e597[_0x359951(0xf8)]===_0x359951(0x143))??![];if(_0x29c664&&!_0x29193b)return 0x1;if(!_0x29c664&&_0x29193b)return-0x1;return 0x0;});for(const _0x51e851 of _0x3a6639){_0xef4a56=[];try{const _0x222bbd=_0x51e851[_0x48f2e5(0x159)][_0x48f2e5(0x107)]?.['filter'](_0x28ee54=>{const _0x10848d=_0x48f2e5;if(_0x28ee54['type']===_0x10848d(0x143)&&_0x28ee54[_0x10848d(0x14e)]){const _0x4e2c31=parseRef(_0x28ee54['target']);return _0x4e2c31?.['name']===_0x51e851[_0x10848d(0x159)][_0x10848d(0x117)];}return![];})??[];if(_0x222bbd[_0x48f2e5(0x19b)]>0x0){const _0x340c31='Agent\x20\x27'+_0x51e851[_0x48f2e5(0x159)][_0x48f2e5(0x117)]+_0x48f2e5(0x158)+_0x48f2e5(0x83);this['logger']['warn'](_0x340c31),_0xef4a56[_0x48f2e5(0x175)](_0x340c31);}const _0x39632a=await agentDefToRequest(_0x51e851[_0x48f2e5(0x159)],_0x51e851[_0x48f2e5(0x104)],_0x51e851[_0x48f2e5(0x119)],_0x5769fa),_0x229e33=await this[_0x48f2e5(0x15c)]['createAgentResponse'](_0x39632a);_0x1ad122[_0x48f2e5(0x176)](_0x51e851[_0x48f2e5(0x159)]['name'],_0x229e33['id']),_0x176926[_0x48f2e5(0xe0)][_0x48f2e5(0x175)]({'agentName':_0x51e851[_0x48f2e5(0x159)][_0x48f2e5(0x117)],'action':_0x48f2e5(0xd0),'agentId':_0x229e33['id'],'warnings':_0xef4a56[_0x48f2e5(0x19b)]>0x0?_0xef4a56:undefined}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0xe0)]['created']++;}catch(_0x8238c2){_0x176926[_0x48f2e5(0xe0)][_0x48f2e5(0x175)]({'agentName':_0x51e851[_0x48f2e5(0x159)][_0x48f2e5(0x117)],'action':'error','error':_0x8238c2[_0x48f2e5(0x149)],'warnings':_0xef4a56[_0x48f2e5(0x19b)]>0x0?_0xef4a56:undefined}),_0x176926[_0x48f2e5(0x8a)]['agents'][_0x48f2e5(0x17f)]++;}}for(const _0x4ff702 of _0x488216){try{const _0x7b56d7=await yamlPromptToApi(_0x4ff702[_0x48f2e5(0x159)],_0x48050c,_0x5769fa);if(!_0x7b56d7){_0x176926['prompts'][_0x48f2e5(0x175)]({'name':_0x4ff702[_0x48f2e5(0x159)][_0x48f2e5(0x117)],'action':'error','error':_0x48f2e5(0x10e)}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x82)][_0x48f2e5(0x17f)]++;continue;}const _0x229a6d=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x9c)](_0x7b56d7);_0x67e0f4[_0x48f2e5(0x176)](_0x4ff702[_0x48f2e5(0x159)][_0x48f2e5(0x117)],_0x229a6d['id']),_0x176926[_0x48f2e5(0x82)][_0x48f2e5(0x175)]({'name':_0x4ff702['yaml']['name'],'action':_0x48f2e5(0xd0),'id':_0x229a6d['id']}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x82)][_0x48f2e5(0xd0)]++;}catch(_0x349adc){_0x176926[_0x48f2e5(0x82)][_0x48f2e5(0x175)]({'name':_0x4ff702[_0x48f2e5(0x159)][_0x48f2e5(0x117)],'action':_0x48f2e5(0xa0),'error':_0x349adc[_0x48f2e5(0x149)]}),_0x176926[_0x48f2e5(0x8a)][_0x48f2e5(0x82)][_0x48f2e5(0x17f)]++;}}for(const _0x577a03 of _0x36d7bd){try{const _0x16134d=await yamlIntegrationToApi(_0x577a03[_0x48f2e5(0x159)],_0x48050c,_0x5769fa),_0x43d1b0=await this[_0x48f2e5(0x15c)][_0x48f2e5(0x19f)](_0x16134d);_0x176926[_0x48f2e5(0x110)][_0x48f2e5(0x175)]({'name':_0x577a03[_0x48f2e5(0x159)][_0x48f2e5(0xcb)],'action':_0x48f2e5(0xd0),'id':_0x43d1b0['id']}),_0x176926['counts']['integrations'][_0x48f2e5(0xd0)]++;}catch(_0x2d24c2){_0x176926[_0x48f2e5(0x110)]['push']({'name':_0x577a03[_0x48f2e5(0x159)][_0x48f2e5(0xcb)],'action':'error','error':_0x2d24c2[_0x48f2e5(0x149)]}),_0x176926['counts'][_0x48f2e5(0x110)][_0x48f2e5(0x17f)]++;}}return _0x176926;}}