@treasuredata/tdx 0.26.6 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.d.ts +4 -2
- package/dist/commands/claude-statusline-command.d.ts.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-statusline-command.js.map +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.d.ts.map +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/job-command.js.map +1 -1
- package/dist/commands/journey-command.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.d.ts.map +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-command.js.map +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.d.ts.map +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-push-command.js.map +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.d.ts.map +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/use-command.js.map +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.d.ts +2 -2
- package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/claude-usage-tracker.js.map +1 -1
- package/dist/proxy/passthrough-server.d.ts +18 -3
- package/dist/proxy/passthrough-server.d.ts.map +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/passthrough-server.js.map +1 -1
- package/dist/proxy/sse-usage-parser.d.ts +20 -2
- package/dist/proxy/sse-usage-parser.d.ts.map +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/proxy/sse-usage-parser.js.map +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.d.ts +14 -37
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.d.ts +82 -0
- package/dist/sdk/agent/tool-target-registry.d.ts.map +1 -0
- package/dist/sdk/agent/tool-target-registry.js +1 -0
- package/dist/sdk/agent/tool-target-registry.js.map +1 -0
- package/dist/sdk/agent/types/agent-def.d.ts +3 -2
- package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.d.ts +9 -0
- package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/cdp-api-client.js.map +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.d.ts +20 -0
- package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js.map +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.d.ts +2 -2
- package/dist/sdk/client/td-api-client.d.ts.map +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/td-api-client.js.map +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.d.ts +1 -1
- package/dist/sdk/job.d.ts.map +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/job.js.map +1 -1
- package/dist/sdk/journey.d.ts.map +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/journey.js.map +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.d.ts +0 -4
- package/dist/sdk/llm/model-factors.d.ts.map +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/model-factors.js.map +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.d.ts +2 -2
- package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.d.ts.map +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-utils.js.map +1 -1
- package/dist/sdk/segment/journey-validator.d.ts +3 -0
- package/dist/sdk/segment/journey-validator.d.ts.map +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-validator.js.map +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/pull-workflow.js.map +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.d.ts +8 -0
- package/dist/sdk/segment/push-workflow.d.ts.map +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js.map +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/segment-def.d.ts +10 -1
- package/dist/sdk/segment/types/segment-def.d.ts.map +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment/yaml-validator.js.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/cdp.d.ts +23 -15
- package/dist/sdk/types/cdp.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +3 -3
- package/dist/utils/port.d.ts +0 -18
- package/dist/utils/port.d.ts.map +0 -1
- package/dist/utils/port.js +0 -1
- package/dist/utils/port.js.map +0 -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;
|
|
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"}
|
package/dist/sdk/llm/index.js
CHANGED
|
@@ -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_0x353cf4=a97_0x5bc9;(function(_0x7cfe32,_0x1cb36f){const _0x5eda1d=a97_0x5bc9,_0x323841=_0x7cfe32();while(!![]){try{const _0x373c7f=-parseInt(_0x5eda1d(0x24e))/0x1+-parseInt(_0x5eda1d(0x231))/0x2*(parseInt(_0x5eda1d(0x23b))/0x3)+parseInt(_0x5eda1d(0x250))/0x4+-parseInt(_0x5eda1d(0x215))/0x5+-parseInt(_0x5eda1d(0x249))/0x6+parseInt(_0x5eda1d(0x1f2))/0x7+parseInt(_0x5eda1d(0x200))/0x8*(parseInt(_0x5eda1d(0x22d))/0x9);if(_0x373c7f===_0x1cb36f)break;else _0x323841['push'](_0x323841['shift']());}catch(_0x5513af){_0x323841['push'](_0x323841['shift']());}}}(a97_0x52b9,0xd355b));import{LLMApiClient}from'../client/llm-api-client.js';import*as a97_0x436715 from'node:fs';import*as a97_0x71957c from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a97_0x52b9(){const _0x353a50=['INVALID_ARGUMENT','toLowerCase','isDir','1503KpfREw','Project\x20not\x20found:\x20','text_content','basename','10BdbyPj','deleteAgent','createPrompt','sdk.llm','\x20---\x0a','Renamed\x20prompt\x20file:\x20','map','name','getUserSettings','getChatInfo','242859Qqbmhx','utf-8','availableModels','\x20in\x20project\x20','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','agents.json','UNAUTHENTICATED','starter_message.md','stringify','nameToId','sort','service_type','toISOString','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.','6024312rFbqFG','message','existsSync','file_name','json_schema','1424683IbUDGp','cloneProject','1190356pECHFZ','startChat','status','Renamed\x20folder:\x20','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','outputs','createImageGenerator','listTextKnowledgeBases','counts','Skipping\x20integration\x20\x27','dryRun','slackMessageMode','agent','oldPath',')\x20can\x20be\x20cloned.','pullProject','backupProject','getOrCreateDefaultProject','updatePrompt','updateAgent','chatWelcomeMessage','agent.yml\x20not\x20found\x20in\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','listImageGenerators','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','listProjects','getAgent','pushAgent','get','):\x20','Unable\x20to\x20create\x20project\x20after\x20','length','listExperimentalArtifacts','history','medium','\x27.\x20This\x20should\x20not\x20happen.','keys','size','some','listExperimentalKnowledgeBases','newProjectId','---\x20file:\x20','integrations','displayName','listPrompts','tdDatabaseName','_reasoning_','dry-run-','KnowledgeBase','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','createKnowledgeBase','has','Only\x20safe\x20types\x20(','idToName','add','new','exportedFrom','\x20→\x20','Agent\x20not\x20found:\x20','chatId','knowledgeBases','total','AGENT_NOT_FOUND','promptId','Renamed\x20KB\x20file:\x20','agents','listIntegrations','context','low','endsWith','prompts','listToolTargets','image_gen','conflict','.md','description','experimentalArtifacts','info','isFile','agent.yml','createWebSearchTool','statSync','profile','\x0a---\x20code\x20---\x0a','createAgentResponse','readFileSync','setDefaultAgent','functions','pushProject','Renamed\x20text\x20KB\x20file:\x20','Agent\x20\x27','renamed','setCurrentProject','tools','modelType','localeCompare','createExperimentalArtifact','listWebSearchTools','code.js','experimentalKnowledgeBases','createTextKnowledgeBase','\x0a---\x20function:\x20','resolveProjectId','ALREADY_EXISTS','dir','agentsFull','experimental_artifacts','join','\x0a---\x20schema:\x20','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','none','isDirectory','Multiple\x20projects\x20found\x20with\x20name\x20\x27','tdx_','\x0a\x0a#\x20agent.yml\x0a','Unresolved\x20dependencies:\x20','llm_project','json_schema.json','tdx.json','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','claude-4.5-sonnet','projectName','dirname','errors','Renamed\x20experimental\x20artifact\x20directory:\x20','NOT_FOUND','\x27\x20(','#\x20prompt.md\x0a','ExperimentalKnowledgeBase','minimal','split','push','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','currentProjectId','parse','Renamed\x20agent\x20folder:\x20','getProject','readdirSync','Renamed\x20experimental\x20KB\x20directory:\x20','filter','deleteProject','updateExperimentalKnowledgeBase','set','type','cwd','resolveAgentId','text','getBackupMetadata','metadata','project','knowledge_bases','getChatLog','(dry-run)','listKnowledgeBases','Renamed\x20integration\x20file:\x20','unchanged','chat','prompt.md','Output\x20directory\x20already\x20exists:\x20','mkdirSync','already\x20exists','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','listAgents','loadJsonFile','INTERNAL','systemPrompt','LLM_PROJECT_NOT_FOUND','createExperimentalKnowledgeBase','isManaged','version','chats','updated','imageGenerators','client','site','getCurrentProject','chat_agent_console','yaml','continueChat','experimental_knowledge_bases','includes','1413230zFBDLL','createAgent','prompts.json','models','chatIgnoreManagedActions','Multiple\x20agents\x20found\x20with\x20name\x20\x27','code','files','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','integrations.json','getOrCreateDefaultAgent','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','resolveProjectName','warn','230536xlAzFK','deleteIntegration','attributes','rmSync','project.json','reasoningEffort','created','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Removed\x20deleted\x20directory:\x20','.yml','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','starter_message','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','def','find','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','chat_generic','variables','projects','starterMessage','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','8063955lrAeeE','1.0','tables','textKnowledgeBases','knowledgebases.json','agentId','serviceType','Removed\x20deleted\x20file:\x20','path','getDefaultProjectName','updateTextKnowledgeBase','Agent\x20reference\x20not\x20found','logger','createIntegration','createProject','target','writeFileSync','updateAgentResponse','error','listAgentsFull','webSearchTools'];a97_0x52b9=function(){return _0x353a50;};return a97_0x52b9();}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';function a97_0x5bc9(_0x437ab4,_0x1dd135){_0x437ab4=_0x437ab4-0x194;const _0x52b9a8=a97_0x52b9();let _0x5bc90b=_0x52b9a8[_0x437ab4];return _0x5bc90b;}import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a97_0x353cf4(0x210),a97_0x353cf4(0x1ed),'chat_parent_segment'];export class LLMSDK{[a97_0x353cf4(0x1c2)];[a97_0x353cf4(0x1ea)];[a97_0x353cf4(0x293)];[a97_0x353cf4(0x221)]=Logger['of'](a97_0x353cf4(0x234));constructor(_0x418507){const _0x24c65b=a97_0x353cf4;this[_0x24c65b(0x1ea)]=new LLMApiClient(_0x418507),this['context']=_0x418507;}[a97_0x353cf4(0x21e)](){const _0x1d4241=getSanitizedUsername();return'tdx_default_'+_0x1d4241;}async[a97_0x353cf4(0x198)](_0x4dae21){const _0x1db435=a97_0x353cf4,{projectId:_0x338d86}=await this[_0x1db435(0x1fe)](_0x4dae21);this[_0x1db435(0x1c2)]=_0x338d86;}[a97_0x353cf4(0x1ec)](){return this['currentProjectId'];}async[a97_0x353cf4(0x2a6)](_0x463005){const _0x531233=a97_0x353cf4,_0x5160bc=this[_0x531233(0x293)][_0x531233(0x2a2)];let _0x40a3d3,_0x5b61f2;if(_0x463005[_0x531233(0x1f1)]('/')){const _0x1764c4=_0x463005[_0x531233(0x1bf)]('/');if(_0x1764c4[_0x531233(0x26f)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20agent\x20reference\x20format:\x20'+_0x463005,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x348dea,_0x36ddf3]=_0x1764c4;_0x40a3d3=await this['resolveProjectId'](_0x348dea),_0x5b61f2=_0x36ddf3;}else _0x40a3d3=this[_0x531233(0x1c2)]||(await this['getOrCreateDefaultProject']())['id'],_0x5b61f2=_0x463005;const _0x5e5642=await this[_0x531233(0x1ce)](_0x5b61f2,_0x40a3d3),_0x364801=await this[_0x531233(0x1ea)]['getAgent'](_0x5e5642);writeCachedLLMAgent(_0x364801['attributes']['name'],_0x5e5642,_0x40a3d3,_0x5160bc);}['getDefaultAgent'](){const _0x1b9406=a97_0x353cf4,_0x2b97fe=this[_0x1b9406(0x293)][_0x1b9406(0x2a2)];return readCachedLLMAgent(_0x2b97fe)||undefined;}['clearDefaultAgent'](){const _0x21a03a=a97_0x353cf4,_0x22cdcb=this[_0x21a03a(0x293)][_0x21a03a(0x2a2)];clearCachedLLMAgent(_0x22cdcb);}async[a97_0x353cf4(0x1f5)](){const _0x2c7752=a97_0x353cf4,_0x2868dd=await this[_0x2c7752(0x1ea)][_0x2c7752(0x239)](),_0x519205=[];for(const _0x2b91c8 of _0x2868dd['availableModelNames']){const _0x1b379f=_0x2868dd[_0x2c7752(0x23d)][_0x2b91c8];_0x1b379f&&_0x519205[_0x2c7752(0x1c0)]({'name':_0x2b91c8,'displayName':_0x1b379f[_0x2c7752(0x27b)]});}return _0x519205;}async['createProject'](_0xb8fffd){const _0x52c0aa=a97_0x353cf4;return await this[_0x52c0aa(0x1ea)][_0x52c0aa(0x223)](_0xb8fffd);}async[a97_0x353cf4(0x1c9)](_0x5c3176){const {projectId:_0x53b8db}=await this['resolveProjectName'](_0x5c3176);await this['client']['deleteProject'](_0x53b8db);}async[a97_0x353cf4(0x212)](_0x105ff5=0x32){const _0x5697d4=a97_0x353cf4;return await this[_0x5697d4(0x1ea)][_0x5697d4(0x269)](_0x105ff5);}async[a97_0x353cf4(0x261)](_0x5850e1){const _0x17dc87=a97_0x353cf4,_0x10e5f4=_0x5850e1||this[_0x17dc87(0x21e)](),_0x4527cf=this[_0x17dc87(0x293)][_0x17dc87(0x2a2)];if(!_0x5850e1){const _0xdc3eb4=readCachedLLMProject(_0x4527cf);if(_0xdc3eb4&&_0xdc3eb4['name']===_0x10e5f4)try{const _0x4b8257=await this[_0x17dc87(0x1ea)][_0x17dc87(0x1c5)](_0xdc3eb4['id']);if(_0x4b8257[_0x17dc87(0x202)][_0x17dc87(0x238)]===_0x10e5f4)return _0x4b8257;}catch{}}const _0x1f82a6=await this[_0x17dc87(0x1ea)][_0x17dc87(0x269)](),_0x122f9f=_0x1f82a6[_0x17dc87(0x20e)](_0x13bd94=>_0x13bd94[_0x17dc87(0x202)][_0x17dc87(0x238)]===_0x10e5f4);if(_0x122f9f)return!_0x5850e1&&writeCachedLLMProject(_0x10e5f4,_0x122f9f['id'],_0x4527cf),_0x122f9f;const _0x5e7cb0=await this[_0x17dc87(0x1ea)][_0x17dc87(0x223)]({'name':_0x10e5f4,'description':_0x17dc87(0x1de)+getSanitizedUsername()+')'});return!_0x5850e1&&writeCachedLLMProject(_0x10e5f4,_0x5e7cb0['id'],_0x4527cf),_0x5e7cb0;}async['resolveProjectId'](_0x39c959){const _0x4754a8=a97_0x353cf4,_0x3436c1=await this[_0x4754a8(0x1ea)][_0x4754a8(0x269)](),_0xf6a725=_0x3436c1[_0x4754a8(0x1c8)](_0x5ac309=>_0x5ac309[_0x4754a8(0x202)][_0x4754a8(0x238)]===_0x39c959);if(_0xf6a725[_0x4754a8(0x26f)]===0x0)throw new SDKError(ErrorCode[_0x4754a8(0x1e3)],_0x4754a8(0x22e)+_0x39c959,undefined,{'helpText':_0x4754a8(0x20f)});if(_0xf6a725[_0x4754a8(0x26f)]>0x1)throw new SDKError(ErrorCode[_0x4754a8(0x1e1)],_0x4754a8(0x1ac)+_0x39c959+'\x27.\x20This\x20should\x20not\x20happen.');return _0xf6a725[0x0]['id'];}async['resolveProjectName'](_0xaa758){const _0x280645=a97_0x353cf4,_0x102112=await this['client'][_0x280645(0x269)](),_0x38031d=_0x102112[_0x280645(0x20e)](_0xe5c50=>_0xe5c50[_0x280645(0x202)]['name']===_0xaa758);if(_0x38031d)return{'projectId':_0x38031d['id'],'project':_0x38031d};throw new SDKError(ErrorCode[_0x280645(0x1e3)],'Project\x20not\x20found:\x20'+_0xaa758,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a97_0x353cf4(0x1fc)](_0x3592d9=a97_0x353cf4(0x1b5),_0x53bc80=0x0,_0x1dc271){const _0x3eb3af=a97_0x353cf4,_0xffd4bb=0xa;let _0x4f570b=0x0,_0x45092b;while(_0x4f570b<_0xffd4bb){try{const _0x2eca3b=await this['getOrCreateDefaultProject'](_0x45092b),_0x492080=_0x2eca3b['id'],_0x4cd0d7=[_0x3eb3af(0x1aa),_0x3eb3af(0x1be),_0x3eb3af(0x294),_0x3eb3af(0x272),'high'],_0xdf2fae=_0x53bc80===0x0?_0x3eb3af(0x1ad)+_0x3592d9:_0x3eb3af(0x1ad)+_0x3592d9+_0x3eb3af(0x27e)+_0x4cd0d7[_0x53bc80],_0xce0cc=await this[_0x3eb3af(0x1ea)][_0x3eb3af(0x1df)](_0x492080),_0x5a9e6e=_0xce0cc[_0x3eb3af(0x20e)](_0x582369=>_0x582369[_0x3eb3af(0x202)]['name']===_0xdf2fae);if(_0x5a9e6e)return _0x5a9e6e;const _0x5c754e=_0x53bc80>0x0?0x1:_0x1dc271;return await this[_0x3eb3af(0x1ea)]['createAgent']({'name':_0xdf2fae,'projectId':_0x492080,'modelType':_0x3592d9,'systemPrompt':'','temperature':_0x5c754e,'reasoningEffort':_0x53bc80>0x0?_0x53bc80:undefined});}catch(_0x5deb09){if(_0x5deb09 instanceof HTTPClientError){const _0x40ef03=_0x5deb09[_0x3eb3af(0x252)];if(_0x40ef03>=0x190&&_0x40ef03<0x1f4){if(_0x40ef03===0x191)throw new SDKError(ErrorCode[_0x3eb3af(0x241)],_0x3eb3af(0x254),_0x5deb09);else{if(_0x40ef03===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x5deb09);}throw _0x5deb09;}}if(errorContains(_0x5deb09,_0x3eb3af(0x1dd),'duplicate',_0x3eb3af(0x299))){_0x4f570b++;if(_0x4f570b>=_0xffd4bb)throw new SDKError(ErrorCode[_0x3eb3af(0x1a3)],_0x3eb3af(0x26e)+_0xffd4bb+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x5deb09);const _0x226dc2=this[_0x3eb3af(0x21e)]();_0x45092b=_0x226dc2+'_'+generateRandomHex();continue;}throw _0x5deb09;}}throw new SDKError(ErrorCode[_0x3eb3af(0x1e1)],_0x3eb3af(0x1a9));}async[a97_0x353cf4(0x1ce)](_0x47a760,_0x40777e){const _0x24e219=a97_0x353cf4,_0x520780=_0x40777e||this[_0x24e219(0x1c2)],_0x20da4c=await this['client'][_0x24e219(0x1df)](_0x520780),_0xb927d=_0x20da4c[_0x24e219(0x1c8)](_0x1d65de=>_0x1d65de[_0x24e219(0x202)]['name']===_0x47a760);if(_0xb927d[_0x24e219(0x26f)]===0x0){const _0xb9a176=_0x520780?_0x24e219(0x23e)+_0x520780:'';throw new SDKError(ErrorCode[_0x24e219(0x28e)],'Agent\x20not\x20found:\x20'+_0x47a760+_0xb9a176,undefined,{'helpText':_0x520780?_0x24e219(0x214):_0x24e219(0x248)});}if(_0xb927d[_0x24e219(0x26f)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x24e219(0x1f7)+_0x47a760+_0x24e219(0x273));return _0xb927d[0x0]['id'];}async[a97_0x353cf4(0x291)](_0x57b069){const _0x100c1d=a97_0x353cf4,_0x41b376=_0x57b069||this['currentProjectId'];return await this[_0x100c1d(0x1ea)][_0x100c1d(0x1df)](_0x41b376);}async[a97_0x353cf4(0x1a5)](_0x307ef2){const _0x1423af=a97_0x353cf4;return await this[_0x1423af(0x1ea)][_0x1423af(0x228)](_0x307ef2);}async[a97_0x353cf4(0x25c)](_0x26725a){const _0x40addd=a97_0x353cf4;return await this[_0x40addd(0x1ea)][_0x40addd(0x26a)](_0x26725a);}async[a97_0x353cf4(0x1f3)](_0x38eb5e){const _0x13af7a=a97_0x353cf4;return await this[_0x13af7a(0x1ea)]['createAgent'](_0x38eb5e);}async[a97_0x353cf4(0x263)](_0x44a130,_0x4b4761){const _0x5ba35d=a97_0x353cf4;return await this[_0x5ba35d(0x1ea)][_0x5ba35d(0x263)](_0x44a130,_0x4b4761);}async[a97_0x353cf4(0x232)](_0x2dced2){const _0x1c7fe7=a97_0x353cf4;await this[_0x1c7fe7(0x1ea)][_0x1c7fe7(0x232)](_0x2dced2);}async[a97_0x353cf4(0x251)](_0x5794e1){const _0x437df7=a97_0x353cf4;return await this[_0x437df7(0x1ea)]['startChat']({'agentId':_0x5794e1});}async*[a97_0x353cf4(0x1d9)](_0x3e7cb8,_0x5e1dbf){const _0x142918=a97_0x353cf4;let _0x478cfc=_0x5e1dbf?.[_0x142918(0x28b)];const _0x50d82f=_0x5e1dbf?.['agentId'];if(!_0x478cfc){if(!_0x50d82f)throw new Error(_0x142918(0x281));const _0x3ca012=await this['client'][_0x142918(0x251)]({'agentId':_0x50d82f});_0x478cfc=_0x3ca012['id'],yield{'type':_0x142918(0x1d1),'data':{'chatId':_0x478cfc,'agentId':_0x50d82f,'projectId':_0x3ca012['attributes']['projectId']}};}for await(const _0x297824 of this[_0x142918(0x1ea)][_0x142918(0x1ef)](_0x478cfc,_0x3e7cb8,_0x5e1dbf?.['signal'])){yield{'type':'event','data':_0x297824};}}async[a97_0x353cf4(0x1e7)](_0x5ba417=0x32){const _0x1d0e63=a97_0x353cf4;return await this[_0x1d0e63(0x1ea)]['listChats'](_0x5ba417);}async[a97_0x353cf4(0x271)](_0x3b4bdf){const _0x189190=a97_0x353cf4;return await this[_0x189190(0x1ea)]['getChatHistory'](_0x3b4bdf);}async[a97_0x353cf4(0x1d4)](_0x7aa98d){const _0x195948=a97_0x353cf4;return await this[_0x195948(0x1ea)][_0x195948(0x1d4)](_0x7aa98d);}async['chatInfo'](_0x38cd01){const _0x2a52cd=a97_0x353cf4;return await this['client'][_0x2a52cd(0x23a)](_0x38cd01);}async[a97_0x353cf4(0x260)](_0x4896c0,_0x47853e,_0x491c6c){const _0x120b46=a97_0x353cf4,_0x196559=_0x491c6c?.['dryRun']??![],{projectId:_0x5cb078,project:_0x43d1a4}=await this[_0x120b46(0x1fe)](_0x4896c0),_0x3e7225=_0x43d1a4['attributes']['name'],_0x2333fd=_0x47853e||_0x3e7225+'.llm';if(a97_0x436715['existsSync'](_0x2333fd)&&!_0x196559)throw new SDKError(ErrorCode[_0x120b46(0x1a3)],_0x120b46(0x1db)+_0x2333fd,undefined,{'helpText':_0x120b46(0x1c1)});const _0x3e7146=await this[_0x120b46(0x1ea)][_0x120b46(0x228)](_0x5cb078),_0x135f90=await this[_0x120b46(0x1ea)][_0x120b46(0x1d6)](_0x5cb078),_0x45caef=await this[_0x120b46(0x1ea)][_0x120b46(0x27c)](_0x5cb078),_0x336748=await this['client']['listIntegrations'](_0x5cb078);if(!_0x196559){a97_0x436715[_0x120b46(0x1dc)](_0x2333fd,{'recursive':!![]});const _0x4f3f29={'version':_0x120b46(0x216),'exportedAt':new Date()[_0x120b46(0x247)](),'exportedFrom':{'site':this[_0x120b46(0x293)][_0x120b46(0x1eb)],'projectId':_0x5cb078,'projectName':_0x3e7225},'project':_0x43d1a4};a97_0x436715[_0x120b46(0x225)](a97_0x71957c['join'](_0x2333fd,'project.json'),JSON['stringify'](_0x4f3f29,null,0x2)),a97_0x436715['writeFileSync'](a97_0x71957c[_0x120b46(0x1a7)](_0x2333fd,_0x120b46(0x240)),JSON[_0x120b46(0x243)](_0x3e7146,null,0x2)),a97_0x436715['writeFileSync'](a97_0x71957c[_0x120b46(0x1a7)](_0x2333fd,'knowledgebases.json'),JSON['stringify'](_0x135f90,null,0x2)),a97_0x436715['writeFileSync'](a97_0x71957c[_0x120b46(0x1a7)](_0x2333fd,_0x120b46(0x1f4)),JSON[_0x120b46(0x243)](_0x45caef,null,0x2)),a97_0x436715[_0x120b46(0x225)](a97_0x71957c['join'](_0x2333fd,'integrations.json'),JSON[_0x120b46(0x243)](_0x336748,null,0x2));}return{'projectName':_0x3e7225,'outputDir':_0x2333fd,'counts':{'agents':_0x3e7146['length'],'knowledgeBases':_0x135f90['length'],'prompts':_0x45caef[_0x120b46(0x26f)],'integrations':_0x336748[_0x120b46(0x26f)]}};}async['restoreProject'](_0x426bfb,_0x24638d){const _0x1e3bfa=a97_0x353cf4,_0x17de57=_0x24638d?.[_0x1e3bfa(0x25a)]??![],_0x30d0b8=this[_0x1e3bfa(0x1d0)](_0x426bfb),_0x58dc51=_0x30d0b8[_0x1e3bfa(0x288)][_0x1e3bfa(0x1eb)],_0xf52397=this[_0x1e3bfa(0x293)]['site'],_0x13f142=_0x58dc51!==_0xf52397?_0x58dc51:undefined,_0x137097=this[_0x1e3bfa(0x1e0)](a97_0x71957c[_0x1e3bfa(0x1a7)](_0x426bfb,_0x1e3bfa(0x240)),[]),_0x56633f=this[_0x1e3bfa(0x1e0)](a97_0x71957c[_0x1e3bfa(0x1a7)](_0x426bfb,_0x1e3bfa(0x219)),[]),_0x3a1256=this['loadJsonFile'](a97_0x71957c[_0x1e3bfa(0x1a7)](_0x426bfb,_0x1e3bfa(0x1f4)),[]),_0x4e3af1=this[_0x1e3bfa(0x1e0)](a97_0x71957c['join'](_0x426bfb,_0x1e3bfa(0x1fb)),[]),_0x1ef9ef=_0x24638d?.[_0x1e3bfa(0x238)]||_0x30d0b8[_0x1e3bfa(0x288)][_0x1e3bfa(0x1b6)];if(_0x17de57){const _0x14b7c8=new Map(),_0xcb9b8d=[..._0x137097],_0xa38aa7=_0x137097['length']+0x1;let _0x1a2110=0x0;while(_0xcb9b8d['length']>0x0&&_0x1a2110<_0xa38aa7){_0x1a2110++;const _0x3809e1=[];for(const _0x325507 of _0xcb9b8d){canCreateAgent(_0x325507,_0x14b7c8)?_0x14b7c8[_0x1e3bfa(0x1cb)](_0x325507['id'],_0x1e3bfa(0x27f)+_0x325507['id']):_0x3809e1[_0x1e3bfa(0x1c0)](_0x325507);}if(_0x3809e1['length']===_0xcb9b8d[_0x1e3bfa(0x26f)])throw new SDKError(ErrorCode[_0x1e3bfa(0x1e1)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x1e3bfa(0x266)});_0xcb9b8d[_0x1e3bfa(0x26f)]=0x0,_0xcb9b8d['push'](..._0x3809e1);}const _0xc19b60=_0x3a1256[_0x1e3bfa(0x1c8)](_0x3abb3b=>_0x14b7c8[_0x1e3bfa(0x283)](_0x3abb3b[_0x1e3bfa(0x202)][_0x1e3bfa(0x21a)]))['length'];return{'projectName':_0x1ef9ef,'projectId':_0x1e3bfa(0x1d5),'counts':{'agents':_0x137097[_0x1e3bfa(0x26f)],'knowledgeBases':_0x56633f[_0x1e3bfa(0x26f)],'prompts':_0xc19b60,'integrations':_0x4e3af1[_0x1e3bfa(0x26f)]},'sourceSite':_0x13f142};}const _0x5a40e4=await this[_0x1e3bfa(0x1ea)][_0x1e3bfa(0x223)]({'name':_0x1ef9ef,'description':_0x30d0b8[_0x1e3bfa(0x1d2)][_0x1e3bfa(0x202)][_0x1e3bfa(0x29b)]}),_0x693235=_0x5a40e4['id'],_0x3b7990=new Map(),_0x91f6ec=new Map(),_0x370edd=new Map();for(const _0x5179e8 of _0x56633f){const _0x2420a9=await this[_0x1e3bfa(0x1ea)][_0x1e3bfa(0x282)]({'projectId':_0x693235,'name':_0x5179e8[_0x1e3bfa(0x202)][_0x1e3bfa(0x238)],'tdDatabaseName':_0x5179e8['attributes'][_0x1e3bfa(0x27d)],'tables':_0x5179e8['attributes'][_0x1e3bfa(0x217)]});_0x3b7990[_0x1e3bfa(0x1cb)](_0x5179e8['id'],_0x2420a9['id']);}const _0x409f3d=[..._0x137097],_0x5a9ac5=_0x137097['length']+0x1;let _0x41108c=0x0;while(_0x409f3d['length']>0x0&&_0x41108c<_0x5a9ac5){_0x41108c++;const _0x189795=[];for(const _0xe56728 of _0x409f3d){if(canCreateAgent(_0xe56728,_0x91f6ec)){const _0x1a3088=remapToolIds(_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x199)],_0x3b7990,_0x91f6ec),_0x4e0368=remapVariableIds(_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x211)],_0x3b7990),_0x57fb76=await this[_0x1e3bfa(0x1ea)][_0x1e3bfa(0x2a4)]({'name':_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x238)],'projectId':_0x693235,'systemPrompt':_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x1e2)],'starterMessage':_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x213)],'modelType':migrateModelType(_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x19a)]),'maxToolIterations':_0xe56728['attributes']['maxToolIterations'],'temperature':_0xe56728[_0x1e3bfa(0x202)]['temperature'],'reasoningEffort':_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x205)],'outputs':_0xe56728[_0x1e3bfa(0x202)][_0x1e3bfa(0x255)],'tools':_0x1a3088,'variables':_0x4e0368});_0x91f6ec[_0x1e3bfa(0x1cb)](_0xe56728['id'],_0x57fb76['id']);}else _0x189795[_0x1e3bfa(0x1c0)](_0xe56728);}if(_0x189795[_0x1e3bfa(0x26f)]===_0x409f3d[_0x1e3bfa(0x26f)])throw new SDKError(ErrorCode[_0x1e3bfa(0x1e1)],_0x1e3bfa(0x23f),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x409f3d['length']=0x0,_0x409f3d[_0x1e3bfa(0x1c0)](..._0x189795);}for(const _0x20e0df of _0x3a1256){const _0x2ef0c1=_0x91f6ec[_0x1e3bfa(0x26c)](_0x20e0df[_0x1e3bfa(0x202)][_0x1e3bfa(0x21a)]);if(!_0x2ef0c1)continue;const _0x126de3=await this[_0x1e3bfa(0x1ea)][_0x1e3bfa(0x233)]({'projectId':_0x693235,'agentId':_0x2ef0c1,'name':_0x20e0df[_0x1e3bfa(0x202)][_0x1e3bfa(0x238)],'systemPrompt':_0x20e0df[_0x1e3bfa(0x202)][_0x1e3bfa(0x1e2)],'template':_0x20e0df[_0x1e3bfa(0x202)]['template'],'jsonSchemaHint':_0x20e0df[_0x1e3bfa(0x202)]['jsonSchemaHint']});_0x370edd[_0x1e3bfa(0x1cb)](_0x20e0df['id'],_0x126de3['id']);}for(const _0x5db9ba of _0x4e3af1){const _0x155ec0=_0x5db9ba[_0x1e3bfa(0x202)]['actions'][_0x1e3bfa(0x237)](_0x4b5736=>({..._0x4b5736,'promptId':_0x370edd[_0x1e3bfa(0x26c)](_0x4b5736[_0x1e3bfa(0x28f)])||_0x4b5736[_0x1e3bfa(0x28f)]}));await this[_0x1e3bfa(0x1ea)]['createIntegration']({'projectId':_0x693235,'serviceType':_0x5db9ba[_0x1e3bfa(0x202)]['serviceType'],'actions':_0x155ec0,'slackMessageMode':_0x5db9ba[_0x1e3bfa(0x202)][_0x1e3bfa(0x25b)],'chatIgnoreManagedActions':_0x5db9ba['attributes'][_0x1e3bfa(0x1f6)],'chatWelcomeMessage':_0x5db9ba[_0x1e3bfa(0x202)][_0x1e3bfa(0x264)],'webhookCorsOrigins':_0x5db9ba[_0x1e3bfa(0x202)]['webhookCorsOrigins']});}return{'projectName':_0x1ef9ef,'projectId':_0x693235,'counts':{'agents':_0x91f6ec['size'],'knowledgeBases':_0x3b7990[_0x1e3bfa(0x275)],'prompts':_0x370edd[_0x1e3bfa(0x275)],'integrations':_0x4e3af1[_0x1e3bfa(0x26f)]},'sourceSite':_0x13f142};}[a97_0x353cf4(0x1e0)](_0x3ab31f,_0x3a5ca5){const _0x1a1128=a97_0x353cf4;if(!a97_0x436715['existsSync'](_0x3ab31f))return _0x3a5ca5;return JSON['parse'](a97_0x436715[_0x1a1128(0x2a5)](_0x3ab31f,_0x1a1128(0x23c)));}['getBackupMetadata'](_0xcd2d4c){const _0x488693=a97_0x353cf4;if(!a97_0x436715['existsSync'](_0xcd2d4c))throw new SDKError(ErrorCode[_0x488693(0x1ba)],'Backup\x20folder\x20not\x20found:\x20'+_0xcd2d4c,undefined,{'helpText':_0x488693(0x1fd)});const _0x400773=a97_0x71957c[_0x488693(0x1a7)](_0xcd2d4c,_0x488693(0x204));if(!a97_0x436715[_0x488693(0x24b)](_0x400773))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x488693(0x1fa)+_0xcd2d4c,undefined,{'helpText':_0x488693(0x1b3)});const _0x465843=JSON[_0x488693(0x1c3)](a97_0x436715[_0x488693(0x2a5)](_0x400773,'utf-8'));if(!isSupportedBackupVersion(_0x465843[_0x488693(0x1e6)]))throw new SDKError(ErrorCode[_0x488693(0x22a)],'Unsupported\x20backup\x20version:\x20'+_0x465843[_0x488693(0x1e6)],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x465843;}async[a97_0x353cf4(0x25f)](_0x5a0cf9,_0x1d4481,_0x1062da){const _0x5575ea=a97_0x353cf4,{projectId:_0x14c223,project:_0x5094df}=await this[_0x5575ea(0x1fe)](_0x5a0cf9),_0x152f70=_0x5094df['attributes'][_0x5575ea(0x238)];let _0x3036eb;if(_0x1d4481)_0x3036eb=_0x1d4481;else{const _0x38158f=a97_0x71957c['join'](process[_0x5575ea(0x1cd)](),_0x5575ea(0x291)),_0x46e9f9=getSanitizedPathWithMigration(_0x38158f,_0x152f70);_0x46e9f9[_0x5575ea(0x197)]&&this['logger']['info'](_0x5575ea(0x253)+a97_0x71957c['basename'](_0x46e9f9['oldPath'])+'\x20→\x20'+a97_0x71957c['basename'](_0x46e9f9['path'])),_0x3036eb=_0x46e9f9[_0x5575ea(0x21d)];}const _0x3d42ca=await this[_0x5575ea(0x1ea)][_0x5575ea(0x228)](_0x14c223),_0x285529=await this[_0x5575ea(0x1ea)][_0x5575ea(0x1d6)](_0x14c223),_0x25215b=await this[_0x5575ea(0x1ea)]['listTextKnowledgeBases'](_0x14c223),_0x52910a=await this[_0x5575ea(0x1ea)][_0x5575ea(0x267)](_0x14c223),_0x251410=await this[_0x5575ea(0x1ea)][_0x5575ea(0x19d)](_0x14c223),_0x4a96ad=await this['client'][_0x5575ea(0x27c)](_0x14c223),_0x5463eb=await this['client'][_0x5575ea(0x292)](_0x14c223),_0xf8fd1b=await this[_0x5575ea(0x1ea)]['listExperimentalKnowledgeBases'](_0x14c223),_0x20a4b8=await this['client'][_0x5575ea(0x270)](_0x14c223),_0x2b0952=_0x5463eb[_0x5575ea(0x1c8)](_0x24b186=>!_0x24b186[_0x5575ea(0x202)][_0x5575ea(0x1e5)]&&SAFE_INTEGRATION_TYPES['includes'](_0x24b186[_0x5575ea(0x202)][_0x5575ea(0x21b)][_0x5575ea(0x22b)]())),_0x445828=new Map(),_0x3857d4=new Map(),_0x57769a=new Map(),_0x3ba8b9=new Map(),_0x48ef50=new Map(),_0xa1e1d4=new Map(),_0x16ad79=new Map();for(const _0x206db5 of _0x3d42ca){_0x445828[_0x5575ea(0x1cb)](_0x206db5['id'],_0x206db5['attributes'][_0x5575ea(0x238)]);}for(const _0x4d4203 of _0x285529){_0x3857d4['set'](_0x4d4203['id'],_0x4d4203[_0x5575ea(0x202)][_0x5575ea(0x238)]);}for(const _0x29a6e9 of _0x25215b){_0x57769a['set'](_0x29a6e9['id'],_0x29a6e9[_0x5575ea(0x202)][_0x5575ea(0x238)]);}for(const _0x2a99d7 of _0x52910a){_0x3ba8b9[_0x5575ea(0x1cb)](_0x2a99d7['id'],_0x2a99d7[_0x5575ea(0x202)]['name']);}for(const _0x521a09 of _0x251410){_0x48ef50['set'](_0x521a09['id'],_0x521a09[_0x5575ea(0x202)]['name']);}for(const _0x5a0ccf of _0x4a96ad){_0xa1e1d4[_0x5575ea(0x1cb)](_0x5a0ccf['id'],_0x5a0ccf[_0x5575ea(0x202)][_0x5575ea(0x238)]);}for(const _0x4877fb of _0xf8fd1b){_0x16ad79[_0x5575ea(0x1cb)](_0x4877fb['id'],_0x4877fb['attributes']['name']);}const _0x46b194={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x3857d4,'TextKnowledgeBase':_0x57769a,'Agent':_0x445828,'WebSearchTool':_0x48ef50,'ImageGenerator':_0x3ba8b9,'ExperimentalKnowledgeBase':_0x16ad79}),'resolvePromptName':async _0x4449d0=>_0xa1e1d4[_0x5575ea(0x26c)](_0x4449d0),'onWarning':_0x511302=>this[_0x5575ea(0x221)]['warn'](_0x511302)},_0x5254ad={'projectName':_0x152f70,'outputDir':_0x3036eb,'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}}},_0x125cbc=[],_0x149ab3=[];for(const _0x4c4e9 of _0x3d42ca){const _0x420694=getSanitizedPathWithMigration(_0x3036eb,_0x4c4e9[_0x5575ea(0x202)]['name']);_0x420694['renamed']&&this['logger'][_0x5575ea(0x29d)]('Renamed\x20agent\x20folder:\x20'+a97_0x71957c[_0x5575ea(0x230)](_0x420694[_0x5575ea(0x25d)])+'\x20→\x20'+a97_0x71957c['basename'](_0x420694[_0x5575ea(0x21d)]));const _0x25e6fa=_0x420694[_0x5575ea(0x21d)],_0xb447fa=a97_0x71957c[_0x5575ea(0x1a7)](_0x25e6fa,_0x5575ea(0x1da)),_0x18e40a=a97_0x71957c['join'](_0x25e6fa,_0x5575ea(0x29f)),_0x4259ee=a97_0x71957c[_0x5575ea(0x1a7)](_0x25e6fa,_0x5575ea(0x242)),{yaml:_0x17f751,systemPrompt:_0xeb9f8d,starterMessage:_0x286afe}=await agentResponseToDef(_0x4c4e9,_0x46b194),_0x338643=toAgentYamlString(_0x17f751),_0x50a949=!a97_0x436715[_0x5575ea(0x24b)](_0x18e40a);let _0x56de9e=_0x50a949,_0x2da6b3;if(!_0x50a949){const _0xc86ac4=a97_0x436715[_0x5575ea(0x24b)](_0xb447fa)?a97_0x436715[_0x5575ea(0x2a5)](_0xb447fa,_0x5575ea(0x23c)):'',_0x1cec10=a97_0x436715[_0x5575ea(0x2a5)](_0x18e40a,_0x5575ea(0x23c)),_0x500cc2='#\x20prompt.md\x0a'+_0xc86ac4+_0x5575ea(0x1ae)+_0x1cec10,_0x3b2bc7=_0x5575ea(0x1bc)+_0xeb9f8d+_0x5575ea(0x1ae)+_0x338643,_0x298ce0=generateDiff(_0x500cc2,_0x3b2bc7);_0x56de9e=hasChanges(_0x298ce0),_0x56de9e&&(_0x2da6b3=formatDiffWithColors(_0x298ce0));}_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x25e6fa,'content':'','isDir':!![]}),_0x125cbc[_0x5575ea(0x1c0)]({'path':_0xb447fa,'content':_0xeb9f8d}),_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x18e40a,'content':_0x338643});_0x286afe&&_0x286afe[_0x5575ea(0x1f1)]('\x0a')&&_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x4259ee,'content':_0x286afe});_0x5254ad[_0x5575ea(0x291)][_0x5575ea(0x1c0)]({'agentName':_0x4c4e9[_0x5575ea(0x202)]['name'],'outputPath':_0x25e6fa,'isNew':_0x50a949,'hasChanges':_0x56de9e,'diff':_0x2da6b3}),_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x291)][_0x5575ea(0x28d)]++;if(_0x50a949)_0x5254ad['counts'][_0x5575ea(0x291)]['new']++;else{if(_0x56de9e)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x291)]['updated']++;else _0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x291)]['unchanged']++;}}for(const _0xb219d7 of _0x285529){if(_0xb219d7[_0x5575ea(0x202)]['isManaged'])continue;const _0xf1f158=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x3036eb),_0xb219d7[_0x5575ea(0x202)]['name'],_0x5575ea(0x209));_0xf1f158[_0x5575ea(0x197)]&&this[_0x5575ea(0x221)]['info'](_0x5575ea(0x290)+a97_0x71957c[_0x5575ea(0x230)](_0xf1f158['oldPath'])+_0x5575ea(0x289)+a97_0x71957c['basename'](_0xf1f158[_0x5575ea(0x21d)]));const _0x5b6b8b=_0xf1f158['path'],_0x44918f=apiKnowledgeBaseToYaml(_0xb219d7),_0x10a47b=toKnowledgeBaseYamlString(_0x44918f),_0x58dac0=!a97_0x436715[_0x5575ea(0x24b)](_0x5b6b8b);let _0x466ad2=_0x58dac0,_0x47c683;if(!_0x58dac0){const _0x2e2189=a97_0x436715['readFileSync'](_0x5b6b8b,_0x5575ea(0x23c)),_0x27b779=generateDiff(_0x2e2189,_0x10a47b);_0x466ad2=hasChanges(_0x27b779),_0x466ad2&&(_0x47c683=formatDiffWithColors(_0x27b779));}_0x125cbc['push']({'path':_0x5b6b8b,'content':_0x10a47b}),_0x5254ad['knowledgeBases']['push']({'name':_0xb219d7[_0x5575ea(0x202)][_0x5575ea(0x238)],'outputPath':_0x5b6b8b,'isNew':_0x58dac0,'hasChanges':_0x466ad2,'diff':_0x47c683}),_0x5254ad['counts']['knowledgeBases'][_0x5575ea(0x28d)]++;if(_0x58dac0)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x28c)]['new']++;else{if(_0x466ad2)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x28c)][_0x5575ea(0x1e8)]++;else _0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x28c)][_0x5575ea(0x1d8)]++;}}for(const _0x328859 of _0x25215b){if(_0x328859[_0x5575ea(0x202)][_0x5575ea(0x1e5)])continue;const _0x5b4de8=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x3036eb),_0x328859[_0x5575ea(0x202)]['name'],'.md');_0x5b4de8[_0x5575ea(0x197)]&&this[_0x5575ea(0x221)][_0x5575ea(0x29d)](_0x5575ea(0x195)+a97_0x71957c[_0x5575ea(0x230)](_0x5b4de8[_0x5575ea(0x25d)])+'\x20→\x20'+a97_0x71957c[_0x5575ea(0x230)](_0x5b4de8[_0x5575ea(0x21d)]));const _0x5559fd=_0x5b4de8[_0x5575ea(0x21d)],_0x343890=toTextKnowledgeBaseMd(_0x328859[_0x5575ea(0x202)][_0x5575ea(0x238)],_0x328859[_0x5575ea(0x202)][_0x5575ea(0x1cf)]),_0x40e6ec=!a97_0x436715[_0x5575ea(0x24b)](_0x5559fd);let _0x17c236=_0x40e6ec,_0x5eb09b;if(!_0x40e6ec){const _0x5849da=a97_0x436715['readFileSync'](_0x5559fd,'utf-8'),_0x5b5db1=generateDiff(_0x5849da,_0x343890);_0x17c236=hasChanges(_0x5b5db1),_0x17c236&&(_0x5eb09b=formatDiffWithColors(_0x5b5db1));}_0x125cbc['push']({'path':_0x5559fd,'content':_0x343890}),_0x5254ad[_0x5575ea(0x218)][_0x5575ea(0x1c0)]({'name':_0x328859[_0x5575ea(0x202)][_0x5575ea(0x238)],'outputPath':_0x5559fd,'isNew':_0x40e6ec,'hasChanges':_0x17c236,'diff':_0x5eb09b}),_0x5254ad[_0x5575ea(0x258)]['textKnowledgeBases'][_0x5575ea(0x28d)]++;if(_0x40e6ec)_0x5254ad[_0x5575ea(0x258)]['textKnowledgeBases'][_0x5575ea(0x287)]++;else{if(_0x17c236)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x218)]['updated']++;else _0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x218)][_0x5575ea(0x1d8)]++;}}for(const _0x25cfd3 of _0x4a96ad){if(_0x25cfd3[_0x5575ea(0x202)][_0x5575ea(0x1e5)])continue;const _0x15b735=getSanitizedPathWithMigration(getPromptsDir(_0x3036eb),_0x25cfd3[_0x5575ea(0x202)]['name'],_0x5575ea(0x209));_0x15b735[_0x5575ea(0x197)]&&this[_0x5575ea(0x221)][_0x5575ea(0x29d)](_0x5575ea(0x236)+a97_0x71957c[_0x5575ea(0x230)](_0x15b735[_0x5575ea(0x25d)])+_0x5575ea(0x289)+a97_0x71957c[_0x5575ea(0x230)](_0x15b735[_0x5575ea(0x21d)]));const _0x63d508=_0x15b735[_0x5575ea(0x21d)],_0x3e2392=await apiPromptToYaml(_0x25cfd3,_0x46b194);if(!_0x3e2392)continue;const _0x3102d1=toPromptYamlString(_0x3e2392),_0x437ae2=!a97_0x436715[_0x5575ea(0x24b)](_0x63d508);let _0xbaa2b5=_0x437ae2,_0x109a35;if(!_0x437ae2){const _0x1debae=a97_0x436715[_0x5575ea(0x2a5)](_0x63d508,_0x5575ea(0x23c)),_0xd8d8fb=generateDiff(_0x1debae,_0x3102d1);_0xbaa2b5=hasChanges(_0xd8d8fb),_0xbaa2b5&&(_0x109a35=formatDiffWithColors(_0xd8d8fb));}_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x63d508,'content':_0x3102d1}),_0x5254ad['prompts'][_0x5575ea(0x1c0)]({'name':_0x25cfd3[_0x5575ea(0x202)][_0x5575ea(0x238)],'outputPath':_0x63d508,'isNew':_0x437ae2,'hasChanges':_0xbaa2b5,'diff':_0x109a35}),_0x5254ad[_0x5575ea(0x258)]['prompts'][_0x5575ea(0x28d)]++;if(_0x437ae2)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x296)]['new']++;else{if(_0xbaa2b5)_0x5254ad[_0x5575ea(0x258)]['prompts'][_0x5575ea(0x1e8)]++;else _0x5254ad['counts'][_0x5575ea(0x296)]['unchanged']++;}}for(const _0x287d8b of _0x2b0952){const _0x445e32=_0x287d8b[_0x5575ea(0x202)][_0x5575ea(0x21b)][_0x5575ea(0x22b)](),_0x24f9c8=getSanitizedPathWithMigration(getIntegrationsDir(_0x3036eb),_0x445e32,_0x5575ea(0x209));_0x24f9c8[_0x5575ea(0x197)]&&this[_0x5575ea(0x221)]['info'](_0x5575ea(0x1d7)+a97_0x71957c[_0x5575ea(0x230)](_0x24f9c8[_0x5575ea(0x25d)])+'\x20→\x20'+a97_0x71957c['basename'](_0x24f9c8[_0x5575ea(0x21d)]));const _0x559d75=_0x24f9c8[_0x5575ea(0x21d)],_0x406f8c=await apiIntegrationToYaml(_0x287d8b,_0x46b194),_0xcad6c8=toIntegrationYamlString(_0x406f8c),_0x5eec7f=!a97_0x436715[_0x5575ea(0x24b)](_0x559d75);let _0x5199ac=_0x5eec7f,_0x170a36;if(!_0x5eec7f){const _0x4fe767=a97_0x436715[_0x5575ea(0x2a5)](_0x559d75,'utf-8'),_0x462b1f=generateDiff(_0x4fe767,_0xcad6c8);_0x5199ac=hasChanges(_0x462b1f),_0x5199ac&&(_0x170a36=formatDiffWithColors(_0x462b1f));}_0x125cbc['push']({'path':_0x559d75,'content':_0xcad6c8}),_0x5254ad[_0x5575ea(0x27a)][_0x5575ea(0x1c0)]({'name':_0x445e32,'outputPath':_0x559d75,'isNew':_0x5eec7f,'hasChanges':_0x5199ac,'diff':_0x170a36}),_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x27a)][_0x5575ea(0x28d)]++;if(_0x5eec7f)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x27a)][_0x5575ea(0x287)]++;else{if(_0x5199ac)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x27a)][_0x5575ea(0x1e8)]++;else _0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x27a)]['unchanged']++;}}for(const _0x75e8c6 of _0xf8fd1b){if(_0x75e8c6[_0x5575ea(0x202)][_0x5575ea(0x1e5)])continue;const _0x32cd70=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x3036eb),_0x75e8c6['attributes'][_0x5575ea(0x238)]);_0x32cd70['renamed']&&this[_0x5575ea(0x221)][_0x5575ea(0x29d)](_0x5575ea(0x1c7)+a97_0x71957c['basename'](_0x32cd70[_0x5575ea(0x25d)])+_0x5575ea(0x289)+a97_0x71957c[_0x5575ea(0x230)](_0x32cd70[_0x5575ea(0x21d)]));const _0xbb2df8=_0x32cd70[_0x5575ea(0x21d)],_0x409522=a97_0x71957c[_0x5575ea(0x1a7)](_0xbb2df8,sanitizeForFilesystem(_0x75e8c6[_0x5575ea(0x202)][_0x5575ea(0x238)])+_0x5575ea(0x209)),_0x4b223e=a97_0x71957c['join'](_0xbb2df8,_0x5575ea(0x2a7)),_0x119b7c=apiExperimentalKnowledgeBaseToYaml(_0x75e8c6),_0x59bcb2=toExperimentalKnowledgeBaseYamlString(_0x119b7c),_0x153da3=!a97_0x436715[_0x5575ea(0x24b)](_0xbb2df8);let _0x30af6c=_0x153da3,_0x65eb7b,_0x2f0074=_0x59bcb2;const _0x2941db=[..._0x119b7c[_0x5575ea(0x2a7)]][_0x5575ea(0x245)]((_0x2d716b,_0x39cc3a)=>_0x2d716b[_0x5575ea(0x238)][_0x5575ea(0x19b)](_0x39cc3a['name']));for(const _0x5b69d9 of _0x2941db){_0x2f0074+=_0x5575ea(0x1a1)+_0x5b69d9['name']+_0x5575ea(0x235)+_0x5b69d9[_0x5575ea(0x1f8)]+_0x5575ea(0x1a8)+_0x5b69d9[_0x5575ea(0x238)]+_0x5575ea(0x235)+_0x5b69d9['json_schema']+'\x0a';}if(!_0x153da3){let _0x419c05='';a97_0x436715['existsSync'](_0x409522)&&(_0x419c05=a97_0x436715['readFileSync'](_0x409522,_0x5575ea(0x23c)));if(a97_0x436715[_0x5575ea(0x24b)](_0x4b223e)){const _0x2c6b01=a97_0x436715[_0x5575ea(0x1c6)](_0x4b223e,{'withFileTypes':!![]}),_0x3ce8ea=_0x2c6b01[_0x5575ea(0x1c8)](_0x3ed0de=>_0x3ed0de[_0x5575ea(0x1ab)]())[_0x5575ea(0x245)]((_0x5572ce,_0x4994e5)=>_0x5572ce[_0x5575ea(0x238)]['localeCompare'](_0x4994e5[_0x5575ea(0x238)]));for(const _0x319718 of _0x3ce8ea){const _0x3c2b2=a97_0x71957c['join'](_0x4b223e,_0x319718[_0x5575ea(0x238)],_0x5575ea(0x19e)),_0x3160b9=a97_0x71957c[_0x5575ea(0x1a7)](_0x4b223e,_0x319718['name'],_0x5575ea(0x1b1));a97_0x436715['existsSync'](_0x3c2b2)&&(_0x419c05+=_0x5575ea(0x1a1)+_0x319718[_0x5575ea(0x238)]+_0x5575ea(0x235)+a97_0x436715['readFileSync'](_0x3c2b2,_0x5575ea(0x23c))+'\x0a'),a97_0x436715[_0x5575ea(0x24b)](_0x3160b9)&&(_0x419c05+='---\x20schema:\x20'+_0x319718[_0x5575ea(0x238)]+'\x20---\x0a'+a97_0x436715[_0x5575ea(0x2a5)](_0x3160b9,'utf-8')+'\x0a');}}const _0x4ee74b=generateDiff(_0x419c05,_0x2f0074);_0x30af6c=hasChanges(_0x4ee74b),_0x30af6c&&(_0x65eb7b=formatDiffWithColors(_0x4ee74b));}_0x125cbc[_0x5575ea(0x1c0)]({'path':_0xbb2df8,'content':'','isDir':!![]}),_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x409522,'content':_0x59bcb2}),_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x4b223e,'content':'','isDir':!![]});for(const _0x178f1b of _0x119b7c[_0x5575ea(0x2a7)]){const _0x199bc8=a97_0x71957c[_0x5575ea(0x1a7)](_0x4b223e,sanitizeForFilesystem(_0x178f1b['name'])),_0x1812d6=a97_0x71957c[_0x5575ea(0x1a7)](_0x199bc8,_0x5575ea(0x19e)),_0x1cfb87=a97_0x71957c[_0x5575ea(0x1a7)](_0x199bc8,'json_schema.json');_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x199bc8,'content':'','isDir':!![]}),_0x125cbc['push']({'path':_0x1812d6,'content':_0x178f1b[_0x5575ea(0x1f8)]}),_0x125cbc['push']({'path':_0x1cfb87,'content':_0x178f1b[_0x5575ea(0x24d)]});}if(a97_0x436715[_0x5575ea(0x24b)](_0x4b223e)){const _0x3fa2ce=a97_0x436715[_0x5575ea(0x1c6)](_0x4b223e,{'withFileTypes':!![]}),_0x1de2b4=new Set(_0x119b7c[_0x5575ea(0x2a7)][_0x5575ea(0x237)](_0x29c9f1=>sanitizeForFilesystem(_0x29c9f1['name'])));for(const _0x400aff of _0x3fa2ce){if(_0x400aff['isDirectory']()&&!_0x1de2b4[_0x5575ea(0x283)](_0x400aff[_0x5575ea(0x238)])){const _0x4752cb=a97_0x71957c[_0x5575ea(0x1a7)](_0x4b223e,_0x400aff['name']);_0x149ab3['push']({'path':_0x4752cb,'isDir':!![]});}}}_0x5254ad[_0x5575ea(0x19f)]['push']({'name':_0x75e8c6[_0x5575ea(0x202)][_0x5575ea(0x238)],'outputPath':_0xbb2df8,'isNew':_0x153da3,'hasChanges':_0x30af6c,'diff':_0x65eb7b}),_0x5254ad['counts'][_0x5575ea(0x19f)][_0x5575ea(0x28d)]++;if(_0x153da3)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x19f)][_0x5575ea(0x287)]++;else{if(_0x30af6c)_0x5254ad['counts'][_0x5575ea(0x19f)][_0x5575ea(0x1e8)]++;else _0x5254ad['counts'][_0x5575ea(0x19f)][_0x5575ea(0x1d8)]++;}}for(const _0x533fb6 of _0x20a4b8){if(_0x533fb6[_0x5575ea(0x202)][_0x5575ea(0x1e5)])continue;const _0x264a21=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x3036eb),_0x533fb6[_0x5575ea(0x202)][_0x5575ea(0x238)]);_0x264a21[_0x5575ea(0x197)]&&this[_0x5575ea(0x221)]['info'](_0x5575ea(0x1b9)+a97_0x71957c[_0x5575ea(0x230)](_0x264a21[_0x5575ea(0x25d)])+'\x20→\x20'+a97_0x71957c[_0x5575ea(0x230)](_0x264a21[_0x5575ea(0x21d)]));const _0x4a31a9=_0x264a21['path'],_0x2aba1a=a97_0x71957c[_0x5575ea(0x1a7)](_0x4a31a9,sanitizeForFilesystem(_0x533fb6[_0x5575ea(0x202)][_0x5575ea(0x238)])+_0x5575ea(0x209)),_0x1e7fed=a97_0x71957c[_0x5575ea(0x1a7)](_0x4a31a9,_0x5575ea(0x19e)),_0x184b3f=a97_0x71957c[_0x5575ea(0x1a7)](_0x4a31a9,_0x5575ea(0x1f9)),_0x332078=apiExperimentalArtifactToYaml(_0x533fb6),_0x276d7e=toExperimentalArtifactYamlString(_0x332078),_0x3c3b1b=!a97_0x436715[_0x5575ea(0x24b)](_0x4a31a9);let _0x55728d=_0x3c3b1b,_0x1499f7,_0x26e145=_0x276d7e+(_0x5575ea(0x2a3)+_0x332078[_0x5575ea(0x1f8)]+'\x0a');const _0x3c3271=[..._0x332078[_0x5575ea(0x1f9)]][_0x5575ea(0x245)]((_0x4c0e24,_0x435335)=>_0x4c0e24[_0x5575ea(0x24c)][_0x5575ea(0x19b)](_0x435335[_0x5575ea(0x24c)]));for(const _0x14f0d8 of _0x3c3271){_0x26e145+=_0x5575ea(0x279)+_0x14f0d8[_0x5575ea(0x24c)]+_0x5575ea(0x235)+_0x14f0d8[_0x5575ea(0x22f)]+'\x0a';}if(!_0x3c3b1b){let _0x4edbbf='';a97_0x436715[_0x5575ea(0x24b)](_0x2aba1a)&&(_0x4edbbf=a97_0x436715['readFileSync'](_0x2aba1a,_0x5575ea(0x23c)));a97_0x436715[_0x5575ea(0x24b)](_0x1e7fed)&&(_0x4edbbf+=_0x5575ea(0x2a3)+a97_0x436715[_0x5575ea(0x2a5)](_0x1e7fed,_0x5575ea(0x23c))+'\x0a');if(a97_0x436715[_0x5575ea(0x24b)](_0x184b3f)){const _0x32fa8d=a97_0x436715[_0x5575ea(0x1c6)](_0x184b3f),_0x91a761=_0x32fa8d[_0x5575ea(0x1c8)](_0x409faa=>{const _0x4ee163=_0x5575ea,_0x3215b1=a97_0x71957c['join'](_0x184b3f,_0x409faa);return a97_0x436715[_0x4ee163(0x2a1)](_0x3215b1)[_0x4ee163(0x29e)]();})[_0x5575ea(0x245)]((_0x48bdba,_0x5a1b39)=>_0x48bdba[_0x5575ea(0x19b)](_0x5a1b39));for(const _0x1f410d of _0x91a761){const _0x588be1=a97_0x71957c['join'](_0x184b3f,_0x1f410d);_0x4edbbf+=_0x5575ea(0x279)+_0x1f410d+'\x20---\x0a'+a97_0x436715[_0x5575ea(0x2a5)](_0x588be1,_0x5575ea(0x23c))+'\x0a';}}const _0x246860=generateDiff(_0x4edbbf,_0x26e145);_0x55728d=hasChanges(_0x246860),_0x55728d&&(_0x1499f7=formatDiffWithColors(_0x246860));}_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x4a31a9,'content':'','isDir':!![]}),_0x125cbc['push']({'path':_0x2aba1a,'content':_0x276d7e}),_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x1e7fed,'content':_0x332078[_0x5575ea(0x1f8)]});if(_0x332078[_0x5575ea(0x1f9)][_0x5575ea(0x26f)]>0x0){_0x125cbc[_0x5575ea(0x1c0)]({'path':_0x184b3f,'content':'','isDir':!![]});for(const _0x3de399 of _0x332078['files']){const _0x201787=a97_0x71957c[_0x5575ea(0x1a7)](_0x184b3f,_0x3de399[_0x5575ea(0x24c)]);_0x125cbc['push']({'path':_0x201787,'content':_0x3de399['text_content']});}}if(a97_0x436715[_0x5575ea(0x24b)](_0x184b3f)){const _0x273da8=a97_0x436715[_0x5575ea(0x1c6)](_0x184b3f),_0x1c54b7=new Set(_0x332078[_0x5575ea(0x1f9)]['map'](_0x240dbe=>_0x240dbe[_0x5575ea(0x24c)]));for(const _0x35cc8a of _0x273da8){const _0x5f3d4d=a97_0x71957c[_0x5575ea(0x1a7)](_0x184b3f,_0x35cc8a);a97_0x436715[_0x5575ea(0x2a1)](_0x5f3d4d)[_0x5575ea(0x29e)]()&&!_0x1c54b7[_0x5575ea(0x283)](_0x35cc8a)&&_0x149ab3['push']({'path':_0x5f3d4d});}}_0x5254ad[_0x5575ea(0x29c)][_0x5575ea(0x1c0)]({'name':_0x533fb6[_0x5575ea(0x202)][_0x5575ea(0x238)],'outputPath':_0x4a31a9,'isNew':_0x3c3b1b,'hasChanges':_0x55728d,'diff':_0x1499f7}),_0x5254ad['counts'][_0x5575ea(0x29c)]['total']++;if(_0x3c3b1b)_0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x29c)]['new']++;else{if(_0x55728d)_0x5254ad[_0x5575ea(0x258)]['experimentalArtifacts']['updated']++;else _0x5254ad[_0x5575ea(0x258)][_0x5575ea(0x29c)][_0x5575ea(0x1d8)]++;}}if(_0x1062da?.[_0x5575ea(0x25a)])return _0x5254ad;a97_0x436715[_0x5575ea(0x1dc)](_0x3036eb,{'recursive':!![]}),a97_0x436715[_0x5575ea(0x1dc)](getKnowledgeBasesDir(_0x3036eb),{'recursive':!![]}),a97_0x436715[_0x5575ea(0x1dc)](getPromptsDir(_0x3036eb),{'recursive':!![]}),a97_0x436715[_0x5575ea(0x1dc)](getIntegrationsDir(_0x3036eb),{'recursive':!![]}),a97_0x436715[_0x5575ea(0x1dc)](getExperimentalKnowledgeBasesDir(_0x3036eb),{'recursive':!![]}),a97_0x436715[_0x5575ea(0x1dc)](getExperimentalArtifactsDir(_0x3036eb),{'recursive':!![]});const _0x43fb7a=a97_0x71957c[_0x5575ea(0x1a7)](_0x3036eb,'tdx.json');a97_0x436715['writeFileSync'](_0x43fb7a,createAgentConfigContent(_0x152f70));for(const _0x24da4d of _0x125cbc){if(_0x24da4d[_0x5575ea(0x22c)])a97_0x436715['mkdirSync'](_0x24da4d[_0x5575ea(0x21d)],{'recursive':!![]});else{const _0x226011=a97_0x71957c['dirname'](_0x24da4d[_0x5575ea(0x21d)]);!a97_0x436715[_0x5575ea(0x24b)](_0x226011)&&a97_0x436715[_0x5575ea(0x1dc)](_0x226011,{'recursive':!![]}),a97_0x436715[_0x5575ea(0x225)](_0x24da4d['path'],_0x24da4d['content']);}}for(const _0xb063ec of _0x149ab3){_0xb063ec[_0x5575ea(0x22c)]?(a97_0x436715[_0x5575ea(0x203)](_0xb063ec[_0x5575ea(0x21d)],{'recursive':!![],'force':!![]}),this['logger'][_0x5575ea(0x29d)](_0x5575ea(0x208)+a97_0x71957c['basename'](a97_0x71957c[_0x5575ea(0x1b7)](_0xb063ec['path']))+'/'+a97_0x71957c[_0x5575ea(0x230)](_0xb063ec[_0x5575ea(0x21d)]))):(a97_0x436715[_0x5575ea(0x203)](_0xb063ec[_0x5575ea(0x21d)],{'force':!![]}),this['logger']['info'](_0x5575ea(0x21c)+a97_0x71957c[_0x5575ea(0x230)](a97_0x71957c[_0x5575ea(0x1b7)](_0xb063ec[_0x5575ea(0x21d)]))+'/'+a97_0x71957c[_0x5575ea(0x230)](_0xb063ec[_0x5575ea(0x21d)])));}return _0x5254ad;}async[a97_0x353cf4(0x194)](_0x201530,_0xe7bb02){const _0x413d07=a97_0x353cf4,_0x5d5c3b=a97_0x71957c[_0x413d07(0x1a7)](_0x201530,_0x413d07(0x1b2));if(!a97_0x436715[_0x413d07(0x24b)](_0x5d5c3b))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20tdx.json\x20found\x20in\x20'+_0x201530,undefined,{'helpText':_0x413d07(0x1b4)});const _0x45965f=loadAgentConfig(_0x5d5c3b),_0x406baf=await this[_0x413d07(0x1a2)](_0x45965f[_0x413d07(0x1b0)]),_0x405857=await this[_0x413d07(0x1ea)]['getProject'](_0x406baf),_0xd18285=_0x405857[_0x413d07(0x202)][_0x413d07(0x238)],_0x27594f={'projectName':_0xd18285,'projectId':_0x406baf,'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}}},_0x263c23=[],_0xd0c1d2=[],_0xbc0bc8=[],_0xf38623=[],_0x4031ce=[],_0xa7e620=[],_0x2ffa85=a97_0x436715[_0x413d07(0x1c6)](_0x201530,{'withFileTypes':!![]});for(const _0x5c734e of _0x2ffa85){if(!_0x5c734e[_0x413d07(0x1ab)]())continue;if([_0x413d07(0x1d3),'prompts',_0x413d07(0x27a),_0x413d07(0x1f0),_0x413d07(0x1a6)][_0x413d07(0x1f1)](_0x5c734e[_0x413d07(0x238)]))continue;const _0xb11647=a97_0x71957c['join'](_0x201530,_0x5c734e[_0x413d07(0x238)]);if(isAgentDir(_0xb11647)){const _0x4e74e5=a97_0x71957c[_0x413d07(0x1a7)](_0xb11647,_0x413d07(0x29f)),_0x3ef291=a97_0x71957c['join'](_0xb11647,_0x413d07(0x1da)),_0xf17d8c=a97_0x71957c[_0x413d07(0x1a7)](_0xb11647,_0x413d07(0x242)),_0x43fc3b=parseAgentYaml(a97_0x436715['readFileSync'](_0x4e74e5,_0x413d07(0x23c)),_0x4e74e5),_0x22332d=a97_0x436715[_0x413d07(0x24b)](_0x3ef291)?a97_0x436715[_0x413d07(0x2a5)](_0x3ef291,_0x413d07(0x23c)):'',_0x107ca2=a97_0x436715['existsSync'](_0xf17d8c)?a97_0x436715[_0x413d07(0x2a5)](_0xf17d8c,_0x413d07(0x23c)):_0x43fc3b[_0x413d07(0x20b)];_0x263c23[_0x413d07(0x1c0)]({'name':_0x43fc3b[_0x413d07(0x238)],'dir':_0xb11647,'yaml':_0x43fc3b,'systemPrompt':_0x22332d,'starterMessage':_0x107ca2});}}const _0x23519a=getKnowledgeBasesDir(_0x201530);if(a97_0x436715[_0x413d07(0x24b)](_0x23519a)){const _0x1adf78=a97_0x436715['readdirSync'](_0x23519a);for(const _0x5593e8 of _0x1adf78){const _0x2e34f0=a97_0x71957c[_0x413d07(0x1a7)](_0x23519a,_0x5593e8);if(_0x5593e8[_0x413d07(0x295)](_0x413d07(0x209))){const _0x5c0f72=parseKnowledgeBaseYaml(a97_0x436715[_0x413d07(0x2a5)](_0x2e34f0,_0x413d07(0x23c)),_0x2e34f0);_0xd0c1d2['push']({'name':_0x5c0f72[_0x413d07(0x238)],'path':_0x2e34f0,'yaml':_0x5c0f72});}else{if(_0x5593e8['endsWith'](_0x413d07(0x29a))){const _0x5f00d8=a97_0x436715[_0x413d07(0x2a5)](_0x2e34f0,'utf-8'),{name:_0x39391f,text:_0x19e6a6}=parseTextKnowledgeBaseMd(_0x5f00d8,_0x5593e8);_0xbc0bc8[_0x413d07(0x1c0)]({'name':_0x39391f,'path':_0x2e34f0,'text':_0x19e6a6});}}}}const _0x4237ce=getPromptsDir(_0x201530);if(a97_0x436715['existsSync'](_0x4237ce)){const _0x223367=a97_0x436715[_0x413d07(0x1c6)](_0x4237ce)['filter'](_0x5dbfdf=>_0x5dbfdf[_0x413d07(0x295)]('.yml'));for(const _0xb57d34 of _0x223367){const _0x11a421=a97_0x71957c[_0x413d07(0x1a7)](_0x4237ce,_0xb57d34),_0x4bbef9=parsePromptYaml(a97_0x436715[_0x413d07(0x2a5)](_0x11a421,'utf-8'),_0x11a421);_0xf38623[_0x413d07(0x1c0)]({'name':_0x4bbef9['name'],'path':_0x11a421,'yaml':_0x4bbef9});}}const _0x52b7e1=[],_0x72d76c=getIntegrationsDir(_0x201530);if(a97_0x436715[_0x413d07(0x24b)](_0x72d76c)){const _0x23b864=a97_0x436715[_0x413d07(0x1c6)](_0x72d76c)[_0x413d07(0x1c8)](_0x59c50d=>_0x59c50d[_0x413d07(0x295)](_0x413d07(0x209)));for(const _0x4297a1 of _0x23b864){const _0x14be3a=a97_0x71957c[_0x413d07(0x1a7)](_0x72d76c,_0x4297a1),_0x5a22c9=parseIntegrationYaml(a97_0x436715[_0x413d07(0x2a5)](_0x14be3a,_0x413d07(0x23c)),_0x14be3a);if(!SAFE_INTEGRATION_TYPES[_0x413d07(0x1f1)](_0x5a22c9[_0x413d07(0x246)][_0x413d07(0x22b)]())){this[_0x413d07(0x221)]['warn'](_0x413d07(0x259)+_0x5a22c9['name']+_0x413d07(0x1bb)+_0x5a22c9['service_type']+_0x413d07(0x26d)+(_0x413d07(0x284)+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x413d07(0x20a));continue;}_0x52b7e1['push']({'name':_0x5a22c9[_0x413d07(0x238)],'path':_0x14be3a,'yaml':_0x5a22c9});}}const _0x3b4a08=getExperimentalKnowledgeBasesDir(_0x201530);if(a97_0x436715['existsSync'](_0x3b4a08)){const _0x2c148b=a97_0x436715[_0x413d07(0x1c6)](_0x3b4a08,{'withFileTypes':!![]});for(const _0x44a8b8 of _0x2c148b){if(!_0x44a8b8[_0x413d07(0x1ab)]())continue;const _0x1b2789=a97_0x71957c[_0x413d07(0x1a7)](_0x3b4a08,_0x44a8b8[_0x413d07(0x238)]),_0x15a86d=a97_0x71957c[_0x413d07(0x1a7)](_0x1b2789,_0x44a8b8[_0x413d07(0x238)]+_0x413d07(0x209)),_0x5ae344=a97_0x71957c[_0x413d07(0x1a7)](_0x1b2789,_0x413d07(0x2a7));if(!a97_0x436715[_0x413d07(0x24b)](_0x15a86d))continue;const _0x4242ce=parseExperimentalKnowledgeBaseYaml(a97_0x436715[_0x413d07(0x2a5)](_0x15a86d,'utf-8'),_0x15a86d),_0x3594a4=[];if(a97_0x436715[_0x413d07(0x24b)](_0x5ae344)){const _0x37a30c=a97_0x436715[_0x413d07(0x1c6)](_0x5ae344,{'withFileTypes':!![]});for(const _0xde1be0 of _0x37a30c){if(!_0xde1be0[_0x413d07(0x1ab)]())continue;const _0x141174=a97_0x71957c['join'](_0x5ae344,_0xde1be0[_0x413d07(0x238)]),_0x2bed50=a97_0x71957c[_0x413d07(0x1a7)](_0x141174,'code.js'),_0x54d2cb=a97_0x71957c[_0x413d07(0x1a7)](_0x141174,_0x413d07(0x1b1));a97_0x436715[_0x413d07(0x24b)](_0x2bed50)&&a97_0x436715[_0x413d07(0x24b)](_0x54d2cb)&&_0x3594a4[_0x413d07(0x1c0)]({'name':_0xde1be0[_0x413d07(0x238)],'code':a97_0x436715['readFileSync'](_0x2bed50,'utf-8'),'json_schema':a97_0x436715[_0x413d07(0x2a5)](_0x54d2cb,'utf-8')});}}const _0x182293={..._0x4242ce,'variables':_0x4242ce[_0x413d07(0x211)]||[],'functions':_0x3594a4};_0x4031ce[_0x413d07(0x1c0)]({'name':_0x4242ce[_0x413d07(0x238)],'dir':_0x1b2789,'def':_0x182293});}}const _0x4d5695=getExperimentalArtifactsDir(_0x201530);if(a97_0x436715[_0x413d07(0x24b)](_0x4d5695)){const _0x1d9617=a97_0x436715['readdirSync'](_0x4d5695,{'withFileTypes':!![]});for(const _0x7ff744 of _0x1d9617){if(!_0x7ff744[_0x413d07(0x1ab)]())continue;const _0x17bde2=a97_0x71957c[_0x413d07(0x1a7)](_0x4d5695,_0x7ff744['name']),_0x2a71a0=a97_0x71957c[_0x413d07(0x1a7)](_0x17bde2,_0x7ff744[_0x413d07(0x238)]+_0x413d07(0x209)),_0x2bbae8=a97_0x71957c[_0x413d07(0x1a7)](_0x17bde2,_0x413d07(0x19e)),_0x2bd37d=a97_0x71957c[_0x413d07(0x1a7)](_0x17bde2,_0x413d07(0x1f9));if(!a97_0x436715[_0x413d07(0x24b)](_0x2a71a0)||!a97_0x436715[_0x413d07(0x24b)](_0x2bbae8))continue;const _0x16f5e9=parseExperimentalArtifactYaml(a97_0x436715[_0x413d07(0x2a5)](_0x2a71a0,_0x413d07(0x23c)),_0x2a71a0),_0xaddc31=a97_0x436715[_0x413d07(0x2a5)](_0x2bbae8,_0x413d07(0x23c)),_0x175f36=[];if(a97_0x436715[_0x413d07(0x24b)](_0x2bd37d)){const _0x28327b=a97_0x436715[_0x413d07(0x1c6)](_0x2bd37d);for(const _0x525a9c of _0x28327b){const _0x39b3d4=a97_0x71957c[_0x413d07(0x1a7)](_0x2bd37d,_0x525a9c);a97_0x436715[_0x413d07(0x2a1)](_0x39b3d4)[_0x413d07(0x29e)]()&&_0x175f36['push']({'file_name':_0x525a9c,'text_content':a97_0x436715[_0x413d07(0x2a5)](_0x39b3d4,_0x413d07(0x23c))});}}const _0x1253d1={..._0x16f5e9,'code':_0xaddc31,'files':_0x175f36};_0xa7e620['push']({'name':_0x16f5e9['name'],'dir':_0x17bde2,'def':_0x1253d1});}}const _0x198a05=await this[_0x413d07(0x1ea)][_0x413d07(0x228)](_0x406baf),_0x4671eb=await this[_0x413d07(0x1ea)][_0x413d07(0x1d6)](_0x406baf),_0x114aa8=await this['client']['listTextKnowledgeBases'](_0x406baf),_0x5c5316=await this[_0x413d07(0x1ea)][_0x413d07(0x27c)](_0x406baf),_0x505271=await this['client'][_0x413d07(0x292)](_0x406baf),_0x29d785=await this[_0x413d07(0x1ea)][_0x413d07(0x277)](_0x406baf),_0x427f45=await this[_0x413d07(0x1ea)][_0x413d07(0x270)](_0x406baf),_0x52a43d=await fetchAllToolTargetMaps((_0x1f9e17,_0x50ae0e)=>this[_0x413d07(0x1ea)][_0x413d07(0x297)](_0x1f9e17,_0x50ae0e),_0x406baf),_0x59ae56=new Map(),_0x342af6=new Map(),_0x569462=new Map(),_0x30ce45=new Map(),_0x2b6274=new Map(),_0x52783e=new Map(),_0x486977=new Map();for(const _0x1cee9c of _0x198a05){_0x59ae56[_0x413d07(0x1cb)](_0x1cee9c[_0x413d07(0x202)]['name'],_0x1cee9c);}for(const _0x1673cd of _0x4671eb){_0x342af6[_0x413d07(0x1cb)](_0x1673cd[_0x413d07(0x202)][_0x413d07(0x238)],_0x1673cd);}for(const _0x3fbd3e of _0x114aa8){_0x569462['set'](_0x3fbd3e[_0x413d07(0x202)]['name'],_0x3fbd3e);}for(const _0x5d2943 of _0x5c5316){_0x30ce45[_0x413d07(0x1cb)](_0x5d2943[_0x413d07(0x202)]['name'],_0x5d2943);}for(const _0x48a22d of _0x505271){_0x2b6274[_0x413d07(0x1cb)](_0x48a22d[_0x413d07(0x202)][_0x413d07(0x21b)][_0x413d07(0x22b)](),_0x48a22d);}for(const _0x205a8e of _0x29d785){_0x52783e[_0x413d07(0x1cb)](_0x205a8e[_0x413d07(0x202)][_0x413d07(0x238)],_0x205a8e);}for(const _0x414c09 of _0x427f45){_0x486977[_0x413d07(0x1cb)](_0x414c09[_0x413d07(0x202)][_0x413d07(0x238)],_0x414c09);}const _0x1ceb29=new Map(),_0x5cb248=new Map();for(const _0x44a721 of _0x198a05){_0x1ceb29['set'](_0x44a721[_0x413d07(0x202)]['name'],_0x44a721['id']),_0x5cb248['set'](_0x44a721['id'],_0x44a721[_0x413d07(0x202)][_0x413d07(0x238)]);}const _0x380d83=new Map(),_0x19c1a0=new Map();for(const _0x3e3b98 of _0x5c5316){_0x380d83[_0x413d07(0x1cb)](_0x3e3b98[_0x413d07(0x202)][_0x413d07(0x238)],_0x3e3b98['id']),_0x19c1a0[_0x413d07(0x1cb)](_0x3e3b98['id'],_0x3e3b98[_0x413d07(0x202)][_0x413d07(0x238)]);}const _0x1d8577=_0x52a43d[_0x413d07(0x244)][_0x413d07(0x280)]||new Map(),_0x17b860=_0x52a43d[_0x413d07(0x244)]['TextKnowledgeBase']||new Map(),_0x1bcf61=_0x52a43d[_0x413d07(0x244)][_0x413d07(0x1bd)]||new Map(),_0x1a1ab9=new Map(),_0x1a50aa={'resolveToolTargetName':buildNameResolver({..._0x52a43d[_0x413d07(0x285)],'Agent':_0x5cb248}),'resolvePromptName':async _0x3a870b=>_0x19c1a0[_0x413d07(0x26c)](_0x3a870b),'onWarning':_0x223b0a=>this[_0x413d07(0x221)][_0x413d07(0x1ff)](_0x223b0a)};let _0x44beca=[];const _0x21d268={'projectId':_0x406baf,'resolveToolTargetId':buildIdResolver({..._0x52a43d[_0x413d07(0x244)],'Agent':_0x1ceb29}),'resolvePromptId':async _0x45cf55=>_0x380d83[_0x413d07(0x26c)](_0x45cf55),'onWarning':_0x4c3ad1=>{const _0x29461d=_0x413d07;this['logger'][_0x29461d(0x1ff)](_0x4c3ad1),_0x44beca[_0x29461d(0x1c0)](_0x4c3ad1);}},{resolved:_0x1ad4f7,unresolved:_0x4faee1}=resolveAgentDependencies(_0x263c23,new Set(_0x59ae56[_0x413d07(0x274)]()));for(const {agent:_0x16a6ea,missingDeps:_0x18649c}of _0x4faee1){_0x27594f[_0x413d07(0x291)][_0x413d07(0x1c0)]({'agentName':_0x16a6ea['yaml'][_0x413d07(0x238)],'action':_0x413d07(0x227),'error':_0x413d07(0x1af)+_0x18649c[_0x413d07(0x1a7)](',\x20')+_0x413d07(0x268)}),_0x27594f['counts'][_0x413d07(0x291)][_0x413d07(0x1b8)]++;}for(const _0xde6772 of _0xd0c1d2){const _0x46b6ed=_0x342af6[_0x413d07(0x26c)](_0xde6772[_0x413d07(0x1ee)][_0x413d07(0x238)]),_0x1a9fc5=a97_0x436715['readFileSync'](_0xde6772[_0x413d07(0x21d)],_0x413d07(0x23c));if(_0x46b6ed){const _0x1062ec=apiKnowledgeBaseToYaml(_0x46b6ed),_0x2d3728=toKnowledgeBaseYamlString(_0x1062ec),_0x1ba3e2=generateDiff(_0x2d3728,_0x1a9fc5),_0x52e6ca=hasChanges(_0x1ba3e2);_0x52e6ca?(_0x27594f[_0x413d07(0x28c)][_0x413d07(0x1c0)]({'name':_0xde6772['yaml'][_0x413d07(0x238)],'action':'updated','id':_0x46b6ed['id'],'diff':formatDiffWithColors(_0x1ba3e2)}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x28c)][_0x413d07(0x1e8)]++):(_0x27594f[_0x413d07(0x28c)][_0x413d07(0x1c0)]({'name':_0xde6772['yaml'][_0x413d07(0x238)],'action':_0x413d07(0x1d8),'id':_0x46b6ed['id']}),_0x27594f[_0x413d07(0x258)]['knowledgeBases'][_0x413d07(0x1d8)]++);}else _0x27594f[_0x413d07(0x28c)][_0x413d07(0x1c0)]({'name':_0xde6772[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':'created'}),_0x27594f[_0x413d07(0x258)]['knowledgeBases'][_0x413d07(0x206)]++;}for(const _0x49ea67 of _0xbc0bc8){const _0x16d4a7=_0x569462[_0x413d07(0x26c)](_0x49ea67[_0x413d07(0x238)]),_0x18be1e=a97_0x436715['readFileSync'](_0x49ea67[_0x413d07(0x21d)],_0x413d07(0x23c));if(_0x16d4a7){const _0x554675=toTextKnowledgeBaseMd(_0x16d4a7[_0x413d07(0x202)]['name'],_0x16d4a7[_0x413d07(0x202)][_0x413d07(0x1cf)]),_0x490137=generateDiff(_0x554675,_0x18be1e),_0x14e136=hasChanges(_0x490137);_0x14e136?(_0x27594f[_0x413d07(0x218)][_0x413d07(0x1c0)]({'name':_0x49ea67[_0x413d07(0x238)],'action':'updated','id':_0x16d4a7['id'],'diff':formatDiffWithColors(_0x490137)}),_0x27594f['counts'][_0x413d07(0x218)]['updated']++):(_0x27594f[_0x413d07(0x218)][_0x413d07(0x1c0)]({'name':_0x49ea67[_0x413d07(0x238)],'action':'unchanged','id':_0x16d4a7['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x218)][_0x413d07(0x1d8)]++);}else _0x27594f[_0x413d07(0x218)][_0x413d07(0x1c0)]({'name':_0x49ea67[_0x413d07(0x238)],'action':_0x413d07(0x206)}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x218)]['created']++;}for(const _0x1898c8 of _0x1ad4f7){const _0x7363fd=_0x59ae56[_0x413d07(0x26c)](_0x1898c8[_0x413d07(0x1ee)][_0x413d07(0x238)]),_0x364736=a97_0x71957c['join'](_0x1898c8[_0x413d07(0x1a4)],_0x413d07(0x29f)),_0xcb3412=a97_0x436715[_0x413d07(0x2a5)](_0x364736,'utf-8'),_0x3ad227=_0x1898c8[_0x413d07(0x1e2)],_0x2c59eb=_0x413d07(0x1bc)+_0x3ad227+_0x413d07(0x1ae)+_0xcb3412;if(_0x7363fd){const {yaml:_0x3f71c1,systemPrompt:_0x4f3e0a}=await agentResponseToDef(_0x7363fd,_0x1a50aa),_0x552691=toAgentYamlString(_0x3f71c1),_0x413ea4=_0x413d07(0x1bc)+_0x4f3e0a+'\x0a\x0a#\x20agent.yml\x0a'+_0x552691,_0x28eed2=generateDiff(_0x413ea4,_0x2c59eb),_0x234dfb=hasChanges(_0x28eed2);_0x234dfb?(_0x27594f[_0x413d07(0x291)][_0x413d07(0x1c0)]({'agentName':_0x1898c8['yaml']['name'],'action':_0x413d07(0x1e8),'agentId':_0x7363fd['id'],'diff':formatDiffWithColors(_0x28eed2)}),_0x27594f[_0x413d07(0x258)]['agents'][_0x413d07(0x1e8)]++):(_0x27594f['agents']['push']({'agentName':_0x1898c8[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':_0x413d07(0x1d8),'agentId':_0x7363fd['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x291)][_0x413d07(0x1d8)]++);}else _0x27594f[_0x413d07(0x291)]['push']({'agentName':_0x1898c8['yaml'][_0x413d07(0x238)],'action':'created'}),_0x27594f['counts']['agents'][_0x413d07(0x206)]++;}for(const _0x42853c of _0xf38623){const _0x98040d=_0x30ce45['get'](_0x42853c[_0x413d07(0x1ee)][_0x413d07(0x238)]),_0x53b906=a97_0x436715[_0x413d07(0x2a5)](_0x42853c['path'],'utf-8');if(_0x98040d){const _0x143179=await apiPromptToYaml(_0x98040d,_0x1a50aa);if(!_0x143179){_0x27594f[_0x413d07(0x296)][_0x413d07(0x1c0)]({'name':_0x42853c['yaml'][_0x413d07(0x238)],'action':_0x413d07(0x1e8),'id':_0x98040d['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x296)][_0x413d07(0x1e8)]++;continue;}const _0x730097=toPromptYamlString(_0x143179),_0x569c6a=generateDiff(_0x730097,_0x53b906),_0x530391=hasChanges(_0x569c6a);_0x530391?(_0x27594f[_0x413d07(0x296)][_0x413d07(0x1c0)]({'name':_0x42853c[_0x413d07(0x1ee)]['name'],'action':_0x413d07(0x1e8),'id':_0x98040d['id'],'diff':formatDiffWithColors(_0x569c6a)}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x296)]['updated']++):(_0x27594f[_0x413d07(0x296)][_0x413d07(0x1c0)]({'name':_0x42853c[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':_0x413d07(0x1d8),'id':_0x98040d['id']}),_0x27594f['counts']['prompts'][_0x413d07(0x1d8)]++);}else _0x27594f[_0x413d07(0x296)][_0x413d07(0x1c0)]({'name':_0x42853c['yaml'][_0x413d07(0x238)],'action':_0x413d07(0x206)}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x296)][_0x413d07(0x206)]++;}for(const _0x2904c5 of _0x52b7e1){const _0x63f8f4=_0x2b6274[_0x413d07(0x26c)](_0x2904c5[_0x413d07(0x1ee)][_0x413d07(0x246)]),_0x49221b=a97_0x436715[_0x413d07(0x2a5)](_0x2904c5['path'],'utf-8');if(_0x63f8f4){const _0x380391=await apiIntegrationToYaml(_0x63f8f4,_0x1a50aa),_0x30cc48=toIntegrationYamlString(_0x380391),_0x4cd180=generateDiff(_0x30cc48,_0x49221b),_0x2a5664=hasChanges(_0x4cd180);_0x2a5664?(_0x27594f['integrations'][_0x413d07(0x1c0)]({'name':_0x2904c5[_0x413d07(0x1ee)][_0x413d07(0x246)],'action':'updated','id':_0x63f8f4['id'],'diff':formatDiffWithColors(_0x4cd180)}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x27a)][_0x413d07(0x1e8)]++):(_0x27594f['integrations'][_0x413d07(0x1c0)]({'name':_0x2904c5['yaml'][_0x413d07(0x246)],'action':_0x413d07(0x1d8),'id':_0x63f8f4['id']}),_0x27594f['counts'][_0x413d07(0x27a)]['unchanged']++);}else _0x27594f[_0x413d07(0x27a)]['push']({'name':_0x2904c5['yaml']['service_type'],'action':_0x413d07(0x206)}),_0x27594f['counts']['integrations'][_0x413d07(0x206)]++;}for(const _0x4989a1 of _0x4031ce){const _0x410511=_0x52783e[_0x413d07(0x26c)](_0x4989a1[_0x413d07(0x20d)][_0x413d07(0x238)]),_0x9dac81=toExperimentalKnowledgeBaseYamlString(_0x4989a1['def']);let _0x32ff28=_0x9dac81;for(const _0x42bf6f of _0x4989a1[_0x413d07(0x20d)][_0x413d07(0x2a7)]){_0x32ff28+=_0x413d07(0x1a1)+_0x42bf6f[_0x413d07(0x238)]+_0x413d07(0x235)+_0x42bf6f['code']+_0x413d07(0x1a8)+_0x42bf6f[_0x413d07(0x238)]+_0x413d07(0x235)+_0x42bf6f['json_schema']+'\x0a';}if(_0x410511){const _0x3a5593=apiExperimentalKnowledgeBaseToYaml(_0x410511),_0x519d55=toExperimentalKnowledgeBaseYamlString(_0x3a5593);let _0xc6e2e9=_0x519d55;for(const _0xa1bb6f of _0x3a5593['functions']){_0xc6e2e9+=_0x413d07(0x1a1)+_0xa1bb6f[_0x413d07(0x238)]+'\x20---\x0a'+_0xa1bb6f[_0x413d07(0x1f8)]+_0x413d07(0x1a8)+_0xa1bb6f[_0x413d07(0x238)]+_0x413d07(0x235)+_0xa1bb6f[_0x413d07(0x24d)]+'\x0a';}const _0x2984a7=generateDiff(_0xc6e2e9,_0x32ff28),_0x4ad245=hasChanges(_0x2984a7);_0x4ad245?(_0x27594f[_0x413d07(0x19f)][_0x413d07(0x1c0)]({'name':_0x4989a1[_0x413d07(0x20d)][_0x413d07(0x238)],'action':_0x413d07(0x1e8),'id':_0x410511['id'],'diff':formatDiffWithColors(_0x2984a7)}),_0x27594f[_0x413d07(0x258)]['experimentalKnowledgeBases'][_0x413d07(0x1e8)]++):(_0x27594f[_0x413d07(0x19f)][_0x413d07(0x1c0)]({'name':_0x4989a1[_0x413d07(0x20d)][_0x413d07(0x238)],'action':_0x413d07(0x1d8),'id':_0x410511['id']}),_0x27594f['counts']['experimentalKnowledgeBases']['unchanged']++);}else _0x27594f[_0x413d07(0x19f)][_0x413d07(0x1c0)]({'name':_0x4989a1[_0x413d07(0x20d)][_0x413d07(0x238)],'action':'created'}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x19f)][_0x413d07(0x206)]++;}for(const _0x474e64 of _0xa7e620){const _0x5022da=_0x486977['get'](_0x474e64[_0x413d07(0x20d)][_0x413d07(0x238)]),_0x52ae14=toExperimentalArtifactYamlString(_0x474e64[_0x413d07(0x20d)]);let _0xfc76e9=_0x52ae14+(_0x413d07(0x2a3)+_0x474e64['def'][_0x413d07(0x1f8)]+'\x0a');for(const _0xd24d35 of _0x474e64[_0x413d07(0x20d)][_0x413d07(0x1f9)]){_0xfc76e9+=_0x413d07(0x279)+_0xd24d35[_0x413d07(0x24c)]+_0x413d07(0x235)+_0xd24d35['text_content']+'\x0a';}if(_0x5022da){const _0x26937f=apiExperimentalArtifactToYaml(_0x5022da),_0x11319f=toExperimentalArtifactYamlString(_0x26937f);let _0x142034=_0x11319f+(_0x413d07(0x2a3)+_0x26937f[_0x413d07(0x1f8)]+'\x0a');for(const _0x4722de of _0x26937f[_0x413d07(0x1f9)]){_0x142034+=_0x413d07(0x279)+_0x4722de[_0x413d07(0x24c)]+'\x20---\x0a'+_0x4722de['text_content']+'\x0a';}const _0x59492e=generateDiff(_0x142034,_0xfc76e9),_0x37db66=hasChanges(_0x59492e);_0x37db66?(_0x27594f[_0x413d07(0x29c)][_0x413d07(0x1c0)]({'name':_0x474e64[_0x413d07(0x20d)][_0x413d07(0x238)],'action':'updated','id':_0x5022da['id'],'diff':formatDiffWithColors(_0x59492e)}),_0x27594f[_0x413d07(0x258)]['experimentalArtifacts'][_0x413d07(0x1e8)]++):(_0x27594f[_0x413d07(0x29c)][_0x413d07(0x1c0)]({'name':_0x474e64[_0x413d07(0x20d)][_0x413d07(0x238)],'action':_0x413d07(0x1d8),'id':_0x5022da['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x29c)][_0x413d07(0x1d8)]++);}else _0x27594f['experimentalArtifacts'][_0x413d07(0x1c0)]({'name':_0x474e64[_0x413d07(0x20d)][_0x413d07(0x238)],'action':_0x413d07(0x206)}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x29c)][_0x413d07(0x206)]++;}if(_0xe7bb02?.[_0x413d07(0x25a)])return _0x27594f;_0x27594f[_0x413d07(0x28c)]=[],_0x27594f[_0x413d07(0x218)]=[],_0x27594f[_0x413d07(0x296)]=[],_0x27594f['integrations']=[],_0x27594f[_0x413d07(0x19f)]=[],_0x27594f['experimentalArtifacts']=[];const _0x3badcc=_0x27594f['agents'][_0x413d07(0x1c8)](_0xd841a2=>_0xd841a2['action']==='error');_0x27594f[_0x413d07(0x291)]=_0x3badcc,_0x27594f[_0x413d07(0x258)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3badcc[_0x413d07(0x26f)]},'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 _0x151f16 of _0xd0c1d2){try{const _0x122eba=_0x342af6[_0x413d07(0x26c)](_0x151f16[_0x413d07(0x1ee)]['name']),_0x3e52fb=yamlKnowledgeBaseToApi(_0x151f16[_0x413d07(0x1ee)],_0x406baf);if(_0x122eba)await this[_0x413d07(0x1ea)]['updateKnowledgeBase'](_0x122eba['id'],_0x3e52fb),_0x1d8577[_0x413d07(0x1cb)](_0x151f16[_0x413d07(0x1ee)][_0x413d07(0x238)],_0x122eba['id']),_0x27594f[_0x413d07(0x28c)]['push']({'name':_0x151f16[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':'updated','id':_0x122eba['id']}),_0x27594f['counts'][_0x413d07(0x28c)]['updated']++;else{const _0x2e9903=await this[_0x413d07(0x1ea)][_0x413d07(0x282)](_0x3e52fb);_0x1d8577[_0x413d07(0x1cb)](_0x151f16[_0x413d07(0x1ee)][_0x413d07(0x238)],_0x2e9903['id']),_0x27594f[_0x413d07(0x28c)][_0x413d07(0x1c0)]({'name':_0x151f16['yaml'][_0x413d07(0x238)],'action':_0x413d07(0x206),'id':_0x2e9903['id']}),_0x27594f[_0x413d07(0x258)]['knowledgeBases']['created']++;}}catch(_0x2c4bb0){_0x27594f['knowledgeBases'][_0x413d07(0x1c0)]({'name':_0x151f16[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':_0x413d07(0x227),'error':_0x2c4bb0[_0x413d07(0x24a)]}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x28c)][_0x413d07(0x1b8)]++;}}for(const _0x365a16 of _0xbc0bc8){try{const _0x28e2d0=_0x569462[_0x413d07(0x26c)](_0x365a16[_0x413d07(0x238)]),_0x2f630f=yamlTextKnowledgeBaseToApi({'name':_0x365a16['name'],'text':_0x365a16['text']},_0x406baf);if(_0x28e2d0)await this[_0x413d07(0x1ea)][_0x413d07(0x21f)](_0x28e2d0['id'],_0x2f630f),_0x17b860[_0x413d07(0x1cb)](_0x365a16[_0x413d07(0x238)],_0x28e2d0['id']),_0x27594f[_0x413d07(0x218)][_0x413d07(0x1c0)]({'name':_0x365a16[_0x413d07(0x238)],'action':_0x413d07(0x1e8),'id':_0x28e2d0['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x218)][_0x413d07(0x1e8)]++;else{const _0x23ca70=await this[_0x413d07(0x1ea)][_0x413d07(0x1a0)](_0x2f630f);_0x17b860['set'](_0x365a16[_0x413d07(0x238)],_0x23ca70['id']),_0x27594f[_0x413d07(0x218)]['push']({'name':_0x365a16[_0x413d07(0x238)],'action':_0x413d07(0x206),'id':_0x23ca70['id']}),_0x27594f['counts']['textKnowledgeBases'][_0x413d07(0x206)]++;}}catch(_0x3f04b3){_0x27594f['textKnowledgeBases'][_0x413d07(0x1c0)]({'name':_0x365a16['name'],'action':_0x413d07(0x227),'error':_0x3f04b3[_0x413d07(0x24a)]}),_0x27594f['counts']['textKnowledgeBases'][_0x413d07(0x1b8)]++;}}for(const _0x11ce1d of _0x4031ce){try{const _0x2d38e9=_0x52783e[_0x413d07(0x26c)](_0x11ce1d[_0x413d07(0x20d)]['name']),_0x4256a2=yamlExperimentalKnowledgeBaseToApi(_0x11ce1d[_0x413d07(0x20d)],_0x406baf);if(_0x2d38e9)await this['client'][_0x413d07(0x1ca)](_0x2d38e9['id'],_0x4256a2),_0x1bcf61[_0x413d07(0x1cb)](_0x11ce1d['def']['name'],_0x2d38e9['id']),_0x27594f[_0x413d07(0x19f)]['push']({'name':_0x11ce1d[_0x413d07(0x20d)][_0x413d07(0x238)],'action':_0x413d07(0x1e8),'id':_0x2d38e9['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x19f)]['updated']++;else{const _0xb77868=await this[_0x413d07(0x1ea)][_0x413d07(0x1e4)](_0x4256a2);_0x1bcf61[_0x413d07(0x1cb)](_0x11ce1d['def'][_0x413d07(0x238)],_0xb77868['id']),_0x27594f[_0x413d07(0x19f)][_0x413d07(0x1c0)]({'name':_0x11ce1d[_0x413d07(0x20d)]['name'],'action':_0x413d07(0x206),'id':_0xb77868['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x19f)][_0x413d07(0x206)]++;}}catch(_0x3cf2d0){_0x27594f[_0x413d07(0x19f)][_0x413d07(0x1c0)]({'name':_0x11ce1d['def'][_0x413d07(0x238)],'action':_0x413d07(0x227),'error':_0x3cf2d0[_0x413d07(0x24a)]}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x19f)]['errors']++;}}for(const _0x1d32f8 of _0xa7e620){try{const _0x14edb7=_0x486977[_0x413d07(0x26c)](_0x1d32f8[_0x413d07(0x20d)][_0x413d07(0x238)]),_0x557943=yamlExperimentalArtifactToApi(_0x1d32f8[_0x413d07(0x20d)],_0x406baf);if(_0x14edb7)await this[_0x413d07(0x1ea)]['updateExperimentalArtifact'](_0x14edb7['id'],_0x557943),_0x1a1ab9[_0x413d07(0x1cb)](_0x1d32f8[_0x413d07(0x20d)]['name'],_0x14edb7['id']),_0x27594f['experimentalArtifacts'][_0x413d07(0x1c0)]({'name':_0x1d32f8['def'][_0x413d07(0x238)],'action':_0x413d07(0x1e8),'id':_0x14edb7['id']}),_0x27594f['counts'][_0x413d07(0x29c)][_0x413d07(0x1e8)]++;else{const _0x40fbeb=await this[_0x413d07(0x1ea)][_0x413d07(0x19c)](_0x557943);_0x1a1ab9[_0x413d07(0x1cb)](_0x1d32f8[_0x413d07(0x20d)][_0x413d07(0x238)],_0x40fbeb['id']),_0x27594f[_0x413d07(0x29c)][_0x413d07(0x1c0)]({'name':_0x1d32f8['def'][_0x413d07(0x238)],'action':'created','id':_0x40fbeb['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x29c)][_0x413d07(0x206)]++;}}catch(_0x23f692){_0x27594f['experimentalArtifacts'][_0x413d07(0x1c0)]({'name':_0x1d32f8[_0x413d07(0x20d)][_0x413d07(0x238)],'action':'error','error':_0x23f692[_0x413d07(0x24a)]}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x29c)]['errors']++;}}for(const _0x6413d2 of _0x1ad4f7){_0x44beca=[];try{const _0x612b94=_0x59ae56[_0x413d07(0x26c)](_0x6413d2[_0x413d07(0x1ee)]['name']),_0x2342bf=await agentDefToRequest(_0x6413d2[_0x413d07(0x1ee)],_0x6413d2['systemPrompt'],_0x6413d2[_0x413d07(0x213)],_0x21d268);if(_0x612b94)await this[_0x413d07(0x1ea)][_0x413d07(0x226)](_0x612b94['id'],_0x2342bf),_0x1ceb29[_0x413d07(0x1cb)](_0x6413d2[_0x413d07(0x1ee)][_0x413d07(0x238)],_0x612b94['id']),_0x27594f[_0x413d07(0x291)][_0x413d07(0x1c0)]({'agentName':_0x6413d2['yaml'][_0x413d07(0x238)],'action':_0x413d07(0x1e8),'agentId':_0x612b94['id'],'warnings':_0x44beca[_0x413d07(0x26f)]>0x0?_0x44beca:undefined}),_0x27594f[_0x413d07(0x258)]['agents'][_0x413d07(0x1e8)]++;else{const _0x1f21bb=await this[_0x413d07(0x1ea)]['createAgentResponse'](_0x2342bf);_0x1ceb29['set'](_0x6413d2['yaml'][_0x413d07(0x238)],_0x1f21bb['id']),_0x27594f[_0x413d07(0x291)][_0x413d07(0x1c0)]({'agentName':_0x6413d2[_0x413d07(0x1ee)]['name'],'action':_0x413d07(0x206),'agentId':_0x1f21bb['id'],'warnings':_0x44beca[_0x413d07(0x26f)]>0x0?_0x44beca:undefined}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x291)][_0x413d07(0x206)]++;}}catch(_0x5195bf){_0x27594f[_0x413d07(0x291)][_0x413d07(0x1c0)]({'agentName':_0x6413d2[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':'error','error':_0x5195bf[_0x413d07(0x24a)],'warnings':_0x44beca[_0x413d07(0x26f)]>0x0?_0x44beca:undefined}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x291)][_0x413d07(0x1b8)]++;}}for(const _0x2845f6 of _0xf38623){try{const _0x118604=_0x30ce45[_0x413d07(0x26c)](_0x2845f6[_0x413d07(0x1ee)][_0x413d07(0x238)]),_0x15fde3=await yamlPromptToApi(_0x2845f6['yaml'],_0x406baf,_0x21d268);if(!_0x15fde3){_0x27594f[_0x413d07(0x296)]['push']({'name':_0x2845f6[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':_0x413d07(0x227),'error':_0x413d07(0x220)}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x296)]['errors']++;continue;}if(_0x118604)await this[_0x413d07(0x1ea)][_0x413d07(0x262)](_0x118604['id'],_0x15fde3),_0x380d83[_0x413d07(0x1cb)](_0x2845f6[_0x413d07(0x1ee)][_0x413d07(0x238)],_0x118604['id']),_0x27594f[_0x413d07(0x296)][_0x413d07(0x1c0)]({'name':_0x2845f6['yaml'][_0x413d07(0x238)],'action':_0x413d07(0x1e8),'id':_0x118604['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x296)][_0x413d07(0x1e8)]++;else{const _0x5d68cf=await this[_0x413d07(0x1ea)][_0x413d07(0x233)](_0x15fde3);_0x380d83['set'](_0x2845f6[_0x413d07(0x1ee)][_0x413d07(0x238)],_0x5d68cf['id']),_0x27594f['prompts'][_0x413d07(0x1c0)]({'name':_0x2845f6[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':_0x413d07(0x206),'id':_0x5d68cf['id']}),_0x27594f['counts'][_0x413d07(0x296)][_0x413d07(0x206)]++;}}catch(_0x42e557){_0x27594f[_0x413d07(0x296)]['push']({'name':_0x2845f6[_0x413d07(0x1ee)][_0x413d07(0x238)],'action':_0x413d07(0x227),'error':_0x42e557[_0x413d07(0x24a)]}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x296)][_0x413d07(0x1b8)]++;}}for(const _0x4f4f2e of _0x52b7e1){try{const _0x59471a=_0x2b6274[_0x413d07(0x26c)](_0x4f4f2e[_0x413d07(0x1ee)][_0x413d07(0x246)]),_0x29f5be=await yamlIntegrationToApi(_0x4f4f2e[_0x413d07(0x1ee)],_0x406baf,_0x21d268);if(_0x59471a){await this['client'][_0x413d07(0x201)](_0x59471a['id']);const _0xc5a355=await this[_0x413d07(0x1ea)][_0x413d07(0x222)](_0x29f5be);_0x27594f[_0x413d07(0x27a)][_0x413d07(0x1c0)]({'name':_0x4f4f2e[_0x413d07(0x1ee)][_0x413d07(0x246)],'action':_0x413d07(0x1e8),'id':_0xc5a355['id']}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x27a)][_0x413d07(0x1e8)]++;}else{const _0x3ac895=await this[_0x413d07(0x1ea)][_0x413d07(0x222)](_0x29f5be);_0x27594f[_0x413d07(0x27a)][_0x413d07(0x1c0)]({'name':_0x4f4f2e[_0x413d07(0x1ee)][_0x413d07(0x246)],'action':_0x413d07(0x206),'id':_0x3ac895['id']}),_0x27594f[_0x413d07(0x258)]['integrations'][_0x413d07(0x206)]++;}}catch(_0x4195d6){_0x27594f['integrations']['push']({'name':_0x4f4f2e[_0x413d07(0x1ee)][_0x413d07(0x246)],'action':_0x413d07(0x227),'error':_0x4195d6[_0x413d07(0x24a)]}),_0x27594f[_0x413d07(0x258)][_0x413d07(0x27a)]['errors']++;}}return _0x27594f;}async['pullAgent'](_0x2415bf,_0x1e49cf,_0x2e089c,_0x2788ba){const _0x4e8bab=a97_0x353cf4,{projectId:_0x454e65,project:_0x372d35}=await this['resolveProjectName'](_0x2415bf),_0x55d13c=_0x372d35[_0x4e8bab(0x202)]['name'],_0x51abe0=await this[_0x4e8bab(0x1ea)][_0x4e8bab(0x228)](_0x454e65),_0x375fc6=_0x51abe0[_0x4e8bab(0x20e)](_0x22fa1d=>_0x22fa1d[_0x4e8bab(0x202)][_0x4e8bab(0x238)]===_0x1e49cf);if(!_0x375fc6)throw new SDKError(ErrorCode[_0x4e8bab(0x28e)],_0x4e8bab(0x28a)+_0x1e49cf,undefined,{'helpText':'Available\x20agents:\x20'+_0x51abe0[_0x4e8bab(0x237)](_0x40a1e5=>_0x40a1e5['attributes']['name'])[_0x4e8bab(0x1a7)](',\x20')});let _0x74f88e;if(_0x2e089c)_0x74f88e=_0x2e089c;else{const _0x215785=a97_0x71957c[_0x4e8bab(0x1a7)](process[_0x4e8bab(0x1cd)](),_0x4e8bab(0x291)),_0x4742ad=getSanitizedPathWithMigration(_0x215785,_0x55d13c);_0x4742ad[_0x4e8bab(0x197)]&&this[_0x4e8bab(0x221)][_0x4e8bab(0x29d)](_0x4e8bab(0x253)+a97_0x71957c[_0x4e8bab(0x230)](_0x4742ad[_0x4e8bab(0x25d)])+'\x20→\x20'+a97_0x71957c[_0x4e8bab(0x230)](_0x4742ad[_0x4e8bab(0x21d)])),_0x74f88e=_0x4742ad['path'];}const _0x41aeca=getSanitizedPathWithMigration(_0x74f88e,_0x1e49cf);_0x41aeca['renamed']&&this[_0x4e8bab(0x221)][_0x4e8bab(0x29d)](_0x4e8bab(0x1c4)+a97_0x71957c[_0x4e8bab(0x230)](_0x41aeca[_0x4e8bab(0x25d)])+_0x4e8bab(0x289)+a97_0x71957c[_0x4e8bab(0x230)](_0x41aeca[_0x4e8bab(0x21d)]));const _0x1334b3=_0x41aeca[_0x4e8bab(0x21d)],_0x193dee=new Map(),_0x1be242=new Map(),_0x2deb55=await this[_0x4e8bab(0x1ea)][_0x4e8bab(0x1d6)](_0x454e65),_0x82f420=await this['client'][_0x4e8bab(0x257)](_0x454e65),_0x48641c=await this[_0x4e8bab(0x1ea)][_0x4e8bab(0x277)](_0x454e65),_0x15fdeb=new Map(),_0x208ae2=new Map();for(const _0x3b5aa6 of _0x2deb55){_0x193dee[_0x4e8bab(0x1cb)](_0x3b5aa6['id'],_0x3b5aa6['attributes'][_0x4e8bab(0x238)]);}for(const _0x2d0dd9 of _0x82f420){_0x15fdeb['set'](_0x2d0dd9['id'],_0x2d0dd9[_0x4e8bab(0x202)]['name']);}for(const _0x57264e of _0x48641c){_0x208ae2[_0x4e8bab(0x1cb)](_0x57264e['id'],_0x57264e['attributes'][_0x4e8bab(0x238)]);}for(const _0x72faea of _0x51abe0){_0x1be242[_0x4e8bab(0x1cb)](_0x72faea['id'],_0x72faea['attributes']['name']);}const _0x2b7038={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x193dee,'TextKnowledgeBase':_0x15fdeb,'Agent':_0x1be242,'ExperimentalKnowledgeBase':_0x208ae2}),'resolvePromptName':async()=>undefined,'onWarning':_0x1b692a=>this['logger'][_0x4e8bab(0x1ff)](_0x1b692a)},_0x3b776f=a97_0x71957c['join'](_0x1334b3,_0x4e8bab(0x1da)),_0x2bf69a=a97_0x71957c[_0x4e8bab(0x1a7)](_0x1334b3,_0x4e8bab(0x29f)),_0x352fe2=a97_0x71957c[_0x4e8bab(0x1a7)](_0x1334b3,_0x4e8bab(0x242)),_0x4a83d3=!a97_0x436715['existsSync'](_0x2bf69a);if(_0x2788ba?.[_0x4e8bab(0x25a)])return{'agentName':_0x1e49cf,'outputPath':_0x1334b3,'isNew':_0x4a83d3,'hasChanges':!![]};a97_0x436715[_0x4e8bab(0x1dc)](_0x74f88e,{'recursive':!![]}),a97_0x436715['mkdirSync'](_0x1334b3,{'recursive':!![]});const _0x163d53=a97_0x71957c[_0x4e8bab(0x1a7)](_0x74f88e,_0x4e8bab(0x1b2));!a97_0x436715[_0x4e8bab(0x24b)](_0x163d53)&&a97_0x436715[_0x4e8bab(0x225)](_0x163d53,createAgentConfigContent(_0x2415bf));const {yaml:_0x2f5a54,systemPrompt:_0x5845,starterMessage:_0x44a2ed}=await agentResponseToDef(_0x375fc6,_0x2b7038);let _0x144b61=_0x4a83d3;if(!_0x4a83d3){const _0x8d4b09=a97_0x436715[_0x4e8bab(0x24b)](_0x3b776f)?a97_0x436715[_0x4e8bab(0x2a5)](_0x3b776f,_0x4e8bab(0x23c)):'',_0x2fceb7=a97_0x436715[_0x4e8bab(0x2a5)](_0x2bf69a,_0x4e8bab(0x23c));_0x144b61=_0x8d4b09!==_0x5845||_0x2fceb7!==toAgentYamlString(_0x2f5a54);}a97_0x436715['writeFileSync'](_0x3b776f,_0x5845),a97_0x436715[_0x4e8bab(0x225)](_0x2bf69a,toAgentYamlString(_0x2f5a54));if(_0x44a2ed&&_0x44a2ed[_0x4e8bab(0x1f1)]('\x0a'))a97_0x436715[_0x4e8bab(0x225)](_0x352fe2,_0x44a2ed);else a97_0x436715[_0x4e8bab(0x24b)](_0x352fe2)&&a97_0x436715['unlinkSync'](_0x352fe2);return{'agentName':_0x1e49cf,'outputPath':_0x1334b3,'isNew':_0x4a83d3,'hasChanges':_0x144b61};}async[a97_0x353cf4(0x26b)](_0x2362ae,_0x1351a7){const _0x2b1ade=a97_0x353cf4;let _0x302c40;isAgentYamlPath(_0x2362ae)?_0x302c40=getAgentDirFromYamlPath(_0x2362ae):_0x302c40=_0x2362ae;const {config:_0x745092}=findAgentConfig(_0x302c40),_0x48ab11=await this[_0x2b1ade(0x1a2)](_0x745092['llm_project']),_0x380b48=a97_0x71957c[_0x2b1ade(0x1a7)](_0x302c40,_0x2b1ade(0x29f)),_0x317801=a97_0x71957c[_0x2b1ade(0x1a7)](_0x302c40,_0x2b1ade(0x1da)),_0xd2fe3a=a97_0x71957c[_0x2b1ade(0x1a7)](_0x302c40,_0x2b1ade(0x242));if(!a97_0x436715[_0x2b1ade(0x24b)](_0x380b48))throw new SDKError(ErrorCode[_0x2b1ade(0x1ba)],_0x2b1ade(0x265)+_0x302c40,undefined,{'helpText':_0x2b1ade(0x20c)});const _0x1ebfb1=parseAgentYaml(a97_0x436715[_0x2b1ade(0x2a5)](_0x380b48,_0x2b1ade(0x23c)),_0x380b48),_0x25b0af=a97_0x436715[_0x2b1ade(0x24b)](_0x317801)?a97_0x436715[_0x2b1ade(0x2a5)](_0x317801,'utf-8'):'',_0x2ee56c=a97_0x436715[_0x2b1ade(0x24b)](_0xd2fe3a)?a97_0x436715[_0x2b1ade(0x2a5)](_0xd2fe3a,'utf-8'):_0x1ebfb1[_0x2b1ade(0x20b)];if(_0x1351a7?.['dryRun'])return{'agentName':_0x1ebfb1[_0x2b1ade(0x238)],'action':_0x2b1ade(0x206),'projectId':_0x48ab11};const _0x2a8546=await this[_0x2b1ade(0x1ea)][_0x2b1ade(0x228)](_0x48ab11),_0x29cd8d=await fetchAllToolTargetMaps((_0x356646,_0x2038f4)=>this['client']['listToolTargets'](_0x356646,_0x2038f4),_0x48ab11),_0x57355a=new Map();for(const _0xfa888f of _0x2a8546){_0x57355a['set'](_0xfa888f['attributes']['name'],_0xfa888f['id']);}const _0x5128a0=[],_0x323879={'projectId':_0x48ab11,'resolveToolTargetId':buildIdResolver({..._0x29cd8d[_0x2b1ade(0x244)],'Agent':_0x57355a}),'resolvePromptId':async()=>undefined,'onWarning':_0x1901f2=>{const _0x492c45=_0x2b1ade;this[_0x492c45(0x221)][_0x492c45(0x1ff)](_0x1901f2),_0x5128a0[_0x492c45(0x1c0)](_0x1901f2);}};try{const _0x5a7da3=_0x2a8546[_0x2b1ade(0x20e)](_0x136d1b=>_0x136d1b['attributes'][_0x2b1ade(0x238)]===_0x1ebfb1[_0x2b1ade(0x238)]),_0x1eda0c=await agentDefToRequest(_0x1ebfb1,_0x25b0af,_0x2ee56c,_0x323879);if(_0x5a7da3)return await this[_0x2b1ade(0x1ea)]['updateAgentResponse'](_0x5a7da3['id'],_0x1eda0c),{'agentName':_0x1ebfb1[_0x2b1ade(0x238)],'action':_0x2b1ade(0x1e8),'projectId':_0x48ab11,'agentId':_0x5a7da3['id'],'warnings':_0x5128a0['length']>0x0?_0x5128a0:undefined};else{const _0x384586=await this[_0x2b1ade(0x1ea)][_0x2b1ade(0x2a4)](_0x1eda0c);return{'agentName':_0x1ebfb1[_0x2b1ade(0x238)],'action':'created','projectId':_0x48ab11,'agentId':_0x384586['id'],'warnings':_0x5128a0['length']>0x0?_0x5128a0:undefined};}}catch(_0x279382){return{'agentName':_0x1ebfb1[_0x2b1ade(0x238)],'action':_0x2b1ade(0x227),'projectId':_0x48ab11,'error':_0x279382[_0x2b1ade(0x24a)],'warnings':_0x5128a0[_0x2b1ade(0x26f)]>0x0?_0x5128a0:undefined};}}async[a97_0x353cf4(0x24f)](_0x4a2a81,_0x51e1cf,_0x1ef84e){const _0x50750f=a97_0x353cf4,_0x329f4b=a97_0x436715['existsSync'](_0x4a2a81)&&a97_0x436715[_0x50750f(0x24b)](a97_0x71957c[_0x50750f(0x1a7)](_0x4a2a81,_0x50750f(0x1b2)));let _0x4a7843;const _0x473f34=[],_0x3e47e2=[],_0x120c7f=[],_0x2ac5da=[],_0x2d142a=[],_0x156ca0=[],_0x10e1a8=[];if(_0x329f4b){const _0x139087=loadAgentConfig(a97_0x71957c['join'](_0x4a2a81,'tdx.json'));_0x4a7843=_0x139087['llm_project'];const _0xc8a5c7=a97_0x436715[_0x50750f(0x1c6)](_0x4a2a81,{'withFileTypes':!![]});for(const _0x4c0009 of _0xc8a5c7){if(!_0x4c0009[_0x50750f(0x1ab)]())continue;if([_0x50750f(0x1d3),_0x50750f(0x1f0),_0x50750f(0x1a6),_0x50750f(0x296),_0x50750f(0x27a)]['includes'](_0x4c0009[_0x50750f(0x238)]))continue;const _0x19bba8=a97_0x71957c[_0x50750f(0x1a7)](_0x4a2a81,_0x4c0009[_0x50750f(0x238)]);if(isAgentDir(_0x19bba8)){const _0x216618=a97_0x71957c[_0x50750f(0x1a7)](_0x19bba8,_0x50750f(0x29f)),_0x57a907=a97_0x71957c[_0x50750f(0x1a7)](_0x19bba8,_0x50750f(0x1da)),_0x49a29d=a97_0x71957c['join'](_0x19bba8,_0x50750f(0x242)),_0x2b6eb0=parseAgentYaml(a97_0x436715[_0x50750f(0x2a5)](_0x216618,_0x50750f(0x23c)),_0x216618),_0x1549c3=a97_0x436715[_0x50750f(0x24b)](_0x57a907)?a97_0x436715['readFileSync'](_0x57a907,'utf-8'):'',_0x2f8226=a97_0x436715['existsSync'](_0x49a29d)?a97_0x436715['readFileSync'](_0x49a29d,_0x50750f(0x23c)):_0x2b6eb0[_0x50750f(0x20b)];_0x473f34[_0x50750f(0x1c0)]({'name':_0x2b6eb0[_0x50750f(0x238)],'dir':_0x19bba8,'yaml':_0x2b6eb0,'systemPrompt':_0x1549c3,'starterMessage':_0x2f8226});}}const _0x302e1a=getKnowledgeBasesDir(_0x4a2a81);if(a97_0x436715[_0x50750f(0x24b)](_0x302e1a)){const _0x37811c=a97_0x436715[_0x50750f(0x1c6)](_0x302e1a);for(const _0x4d1d56 of _0x37811c){const _0x5b2592=a97_0x71957c[_0x50750f(0x1a7)](_0x302e1a,_0x4d1d56);if(_0x4d1d56['endsWith'](_0x50750f(0x209))){const _0x3690f1=parseKnowledgeBaseYaml(a97_0x436715[_0x50750f(0x2a5)](_0x5b2592,'utf-8'),_0x5b2592);_0x3e47e2[_0x50750f(0x1c0)]({'name':_0x3690f1['name'],'path':_0x5b2592,'yaml':_0x3690f1});}else{if(_0x4d1d56[_0x50750f(0x295)]('.md')){const _0x3cc9b5=a97_0x436715[_0x50750f(0x2a5)](_0x5b2592,_0x50750f(0x23c)),{name:_0x119474,text:_0x26f5b4}=parseTextKnowledgeBaseMd(_0x3cc9b5,_0x4d1d56);_0x120c7f[_0x50750f(0x1c0)]({'name':_0x119474,'path':_0x5b2592,'text':_0x26f5b4});}}}}const _0x47599e=getPromptsDir(_0x4a2a81);if(a97_0x436715[_0x50750f(0x24b)](_0x47599e)){const _0x473a41=a97_0x436715[_0x50750f(0x1c6)](_0x47599e)[_0x50750f(0x1c8)](_0x417565=>_0x417565['endsWith'](_0x50750f(0x209)));for(const _0x222927 of _0x473a41){const _0x16911e=a97_0x71957c[_0x50750f(0x1a7)](_0x47599e,_0x222927),_0x593020=parsePromptYaml(a97_0x436715['readFileSync'](_0x16911e,_0x50750f(0x23c)),_0x16911e);_0x2ac5da[_0x50750f(0x1c0)]({'name':_0x593020[_0x50750f(0x238)],'path':_0x16911e,'yaml':_0x593020});}}const _0x2976fa=getIntegrationsDir(_0x4a2a81);if(a97_0x436715[_0x50750f(0x24b)](_0x2976fa)){const _0x5c7464=a97_0x436715[_0x50750f(0x1c6)](_0x2976fa)[_0x50750f(0x1c8)](_0x393f73=>_0x393f73[_0x50750f(0x295)](_0x50750f(0x209)));for(const _0x1ecb45 of _0x5c7464){const _0x262eb4=a97_0x71957c[_0x50750f(0x1a7)](_0x2976fa,_0x1ecb45),_0x4a7859=parseIntegrationYaml(a97_0x436715[_0x50750f(0x2a5)](_0x262eb4,_0x50750f(0x23c)),_0x262eb4);SAFE_INTEGRATION_TYPES['includes'](_0x4a7859[_0x50750f(0x246)]['toLowerCase']())?_0x2d142a[_0x50750f(0x1c0)]({'name':_0x4a7859[_0x50750f(0x238)],'path':_0x262eb4,'yaml':_0x4a7859}):this['logger'][_0x50750f(0x1ff)]('Skipping\x20integration\x20\x27'+_0x4a7859[_0x50750f(0x238)]+_0x50750f(0x1bb)+_0x4a7859[_0x50750f(0x246)]+_0x50750f(0x26d)+(_0x50750f(0x284)+SAFE_INTEGRATION_TYPES[_0x50750f(0x1a7)](',\x20')+_0x50750f(0x25e)));}}const _0x246953=getExperimentalKnowledgeBasesDir(_0x4a2a81);if(a97_0x436715[_0x50750f(0x24b)](_0x246953)){const _0x1f9ce3=a97_0x436715['readdirSync'](_0x246953,{'withFileTypes':!![]});for(const _0x12fdd4 of _0x1f9ce3){if(!_0x12fdd4[_0x50750f(0x1ab)]())continue;const _0x1099a5=a97_0x71957c['join'](_0x246953,_0x12fdd4['name']),_0x352555=a97_0x71957c[_0x50750f(0x1a7)](_0x1099a5,_0x12fdd4[_0x50750f(0x238)]+'.yml');if(a97_0x436715[_0x50750f(0x24b)](_0x352555)){const _0x48c02f=parseExperimentalKnowledgeBaseYaml(a97_0x436715[_0x50750f(0x2a5)](_0x352555,_0x50750f(0x23c)),_0x352555),_0x5c1ed4=a97_0x71957c[_0x50750f(0x1a7)](_0x1099a5,_0x50750f(0x2a7)),_0x5306c5=[];if(a97_0x436715[_0x50750f(0x24b)](_0x5c1ed4)){const _0x563952=a97_0x436715['readdirSync'](_0x5c1ed4,{'withFileTypes':!![]});for(const _0x15c31d of _0x563952){if(!_0x15c31d['isDirectory']())continue;const _0x448bc5=a97_0x71957c['join'](_0x5c1ed4,_0x15c31d[_0x50750f(0x238)]),_0x4c4bdc=a97_0x71957c[_0x50750f(0x1a7)](_0x448bc5,'code.js'),_0x2cc45e=a97_0x71957c[_0x50750f(0x1a7)](_0x448bc5,_0x50750f(0x1b1));if(a97_0x436715[_0x50750f(0x24b)](_0x4c4bdc)&&a97_0x436715[_0x50750f(0x24b)](_0x2cc45e)){const _0x5967c5=a97_0x436715[_0x50750f(0x2a5)](_0x4c4bdc,'utf-8'),_0x201f90=a97_0x436715[_0x50750f(0x2a5)](_0x2cc45e,_0x50750f(0x23c));_0x5306c5['push']({'name':_0x15c31d['name'],'code':_0x5967c5,'json_schema':_0x201f90});}}}const _0x2e6419={..._0x48c02f,'functions':_0x5306c5};_0x156ca0[_0x50750f(0x1c0)]({'name':_0x48c02f[_0x50750f(0x238)],'path':_0x1099a5,'def':_0x2e6419});}}}const _0x2755f4=getExperimentalArtifactsDir(_0x4a2a81);if(a97_0x436715['existsSync'](_0x2755f4)){const _0x2b4c78=a97_0x436715[_0x50750f(0x1c6)](_0x2755f4,{'withFileTypes':!![]});for(const _0x5780eb of _0x2b4c78){if(!_0x5780eb[_0x50750f(0x1ab)]())continue;const _0x4bfad3=a97_0x71957c[_0x50750f(0x1a7)](_0x2755f4,_0x5780eb[_0x50750f(0x238)]),_0x25ea52=a97_0x71957c[_0x50750f(0x1a7)](_0x4bfad3,_0x5780eb[_0x50750f(0x238)]+'.yml');if(a97_0x436715[_0x50750f(0x24b)](_0x25ea52)){const _0x3bfb56=parseExperimentalArtifactYaml(a97_0x436715[_0x50750f(0x2a5)](_0x25ea52,_0x50750f(0x23c)),_0x25ea52),_0x2c0d1f=a97_0x71957c[_0x50750f(0x1a7)](_0x4bfad3,'code.js'),_0x1ad74a=a97_0x436715[_0x50750f(0x24b)](_0x2c0d1f)?a97_0x436715[_0x50750f(0x2a5)](_0x2c0d1f,_0x50750f(0x23c)):'',_0x33568c=a97_0x71957c['join'](_0x4bfad3,_0x50750f(0x1f9)),_0xa64f4e=[];if(a97_0x436715[_0x50750f(0x24b)](_0x33568c)){const _0x365445=a97_0x436715[_0x50750f(0x1c6)](_0x33568c);for(const _0x5f4b4b of _0x365445){const _0x50c2c6=a97_0x71957c[_0x50750f(0x1a7)](_0x33568c,_0x5f4b4b);if(a97_0x436715[_0x50750f(0x2a1)](_0x50c2c6)['isFile']()){const _0x2574ec=a97_0x436715['readFileSync'](_0x50c2c6,_0x50750f(0x23c));_0xa64f4e[_0x50750f(0x1c0)]({'file_name':_0x5f4b4b,'text_content':_0x2574ec});}}}const _0x4cded7={..._0x3bfb56,'code':_0x1ad74a,'files':_0xa64f4e};_0x10e1a8[_0x50750f(0x1c0)]({'name':_0x3bfb56[_0x50750f(0x238)],'path':_0x4bfad3,'def':_0x4cded7});}}}}else{const _0x4722bc=await this[_0x50750f(0x1a2)](_0x4a2a81),_0x31cda0=await this[_0x50750f(0x1ea)][_0x50750f(0x1c5)](_0x4722bc);_0x4a7843=_0x31cda0['attributes'][_0x50750f(0x238)];const _0x5682ec=await this[_0x50750f(0x1ea)][_0x50750f(0x228)](_0x4722bc),_0x1fa399=await this['client'][_0x50750f(0x1d6)](_0x4722bc),_0x4e4ee1=await this[_0x50750f(0x1ea)]['listTextKnowledgeBases'](_0x4722bc),_0x11fb48=await this[_0x50750f(0x1ea)][_0x50750f(0x27c)](_0x4722bc),_0x42ebc5=await this[_0x50750f(0x1ea)]['listIntegrations'](_0x4722bc),_0x3ffd48=await this[_0x50750f(0x1ea)][_0x50750f(0x277)](_0x4722bc),_0x856485=await this[_0x50750f(0x1ea)][_0x50750f(0x270)](_0x4722bc),_0x50924b=new Map(),_0x5c8b68=new Map(),_0x1aa949=new Map(),_0x4b597a=new Map(),_0x2864f9=new Map(),_0x1526b7=new Map();for(const _0x13ed43 of _0x1fa399){_0x50924b[_0x50750f(0x1cb)](_0x13ed43['id'],_0x13ed43[_0x50750f(0x202)][_0x50750f(0x238)]);}for(const _0x5baf6b of _0x4e4ee1){_0x5c8b68['set'](_0x5baf6b['id'],_0x5baf6b['attributes']['name']);}for(const _0x250b8f of _0x5682ec){_0x1aa949[_0x50750f(0x1cb)](_0x250b8f['id'],_0x250b8f[_0x50750f(0x202)][_0x50750f(0x238)]);}for(const _0x3dc214 of _0x11fb48){_0x4b597a[_0x50750f(0x1cb)](_0x3dc214['id'],_0x3dc214[_0x50750f(0x202)][_0x50750f(0x238)]);}for(const _0x397960 of _0x3ffd48){_0x2864f9[_0x50750f(0x1cb)](_0x397960['id'],_0x397960[_0x50750f(0x202)][_0x50750f(0x238)]);}for(const _0x530f9e of _0x856485){_0x1526b7[_0x50750f(0x1cb)](_0x530f9e['id'],_0x530f9e[_0x50750f(0x202)][_0x50750f(0x238)]);}const _0x32ce62={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x50924b,'TextKnowledgeBase':_0x5c8b68,'Agent':_0x1aa949,'ExperimentalKnowledgeBase':_0x2864f9}),'resolvePromptName':async _0x40575b=>_0x4b597a[_0x50750f(0x26c)](_0x40575b),'onWarning':_0x67e72f=>this[_0x50750f(0x221)][_0x50750f(0x1ff)](_0x67e72f)};for(const _0x3fab5c of _0x5682ec){const _0x22e876=await agentResponseToDef(_0x3fab5c,_0x32ce62),{yaml:_0xa7b86a,systemPrompt:_0x57673f,starterMessage:_0x44d4cc}=_0x22e876;_0x473f34[_0x50750f(0x1c0)]({'name':_0xa7b86a['name'],'dir':'','yaml':_0xa7b86a,'systemPrompt':_0x57673f,'starterMessage':_0x44d4cc});}for(const _0x2018b3 of _0x1fa399){const _0x2e7267=apiKnowledgeBaseToYaml(_0x2018b3);_0x3e47e2[_0x50750f(0x1c0)]({'name':_0x2e7267[_0x50750f(0x238)],'path':'','yaml':_0x2e7267});}for(const _0x591742 of _0x4e4ee1){_0x120c7f[_0x50750f(0x1c0)]({'name':_0x591742[_0x50750f(0x202)][_0x50750f(0x238)],'path':'','text':_0x591742[_0x50750f(0x202)][_0x50750f(0x1cf)]});}for(const _0x439dd4 of _0x11fb48){const _0x4fc069=await apiPromptToYaml(_0x439dd4,_0x32ce62);_0x4fc069&&_0x2ac5da[_0x50750f(0x1c0)]({'name':_0x4fc069[_0x50750f(0x238)],'path':'','yaml':_0x4fc069});}for(const _0x157b69 of _0x42ebc5){if(!_0x157b69['attributes'][_0x50750f(0x1e5)]&&SAFE_INTEGRATION_TYPES['includes'](_0x157b69[_0x50750f(0x202)]['serviceType']['toLowerCase']())){const _0x176073=await apiIntegrationToYaml(_0x157b69,_0x32ce62);_0x2d142a['push']({'name':_0x157b69[_0x50750f(0x202)][_0x50750f(0x21b)][_0x50750f(0x22b)](),'path':'','yaml':_0x176073});}}for(const _0x3c2e91 of _0x3ffd48){const _0x54ebf4=apiExperimentalKnowledgeBaseToYaml(_0x3c2e91);_0x156ca0['push']({'name':_0x54ebf4['name'],'path':'','def':_0x54ebf4});}for(const _0x55c7f9 of _0x856485){const _0x1f22c8=apiExperimentalArtifactToYaml(_0x55c7f9);_0x10e1a8[_0x50750f(0x1c0)]({'name':_0x1f22c8[_0x50750f(0x238)],'path':'','def':_0x1f22c8});}}const _0x9de5eb={'sourceProjectName':_0x4a7843,'newProjectName':_0x51e1cf,'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}}},_0x37cab5=await this[_0x50750f(0x1ea)][_0x50750f(0x269)](),_0xe08d8c=_0x37cab5['find'](_0x1988bc=>_0x1988bc[_0x50750f(0x202)]['name']===_0x51e1cf);if(_0xe08d8c)throw new SDKError(ErrorCode[_0x50750f(0x1a3)],'Project\x20\x22'+_0x51e1cf+'\x22\x20already\x20exists',undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x1ef84e?.['dryRun'])return _0x9de5eb[_0x50750f(0x258)][_0x50750f(0x291)][_0x50750f(0x206)]=_0x473f34[_0x50750f(0x26f)],_0x9de5eb['counts'][_0x50750f(0x28c)][_0x50750f(0x206)]=_0x3e47e2[_0x50750f(0x26f)],_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x218)][_0x50750f(0x206)]=_0x120c7f[_0x50750f(0x26f)],_0x9de5eb['counts'][_0x50750f(0x19f)][_0x50750f(0x206)]=_0x156ca0[_0x50750f(0x26f)],_0x9de5eb['counts'][_0x50750f(0x29c)][_0x50750f(0x206)]=_0x10e1a8[_0x50750f(0x26f)],_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x296)][_0x50750f(0x206)]=_0x2ac5da[_0x50750f(0x26f)],_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x27a)]['created']=_0x2d142a[_0x50750f(0x26f)],_0x9de5eb;const _0x3b9aa0=await this[_0x50750f(0x1ea)][_0x50750f(0x223)]({'name':_0x51e1cf}),_0x36b30c=_0x3b9aa0['id'];_0x9de5eb[_0x50750f(0x278)]=_0x36b30c;const _0x22dfed=new Map(),_0x397fa4=new Map(),_0x25bed6=new Map(),_0x4bf6a8=new Map(),_0x42e02f=new Map(),_0x23acc1=new Map(),_0x4002c8=new Map(),_0xa024f5=new Map(),_0x5dd0ca=new Set(),_0x69c88d=new Set();for(const _0x5ef680 of _0x473f34){for(const _0x5abe15 of _0x5ef680[_0x50750f(0x1ee)][_0x50750f(0x199)]||[]){if(_0x5abe15[_0x50750f(0x1cc)]===_0x50750f(0x298)&&_0x5abe15[_0x50750f(0x224)]){const _0x15263f=parseRef(_0x5abe15[_0x50750f(0x224)]);if(_0x15263f)_0x5dd0ca['add'](_0x15263f[_0x50750f(0x238)]);}else{if(_0x5abe15[_0x50750f(0x1cc)]==='web_search'&&_0x5abe15['target']){const _0x4a4e5a=parseRef(_0x5abe15[_0x50750f(0x224)]);if(_0x4a4e5a)_0x69c88d[_0x50750f(0x286)](_0x4a4e5a[_0x50750f(0x238)]);}}}}for(const _0x237aae of _0x5dd0ca){try{const _0x2e8322=await this[_0x50750f(0x1ea)][_0x50750f(0x256)]({'projectId':_0x36b30c,'name':_0x237aae});_0x42e02f['set'](_0x237aae,_0x2e8322['id']),_0x9de5eb[_0x50750f(0x1e9)][_0x50750f(0x1c0)]({'name':_0x237aae,'action':_0x50750f(0x206),'id':_0x2e8322['id']}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x1e9)][_0x50750f(0x206)]++;}catch(_0x55bdf3){_0x9de5eb['imageGenerators'][_0x50750f(0x1c0)]({'name':_0x237aae,'action':'error','error':_0x55bdf3[_0x50750f(0x24a)]}),_0x9de5eb[_0x50750f(0x258)]['imageGenerators'][_0x50750f(0x1b8)]++;}}for(const _0x1337f5 of _0x69c88d){try{const _0x35cdff=await this[_0x50750f(0x1ea)][_0x50750f(0x2a0)]({'projectId':_0x36b30c,'name':_0x1337f5});_0x23acc1['set'](_0x1337f5,_0x35cdff['id']),_0x9de5eb[_0x50750f(0x229)]['push']({'name':_0x1337f5,'action':_0x50750f(0x206),'id':_0x35cdff['id']}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x229)]['created']++;}catch(_0xb0c954){_0x9de5eb['webSearchTools'][_0x50750f(0x1c0)]({'name':_0x1337f5,'action':_0x50750f(0x227),'error':_0xb0c954[_0x50750f(0x24a)]}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x229)][_0x50750f(0x1b8)]++;}}const _0xf06c63=await fetchAllToolTargetMaps((_0x3bfada,_0xf1681e)=>this[_0x50750f(0x1ea)][_0x50750f(0x297)](_0x3bfada,_0xf1681e),_0x36b30c);let _0xc8f1ba=[];const _0x23b25b={'projectId':_0x36b30c,'resolveToolTargetId':buildIdResolver({..._0xf06c63[_0x50750f(0x244)],'KnowledgeBase':_0x22dfed,'TextKnowledgeBase':_0x397fa4,'ExperimentalKnowledgeBase':_0x4002c8,'Agent':_0x25bed6,'WebSearchTool':_0x23acc1,'ImageGenerator':_0x42e02f}),'resolvePromptId':async _0xfbcc3e=>_0x4bf6a8['get'](_0xfbcc3e),'onWarning':_0x38c926=>{const _0x4af8a3=_0x50750f;this[_0x4af8a3(0x221)]['warn'](_0x38c926),_0xc8f1ba[_0x4af8a3(0x1c0)](_0x38c926);}};for(const _0x3f9f16 of _0x3e47e2){try{const _0x537e8d=yamlKnowledgeBaseToApi(_0x3f9f16['yaml'],_0x36b30c),_0x3fe26d=await this[_0x50750f(0x1ea)][_0x50750f(0x282)](_0x537e8d);_0x22dfed['set'](_0x3f9f16[_0x50750f(0x1ee)][_0x50750f(0x238)],_0x3fe26d['id']),_0x9de5eb[_0x50750f(0x28c)]['push']({'name':_0x3f9f16[_0x50750f(0x1ee)]['name'],'action':_0x50750f(0x206),'id':_0x3fe26d['id']}),_0x9de5eb['counts'][_0x50750f(0x28c)][_0x50750f(0x206)]++;}catch(_0x398195){_0x9de5eb[_0x50750f(0x28c)][_0x50750f(0x1c0)]({'name':_0x3f9f16[_0x50750f(0x1ee)][_0x50750f(0x238)],'action':_0x50750f(0x227),'error':_0x398195[_0x50750f(0x24a)]}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x28c)][_0x50750f(0x1b8)]++;}}for(const _0x3c9639 of _0x120c7f){try{const _0x14499c=yamlTextKnowledgeBaseToApi({'name':_0x3c9639[_0x50750f(0x238)],'text':_0x3c9639[_0x50750f(0x1cf)]},_0x36b30c),_0x553723=await this[_0x50750f(0x1ea)]['createTextKnowledgeBase'](_0x14499c);_0x397fa4[_0x50750f(0x1cb)](_0x3c9639[_0x50750f(0x238)],_0x553723['id']),_0x9de5eb[_0x50750f(0x218)][_0x50750f(0x1c0)]({'name':_0x3c9639[_0x50750f(0x238)],'action':_0x50750f(0x206),'id':_0x553723['id']}),_0x9de5eb['counts'][_0x50750f(0x218)][_0x50750f(0x206)]++;}catch(_0x4200ce){_0x9de5eb['textKnowledgeBases'][_0x50750f(0x1c0)]({'name':_0x3c9639[_0x50750f(0x238)],'action':_0x50750f(0x227),'error':_0x4200ce[_0x50750f(0x24a)]}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x218)][_0x50750f(0x1b8)]++;}}for(const _0x1935b0 of _0x10e1a8){try{const _0x112137=yamlExperimentalArtifactToApi(_0x1935b0['def'],_0x36b30c),_0x2b73e0=await this[_0x50750f(0x1ea)][_0x50750f(0x19c)](_0x112137);_0xa024f5['set'](_0x1935b0[_0x50750f(0x20d)][_0x50750f(0x238)],_0x2b73e0['id']),_0x9de5eb[_0x50750f(0x29c)][_0x50750f(0x1c0)]({'name':_0x1935b0['def'][_0x50750f(0x238)],'action':_0x50750f(0x206),'id':_0x2b73e0['id']}),_0x9de5eb[_0x50750f(0x258)]['experimentalArtifacts'][_0x50750f(0x206)]++;}catch(_0xa802e1){_0x9de5eb[_0x50750f(0x29c)]['push']({'name':_0x1935b0[_0x50750f(0x20d)][_0x50750f(0x238)],'action':_0x50750f(0x227),'error':_0xa802e1[_0x50750f(0x24a)]}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x29c)][_0x50750f(0x1b8)]++;}}for(const _0x473c99 of _0x156ca0){try{const _0x1ae1f9=yamlExperimentalKnowledgeBaseToApi(_0x473c99[_0x50750f(0x20d)],_0x36b30c),_0x328193=await this[_0x50750f(0x1ea)][_0x50750f(0x1e4)](_0x1ae1f9);_0x4002c8[_0x50750f(0x1cb)](_0x473c99[_0x50750f(0x20d)]['name'],_0x328193['id']),_0x9de5eb[_0x50750f(0x19f)][_0x50750f(0x1c0)]({'name':_0x473c99[_0x50750f(0x20d)][_0x50750f(0x238)],'action':'created','id':_0x328193['id']}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x19f)][_0x50750f(0x206)]++;}catch(_0xc8b678){_0x9de5eb[_0x50750f(0x19f)][_0x50750f(0x1c0)]({'name':_0x473c99[_0x50750f(0x20d)][_0x50750f(0x238)],'action':'error','error':_0xc8b678[_0x50750f(0x24a)]}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x19f)][_0x50750f(0x1b8)]++;}}const _0x2af1b2=[..._0x473f34][_0x50750f(0x245)]((_0x3640f2,_0xb16f46)=>{const _0x502431=_0x50750f,_0x455ee4=_0x3640f2['yaml']['tools']?.[_0x502431(0x276)](_0x120b41=>_0x120b41['type']==='agent')??![],_0x3c008d=_0xb16f46[_0x502431(0x1ee)][_0x502431(0x199)]?.[_0x502431(0x276)](_0x59a857=>_0x59a857[_0x502431(0x1cc)]==='agent')??![];if(_0x455ee4&&!_0x3c008d)return 0x1;if(!_0x455ee4&&_0x3c008d)return-0x1;return 0x0;});for(const _0x39741e of _0x2af1b2){_0xc8f1ba=[];try{const _0x3263bd=_0x39741e[_0x50750f(0x1ee)][_0x50750f(0x199)]?.[_0x50750f(0x1c8)](_0x5a72f6=>{const _0x4771d8=_0x50750f;if(_0x5a72f6[_0x4771d8(0x1cc)]===_0x4771d8(0x25c)&&_0x5a72f6['target']){const _0x46cf63=parseRef(_0x5a72f6[_0x4771d8(0x224)]);return _0x46cf63?.[_0x4771d8(0x238)]===_0x39741e[_0x4771d8(0x1ee)]['name'];}return![];})??[];if(_0x3263bd[_0x50750f(0x26f)]>0x0){const _0x2e0604=_0x50750f(0x196)+_0x39741e[_0x50750f(0x1ee)][_0x50750f(0x238)]+_0x50750f(0x207)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x50750f(0x221)][_0x50750f(0x1ff)](_0x2e0604),_0xc8f1ba[_0x50750f(0x1c0)](_0x2e0604);}const _0xe12047=await agentDefToRequest(_0x39741e[_0x50750f(0x1ee)],_0x39741e[_0x50750f(0x1e2)],_0x39741e[_0x50750f(0x213)],_0x23b25b),_0x2c0e8e=await this[_0x50750f(0x1ea)]['createAgentResponse'](_0xe12047);_0x25bed6[_0x50750f(0x1cb)](_0x39741e[_0x50750f(0x1ee)][_0x50750f(0x238)],_0x2c0e8e['id']),_0x9de5eb[_0x50750f(0x291)][_0x50750f(0x1c0)]({'agentName':_0x39741e[_0x50750f(0x1ee)][_0x50750f(0x238)],'action':_0x50750f(0x206),'agentId':_0x2c0e8e['id'],'warnings':_0xc8f1ba[_0x50750f(0x26f)]>0x0?_0xc8f1ba:undefined}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x291)]['created']++;}catch(_0x1c5be7){_0x9de5eb[_0x50750f(0x291)][_0x50750f(0x1c0)]({'agentName':_0x39741e[_0x50750f(0x1ee)][_0x50750f(0x238)],'action':_0x50750f(0x227),'error':_0x1c5be7['message'],'warnings':_0xc8f1ba[_0x50750f(0x26f)]>0x0?_0xc8f1ba:undefined}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x291)][_0x50750f(0x1b8)]++;}}for(const _0x50ab5f of _0x2ac5da){try{const _0x28a085=await yamlPromptToApi(_0x50ab5f[_0x50750f(0x1ee)],_0x36b30c,_0x23b25b);if(!_0x28a085){_0x9de5eb[_0x50750f(0x296)][_0x50750f(0x1c0)]({'name':_0x50ab5f[_0x50750f(0x1ee)]['name'],'action':'error','error':_0x50750f(0x220)}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x296)][_0x50750f(0x1b8)]++;continue;}const _0x254e7a=await this[_0x50750f(0x1ea)][_0x50750f(0x233)](_0x28a085);_0x4bf6a8[_0x50750f(0x1cb)](_0x50ab5f[_0x50750f(0x1ee)][_0x50750f(0x238)],_0x254e7a['id']),_0x9de5eb[_0x50750f(0x296)]['push']({'name':_0x50ab5f[_0x50750f(0x1ee)][_0x50750f(0x238)],'action':_0x50750f(0x206),'id':_0x254e7a['id']}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x296)][_0x50750f(0x206)]++;}catch(_0x4de401){_0x9de5eb[_0x50750f(0x296)][_0x50750f(0x1c0)]({'name':_0x50ab5f[_0x50750f(0x1ee)][_0x50750f(0x238)],'action':_0x50750f(0x227),'error':_0x4de401['message']}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x296)][_0x50750f(0x1b8)]++;}}for(const _0x3ed34d of _0x2d142a){try{const _0x435690=await yamlIntegrationToApi(_0x3ed34d['yaml'],_0x36b30c,_0x23b25b),_0x9fce69=await this[_0x50750f(0x1ea)]['createIntegration'](_0x435690);_0x9de5eb['integrations'][_0x50750f(0x1c0)]({'name':_0x3ed34d[_0x50750f(0x1ee)][_0x50750f(0x246)],'action':'created','id':_0x9fce69['id']}),_0x9de5eb[_0x50750f(0x258)][_0x50750f(0x27a)][_0x50750f(0x206)]++;}catch(_0x2cd444){_0x9de5eb['integrations'][_0x50750f(0x1c0)]({'name':_0x3ed34d[_0x50750f(0x1ee)][_0x50750f(0x246)],'action':_0x50750f(0x227),'error':_0x2cd444['message']}),_0x9de5eb[_0x50750f(0x258)]['integrations']['errors']++;}}return _0x9de5eb;}}
|