flujo-ai 3.48.7 → 3.48.9
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +64 -64
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +6 -6
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/approvals/[id]/route.js +1 -1
- package/.next/server/app/api/approvals/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/approvals/route.js +1 -1
- package/.next/server/app/api/approvals/route.js.nft.json +1 -1
- package/.next/server/app/api/automation-map/route.js +1 -1
- package/.next/server/app/api/automation-map/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/[voiceAction]/route.js +1 -1
- package/.next/server/app/api/avatar/[voiceAction]/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/connections/route.js +1 -1
- package/.next/server/app/api/avatar/connections/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/local-speech/route.js +1 -1
- package/.next/server/app/api/avatar/local-speech/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/remote/[voiceAction]/route.js +1 -1
- package/.next/server/app/api/avatar/remote/[voiceAction]/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/remote/availability/route.js +1 -1
- package/.next/server/app/api/avatar/remote/availability/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/voice/route.js +1 -1
- package/.next/server/app/api/avatar/voice/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/work-model/route.js +1 -1
- package/.next/server/app/api/avatar/work-model/route.js.nft.json +1 -1
- package/.next/server/app/api/avatar/world/route.js +1 -1
- package/.next/server/app/api/avatar/world/route.js.nft.json +1 -1
- package/.next/server/app/api/backup/route.js +1 -1
- package/.next/server/app/api/backup/route.js.nft.json +1 -1
- package/.next/server/app/api/browse/route.js +1 -1
- package/.next/server/app/api/browse/route.js.nft.json +1 -1
- package/.next/server/app/api/bugs/enhance/route.js +1 -1
- package/.next/server/app/api/bugs/enhance/route.js.nft.json +1 -1
- package/.next/server/app/api/credential-migration/route.js +1 -1
- package/.next/server/app/api/credential-migration/route.js.nft.json +1 -1
- package/.next/server/app/api/credential-transfer/restore/route.js +1 -1
- package/.next/server/app/api/credential-transfer/restore/route.js.nft.json +1 -1
- package/.next/server/app/api/credential-transfer/route.js +1 -1
- package/.next/server/app/api/credential-transfer/route.js.nft.json +1 -1
- package/.next/server/app/api/cwd/route.js +1 -1
- package/.next/server/app/api/cwd/route.js.nft.json +1 -1
- package/.next/server/app/api/encryption/secure/route.js +1 -1
- package/.next/server/app/api/encryption/secure/route.js.nft.json +1 -1
- package/.next/server/app/api/env/route.js +1 -1
- package/.next/server/app/api/env/route.js.nft.json +1 -1
- package/.next/server/app/api/factory-observatory/route.js +1 -1
- package/.next/server/app/api/factory-observatory/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/[id]/convert-process-to-subflow/route.js +1 -1
- package/.next/server/app/api/flow/[id]/convert-process-to-subflow/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/[id]/models/route.js +1 -1
- package/.next/server/app/api/flow/[id]/models/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/[id]/route.js +1 -1
- package/.next/server/app/api/flow/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/[id]/versions/[versionId]/route.js +1 -1
- package/.next/server/app/api/flow/[id]/versions/[versionId]/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/[id]/versions/route.js +1 -1
- package/.next/server/app/api/flow/[id]/versions/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/assist/route.js +1 -1
- package/.next/server/app/api/flow/assist/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/compile/route.js +1 -1
- package/.next/server/app/api/flow/compile/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/generate/route.js +1 -1
- package/.next/server/app/api/flow/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/generate/visual/route.js +1 -1
- package/.next/server/app/api/flow/generate/visual/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/generator/route.js +1 -1
- package/.next/server/app/api/flow/generator/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/improve/route.js +1 -1
- package/.next/server/app/api/flow/improve/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/model-agent/route.js +1 -1
- package/.next/server/app/api/flow/model-agent/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/prompt-renderer/route.js +1 -1
- package/.next/server/app/api/flow/prompt-renderer/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/quick-chat/route.js +1 -1
- package/.next/server/app/api/flow/quick-chat/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/repair/route.js +1 -1
- package/.next/server/app/api/flow/repair/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/route.js +1 -1
- package/.next/server/app/api/flow/route.js.nft.json +1 -1
- package/.next/server/app/api/git/route.js +1 -1
- package/.next/server/app/api/git/route.js.nft.json +1 -1
- package/.next/server/app/api/harness/[id]/route.js +1 -1
- package/.next/server/app/api/harness/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/harness/comparisons/[id]/route.js +1 -1
- package/.next/server/app/api/harness/comparisons/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/harness/comparisons/route.js +1 -1
- package/.next/server/app/api/harness/comparisons/route.js.nft.json +1 -1
- package/.next/server/app/api/harness/profiles/route.js +1 -1
- package/.next/server/app/api/harness/profiles/route.js.nft.json +1 -1
- package/.next/server/app/api/harness/route.js +1 -1
- package/.next/server/app/api/harness/route.js.nft.json +1 -1
- package/.next/server/app/api/init/route.js +1 -1
- package/.next/server/app/api/init/route.js.nft.json +1 -1
- package/.next/server/app/api/local-models/capability/route.js +1 -1
- package/.next/server/app/api/local-models/capability/route.js.nft.json +1 -1
- package/.next/server/app/api/local-models/pull/route.js +1 -1
- package/.next/server/app/api/local-models/pull/route.js.nft.json +1 -1
- package/.next/server/app/api/local-models/suggest/route.js +1 -1
- package/.next/server/app/api/local-models/suggest/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/app-consent/route.js +1 -1
- package/.next/server/app/api/mcp/app-consent/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/app-sandbox/route.js +1 -1
- package/.next/server/app/api/mcp/app-sandbox/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/assistant/route.js +1 -1
- package/.next/server/app/api/mcp/assistant/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/cancel/route.js +1 -1
- package/.next/server/app/api/mcp/cancel/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/authoring/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/authoring/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/automation/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/automation/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/flows/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/flows/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/resources/read/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/resources/read/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/resources/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/resources/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/servers/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/servers/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/skills/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/state/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/state/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/flujo/tools/route.js +1 -1
- package/.next/server/app/api/mcp/flujo/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/model-risk-assessment/route.js +1 -1
- package/.next/server/app/api/mcp/model-risk-assessment/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/oauth-capability/route.js +1 -1
- package/.next/server/app/api/mcp/oauth-capability/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/security-review/route.js +1 -1
- package/.next/server/app/api/mcp/security-review/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/host-consent/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/host-consent/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/get/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/get/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/read/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/read/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/approve/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/approve/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/get/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/get/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/load/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/load/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/status/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/status/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/stdio-oauth/confirm/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/stdio-oauth/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/stdio-oauth/start/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/stdio-oauth/start/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/stream/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/stream/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/route.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/route.js +1 -1
- package/.next/server/app/api/mcp/servers/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/test-connection/route.js +1 -1
- package/.next/server/app/api/mcp/test-connection/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/test-connection/stream/route.js +1 -1
- package/.next/server/app/api/mcp/test-connection/stream/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp-registry/route.js +1 -1
- package/.next/server/app/api/mcp-registry/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp-registry/spotlight/route.js +1 -1
- package/.next/server/app/api/mcp-registry/spotlight/route.js.nft.json +1 -1
- package/.next/server/app/api/model/[id]/route.js +1 -1
- package/.next/server/app/api/model/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/model/allowance/route.js +1 -1
- package/.next/server/app/api/model/allowance/route.js.nft.json +1 -1
- package/.next/server/app/api/model/provider/route.js +1 -1
- package/.next/server/app/api/model/provider/route.js.nft.json +1 -1
- package/.next/server/app/api/model/route.js +1 -1
- package/.next/server/app/api/model/route.js.nft.json +1 -1
- package/.next/server/app/api/model/test/route.js +1 -1
- package/.next/server/app/api/model/test/route.js.nft.json +1 -1
- package/.next/server/app/api/network-exposure/route.js +1 -1
- package/.next/server/app/api/network-exposure/route.js.nft.json +1 -1
- package/.next/server/app/api/oauth/callback/route.js +1 -1
- package/.next/server/app/api/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/oauth/initiate/route.js +1 -1
- package/.next/server/app/api/oauth/initiate/route.js.nft.json +1 -1
- package/.next/server/app/api/oauth/reset/route.js +1 -1
- package/.next/server/app/api/oauth/reset/route.js.nft.json +1 -1
- package/.next/server/app/api/operations/status/route.js +1 -1
- package/.next/server/app/api/operations/status/route.js.nft.json +1 -1
- package/.next/server/app/api/original-owner/route.js +1 -1
- package/.next/server/app/api/original-owner/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/build/route.js +1 -1
- package/.next/server/app/api/packages/build/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/derive-secrets/route.js +1 -1
- package/.next/server/app/api/packages/derive-secrets/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/install/route.js +1 -1
- package/.next/server/app/api/packages/install/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/install/status/route.js +1 -1
- package/.next/server/app/api/packages/install/status/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/installed/route.js +1 -1
- package/.next/server/app/api/packages/installed/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/resolve/route.js +1 -1
- package/.next/server/app/api/packages/resolve/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/scan-targets/route.js +1 -1
- package/.next/server/app/api/packages/scan-targets/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/search/route.js +1 -1
- package/.next/server/app/api/packages/search/route.js.nft.json +1 -1
- package/.next/server/app/api/packages/uninstall/route.js +1 -1
- package/.next/server/app/api/packages/uninstall/route.js.nft.json +1 -1
- package/.next/server/app/api/persona-recovery/route.js +2 -2
- package/.next/server/app/api/persona-recovery/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/[id]/route.js +1 -1
- package/.next/server/app/api/planned-executions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/[id]/run/route.js +1 -1
- package/.next/server/app/api/planned-executions/[id]/run/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/[id]/runs/route.js +1 -1
- package/.next/server/app/api/planned-executions/[id]/runs/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/[id]/worker-recovery/route.js +1 -1
- package/.next/server/app/api/planned-executions/[id]/worker-recovery/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/preview-schedule/route.js +1 -1
- package/.next/server/app/api/planned-executions/preview-schedule/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/reconcile/route.js +1 -1
- package/.next/server/app/api/planned-executions/reconcile/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/route.js +1 -1
- package/.next/server/app/api/planned-executions/route.js.nft.json +1 -1
- package/.next/server/app/api/projects/route.js +1 -1
- package/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/.next/server/app/api/reference-search/files/route.js +1 -1
- package/.next/server/app/api/reference-search/files/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/auth/resend/route.js +1 -1
- package/.next/server/app/api/registry/auth/resend/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/auth/reset/route.js +1 -1
- package/.next/server/app/api/registry/auth/reset/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/auth/route.js +1 -1
- package/.next/server/app/api/registry/auth/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/feedback/route.js +1 -1
- package/.next/server/app/api/registry/feedback/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/oauth/callback/route.js +1 -1
- package/.next/server/app/api/registry/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/oauth/initiate/route.js +1 -1
- package/.next/server/app/api/registry/oauth/initiate/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/packages/route.js +1 -1
- package/.next/server/app/api/registry/packages/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/publish/route.js +1 -1
- package/.next/server/app/api/registry/publish/route.js.nft.json +1 -1
- package/.next/server/app/api/registry/settings/route.js +1 -1
- package/.next/server/app/api/registry/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/restore/route.js +1 -1
- package/.next/server/app/api/restore/route.js.nft.json +1 -1
- package/.next/server/app/api/runs/active/route.js +1 -1
- package/.next/server/app/api/runs/active/route.js.nft.json +1 -1
- package/.next/server/app/api/runtime-environment/route.js +1 -1
- package/.next/server/app/api/runtime-environment/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/ai-cli/route.js +1 -1
- package/.next/server/app/api/setup/ai-cli/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshot/abort/route.js +1 -1
- package/.next/server/app/api/snapshot/abort/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshot/begin/route.js +1 -1
- package/.next/server/app/api/snapshot/begin/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshot/download/route.js +1 -1
- package/.next/server/app/api/snapshot/download/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshot/finalize/route.js +1 -1
- package/.next/server/app/api/snapshot/finalize/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshot/info/route.js +1 -1
- package/.next/server/app/api/snapshot/info/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshot/status/route.js +1 -1
- package/.next/server/app/api/snapshot/status/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshots/cleanup/route.js +1 -1
- package/.next/server/app/api/snapshots/cleanup/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshots/open-folder/route.js +1 -1
- package/.next/server/app/api/snapshots/open-folder/route.js.nft.json +1 -1
- package/.next/server/app/api/snapshots/route.js +1 -1
- package/.next/server/app/api/snapshots/route.js.nft.json +1 -1
- package/.next/server/app/api/statistics/route.js +1 -1
- package/.next/server/app/api/statistics/route.js.nft.json +1 -1
- package/.next/server/app/api/storage/route.js +1 -1
- package/.next/server/app/api/storage/route.js.nft.json +1 -1
- package/.next/server/app/api/telemetry/daily-active/route.js +1 -1
- package/.next/server/app/api/telemetry/daily-active/route.js.nft.json +1 -1
- package/.next/server/app/api/tickets/[id]/route.js +1 -1
- package/.next/server/app/api/tickets/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/tickets/route.js +1 -1
- package/.next/server/app/api/tickets/route.js.nft.json +1 -1
- package/.next/server/app/api/transcription/route.js +1 -1
- package/.next/server/app/api/transcription/route.js.nft.json +1 -1
- package/.next/server/app/api/update/route.js +1 -1
- package/.next/server/app/api/update/route.js.nft.json +1 -1
- package/.next/server/app/api/waves/route.js +1 -1
- package/.next/server/app/api/waves/route.js.nft.json +1 -1
- package/.next/server/app/api/webhooks/[id]/route.js +1 -1
- package/.next/server/app/api/webhooks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/workspaces/route.js +1 -1
- package/.next/server/app/api/workspaces/route.js.nft.json +1 -1
- package/.next/server/app/automation/triggers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/automation/waves/page_client-reference-manifest.js +1 -1
- package/.next/server/app/chain-chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/executions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/flows/page.js +1 -1
- package/.next/server/app/flows/page_client-reference-manifest.js +1 -1
- package/.next/server/app/harness/page_client-reference-manifest.js +1 -1
- package/.next/server/app/mcp/page.js +1 -1
- package/.next/server/app/mcp/page.js.nft.json +1 -1
- package/.next/server/app/mcp/page_client-reference-manifest.js +1 -1
- package/.next/server/app/mcp-flows/route.js +1 -1
- package/.next/server/app/mcp-flows/route.js.nft.json +1 -1
- package/.next/server/app/mcp-proxy/[server]/route.js +1 -1
- package/.next/server/app/mcp-proxy/[server]/route.js.nft.json +1 -1
- package/.next/server/app/meetings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/models/page.js +1 -1
- package/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/.next/server/app/owner/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/packages/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas/[personaId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roles/[roleId]/edit/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roles/[roleId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roles/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roles/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js +1 -1
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/statistics/page_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/completions/route.js +1 -1
- package/.next/server/app/v1/chat/completions/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversation-chains/route.js +1 -1
- package/.next/server/app/v1/chat/conversation-chains/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/attach/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/attach/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/state/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/state/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/inject/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/inject/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/model-turns/[dispatchId]/media/[mediaId]/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/model-turns/[dispatchId]/media/[mediaId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/model-turns/[dispatchId]/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/model-turns/[dispatchId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/model-turns/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/model-turns/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/recovery/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/recovery/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/resources/[resourceId]/content/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/revert/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/revert/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/wire-preview/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/wire-preview/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/events/route.js +1 -1
- package/.next/server/app/v1/chat/events/route.js.nft.json +1 -1
- package/.next/server/app/v1/flows/[flowRef]/readiness/route.js +1 -1
- package/.next/server/app/v1/flows/[flowRef]/readiness/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/cancel/route.js +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/cancel/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/events/route.js +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/events/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/interventions/route.js +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/interventions/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/private-notes/route.js +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/private-notes/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/resume/route.js +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/resume/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/route.js +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/start/route.js +1 -1
- package/.next/server/app/v1/meetings/[meetingId]/start/route.js.nft.json +1 -1
- package/.next/server/app/v1/meetings/route.js +1 -1
- package/.next/server/app/v1/meetings/route.js.nft.json +1 -1
- package/.next/server/app/v1/models/route.js +1 -1
- package/.next/server/app/v1/models/route.js.nft.json +1 -1
- package/.next/server/app/v1/persona-drafts/[draftId]/route.js +1 -1
- package/.next/server/app/v1/persona-drafts/[draftId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/persona-drafts/route.js +1 -1
- package/.next/server/app/v1/persona-drafts/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/app-grants/[grantId]/launch/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/app-grants/[grantId]/launch/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/app-grants/[grantId]/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/app-grants/[grantId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/app-grants/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/app-grants/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/behaviors/[behaviorId]/activate/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/behaviors/[behaviorId]/activate/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/composition/behaviors/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/composition/behaviors/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/composition/copy/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/composition/copy/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/composition/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/composition/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/core/reconcile/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/core/reconcile/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/deletion-preview/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/deletion-preview/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/execution-preview/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/execution-preview/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/export/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/export/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/export-preview/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/export-preview/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/goal-admissions/[admissionKey]/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/goal-admissions/[admissionKey]/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/apply/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/apply/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/promote/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/promote/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/reject/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/reject/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/undo/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/[proposalId]/undo/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/improvements/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/activate/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/activate/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/correct/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/correct/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/pin/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/pin/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/resolve-conflict/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/resolve-conflict/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/[memoryId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/memories/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/runtime-recovery/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/runtime-recovery/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/storage-stats/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/storage-stats/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/assign/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/assign/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/control/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/control/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/runtime/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/runtime/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/source/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/[workItemId]/source/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/promote-todo/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/promote-todo/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/route.js +1 -1
- package/.next/server/app/v1/personas/[personaId]/work-items/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/readiness/route.js +1 -1
- package/.next/server/app/v1/personas/readiness/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/route.js +1 -1
- package/.next/server/app/v1/personas/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/settings-options/route.js +1 -1
- package/.next/server/app/v1/personas/settings-options/route.js.nft.json +1 -1
- package/.next/server/app/v1/personas/summary/route.js +1 -1
- package/.next/server/app/v1/personas/summary/route.js.nft.json +1 -1
- package/.next/server/app/v1/roles/[roleId]/duplicate/route.js +1 -1
- package/.next/server/app/v1/roles/[roleId]/duplicate/route.js.nft.json +1 -1
- package/.next/server/app/v1/roles/[roleId]/impact/route.js +1 -1
- package/.next/server/app/v1/roles/[roleId]/impact/route.js.nft.json +1 -1
- package/.next/server/app/v1/roles/[roleId]/restore/route.js +1 -1
- package/.next/server/app/v1/roles/[roleId]/restore/route.js.nft.json +1 -1
- package/.next/server/app/v1/roles/[roleId]/rollback/route.js +1 -1
- package/.next/server/app/v1/roles/[roleId]/rollback/route.js.nft.json +1 -1
- package/.next/server/app/v1/roles/[roleId]/route.js +1 -1
- package/.next/server/app/v1/roles/[roleId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/roles/[roleId]/versions/route.js +1 -1
- package/.next/server/app/v1/roles/[roleId]/versions/route.js.nft.json +1 -1
- package/.next/server/app/v1/roles/route.js +1 -1
- package/.next/server/app/v1/roles/route.js.nft.json +1 -1
- package/.next/server/app/v1/tasks/[taskId]/route.js +1 -1
- package/.next/server/app/v1/tasks/[taskId]/route.js.nft.json +1 -1
- package/.next/server/app/waves/page_client-reference-manifest.js +1 -1
- package/.next/server/app/world/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +64 -64
- package/.next/server/chunks/14130.js +1 -1
- package/.next/server/chunks/21392.js +4 -4
- package/.next/server/chunks/23167.js +1 -1
- package/.next/server/chunks/30775.js +1 -1
- package/.next/server/chunks/31519.js +2 -2
- package/.next/server/chunks/40309.js +2 -2
- package/.next/server/chunks/42265.js +2 -2
- package/.next/server/chunks/50037.js +5 -5
- package/.next/server/chunks/52152.js +2 -2
- package/.next/server/chunks/{87864.js → 55131.js} +3 -3
- package/.next/server/chunks/57085.js +1 -1
- package/.next/server/chunks/63192.js +1 -1
- package/.next/server/chunks/6918.js +57 -0
- package/.next/server/chunks/73633.js +1 -1
- package/.next/server/chunks/74050.js +1 -1
- package/.next/server/chunks/81306.js +1 -1
- package/.next/server/chunks/82300.js +2 -2
- package/.next/server/chunks/83718.js +1 -1
- package/.next/server/chunks/87068.js +1 -1
- package/.next/server/chunks/88166.js +6 -6
- package/.next/server/chunks/91784.js +3 -3
- package/.next/server/chunks/97235.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{2103-be5e06316fbab625.js → 2103-a2a033be82bccfe4.js} +1 -1
- package/.next/static/chunks/{3408-ebc71c2ba2319e02.js → 3408-9d2ecf51682e91da.js} +1 -1
- package/.next/static/chunks/{9894-e6417b3e75acff9c.js → 9894-887d64501678548c.js} +1 -1
- package/.next/static/chunks/app/flows/{page-d0c105087f290066.js → page-4f74e0f3a484d79e.js} +1 -1
- package/.next/static/chunks/app/mcp/{page-87156cd622778948.js → page-7ab00612e16d4856.js} +1 -1
- package/.next/static/chunks/app/models/{page-15ee06d5eae04ad4.js → page-a903d7263ea83c48.js} +1 -1
- package/.next/static/chunks/webpack-2142350dbdcdd63f.js +1 -0
- package/.next/trace-build +1 -1
- package/README.md +1 -1
- package/mcp-servers/bash/package.json +1 -1
- package/mcp-servers/browser/package.json +1 -1
- package/mcp-servers/filesystem/package.json +1 -1
- package/mcp-servers/flujo/package.json +1 -1
- package/package.json +5 -5
- package/.next/server/chunks/25847.js +0 -57
- package/.next/static/chunks/webpack-1449ea081feba501.js +0 -1
- /package/.next/static/{dA-lF06zcBoG4LavbX9MD → SvhW20J5JfD4vxqWvChXP}/_buildManifest.js +0 -0
- /package/.next/static/{dA-lF06zcBoG4LavbX9MD → SvhW20J5JfD4vxqWvChXP}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2103],{22103:(e,t,r)=>{r.d(t,{uJ:()=>U,Ay:()=>Z,Yw:()=>F});var n=r(95155),i=r(12115),o=r(28683),s=r(52673),l=r(4550),a=r(37911),c=r(99306),u=r(89009),d=r(9098),h=r(70668),p=r(32038),f=r(42108),m=r(39734),w=r(88078),g=r(73254),y=r(98598),x=r(32635),b=r(6255),v=r(6310),A=r(80967),C=r(97312);function E(e){return null===e||"object"!=typeof e||Array.isArray(e)?void 0:e}var R=r(16803);let j=e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e;function S(e){return"string"==typeof e&&e.length>0&&e.length<=512&&e.trim()===e}var M=r(16007),k=r(49103),P=r(77586);let T=(0,k.h)("frontend/components/Chat/McpAppFrame"),$={name:"FLUJO",version:"3.48.7"},L=new Set(["https:","http:"]),z=["inline","fullscreen","pip"],H=new Set(["text"]),U=262144,I=e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e,D=e=>{let t=I(e);return t?.type==="text"&&"string"==typeof t.text};function F(e){try{return new TextEncoder().encode(JSON.stringify(e)).length}catch{return 1/0}}let N=new Map;function W(e,t,r,n){return JSON.stringify([e,t,r,n??null])}async function O(e,t,r){let n=(0,M.dJ)(),i=W(n,e,t,r);if(!N.has(i)){let o=new URLSearchParams;o.set("serverName",e),o.set("uri",t),r&&o.set("conversationId",r);let s=fetch((0,M.TA)(`/api/mcp/app-sandbox${o.toString()?`?${o}`:""}`,n)).then(async e=>{if(!e.ok){let t="";try{let r=await e.json();"string"==typeof r.error&&r.error.trim()&&(t=`: ${r.error.trim()}`)}catch{}throw Error(`Sandbox endpoint discovery failed (${e.status})${t}`)}return await e.json()}).catch(e=>{throw N.delete(i),e});N.set(i,s)}let o=await N.get(i);return{href:function(e,t){let r;if("boolean"!=typeof e.shared)throw Error("Sandbox endpoint discovery did not describe its origin mode");if(!function(e){if("string"!=typeof e)return!1;let t=e.trim();if(0===t.length||t.length>253||t!==e||t!==t.toLowerCase()||/[^\w.-]|[^\x00-\x7f]/i.test(t)||/^\d+(\.\d+)*$/.test(t)||t.includes(":")||/[/?#@]/.test(t))return!1;let r=t.split(".");return!(0===r.length||r.some(e=>0===e.length))&&r.every(e=>e.length<=63&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e))}(e.originKey))throw Error("Sandbox endpoint discovery returned an invalid origin key");if("string"!=typeof e.token||0===e.token.length)throw Error("Sandbox endpoint discovery returned invalid credentials");if("string"!=typeof e.url)throw Error("Sandbox endpoint discovery did not return an isolated app URL");try{r=new URL(e.url)}catch{throw Error("Sandbox endpoint discovery returned an invalid public URL")}if("http:"!==r.protocol&&"https:"!==r.protocol||r.username||r.password)throw Error("Sandbox public URL must be an absolute HTTP(S) URL without credentials");if("https:"===t.protocol&&"https:"!==r.protocol)throw Error("HTTPS FLUJO deployments require an HTTPS MCP Apps sandbox URL");if(e.shared){if(r.searchParams.get("originKey")!==e.originKey)throw Error("Shared sandbox URL is not bound to the verified app origin key")}else if(!r.hostname.split(".").includes(e.originKey))throw Error("Sandbox URL is not bound to the verified app origin key");if(r.origin===t.origin)throw Error("MCP Apps sandbox must use a distinct origin from FLUJO");return r.searchParams.set("token",e.token),r.href}(o,window.location),allowAll:!0===o.allowAll}}function B(e,t,r=!1,n=!1){let i=e=>{let r=/^(https|wss):\/\/(\*\.)?([^/:?#]+)(?::(\d{1,5}))?$/i.exec(e);if(!r||!t.includes(r[1].toLowerCase()))return!1;let n=r[3].split(".");if(r[3].length>253||n.some(e=>0===e.length||e.length>63||!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(e)))return!1;let i=r[4]?Number(r[4]):void 0;return void 0===i||Number.isInteger(i)&&i>=1&&i<=65535},o=[],s=new Set;for(let l of e??[]){if(0===l.length||l.length>2048||/[^\x21-\x7e]/.test(l))continue;if("*"===l){if(n)return["*"];continue}let e=r?(0,R._w)(l,t.includes("wss")?["http","ws"]:["http"]):void 0;if(!e&&!i(l))continue;let a=e??l,c=a.toLowerCase();if(!s.has(c)&&(s.add(c),o.push(a),o.length>=64))break}return o}function J(e=window.location){return!!e&&"http:"===e.protocol}function _(e,t=J(),r=!1){return{connectDomains:B(e.connectDomains,["https","wss"],t,r),resourceDomains:B(e.resourceDomains,["https"],t,r),frameDomains:B(e.frameDomains,["https"],t,r),baseUriDomains:B(e.baseUriDomains,["https"],t,r)}}function q(e){if(e)try{return JSON.parse(e)}catch{return}}async function K(e,t,r,n,i){let o;if(await e.sendToolInput({arguments:(o=q(t))&&"object"==typeof o&&!Array.isArray(o)?o:{}}),void 0!==n)return void await e.sendToolCancelled({reason:n});let s=function(e,t){if(void 0===e)return!0===t?{content:[],isError:!0}:null;let r=b.TFo.safeParse(q(e));return r.success?{...r.data,...!0===t?{isError:!0}:{}}:{content:[{type:"text",text:e}],...!0===t?{isError:!0}:{}}}(r,i);s&&await e.sendToolResult(s)}function Y(e,t,r){return t.includes(e)&&r.includes(e)}function X(e,t,r,n,i,o){let s=void 0===t?`${r??""}\0${n??""}\0${i??""}\0${o??""}`:`${typeof t}:${String(t)}`;return`${e??""}\0${s}`}function V(e,t){let r=e.getBoundingClientRect(),n=Math.max(1,Math.round(r.width||e.clientWidth||1));return t?{width:n,height:Math.max(1,Math.round(r.height||e.clientHeight||1))}:{width:n,maxHeight:6e3}}async function G(e,t,r){try{let n=await C.S.listServerTools(e),i=Array.isArray(n.tools)?n.tools:[],o=r?i.find(e=>e?.name===r):i.find(e=>(0,R.Gt)(e?._meta)===t);if(o?.name&&o?.inputSchema&&(0,R.Gt)(o._meta)===t)return{tool:o}}catch(e){T.debug("Could not resolve the full MCP App tool definition",e)}}let Z=({conversationId:e,ownerScopeId:t,serverName:r,uri:b,toolName:k,toolArgs:B,toolResultContent:q,toolOwnerScope:Z,toolUpdateId:Q,toolCancelledReason:ee,toolIsError:et,onAppMessage:er,onUpdateModelContext:en,onRequestDock:ei,onDockable:eo,onAvailableDisplayModes:es,hostDisplayMode:el,onRequestDisplayMode:ea,onRequestClose:ec,onRegisterTeardown:eu,teardownRegistrationKey:ed,docked:eh=!1,visible:ep=!0,defaultExpanded:ef=!1,autoDock:em=!1,linkedToolCallCount:ew=1,onUserOpen:eg})=>{let{t:ey}=(0,v.s9)(),{settings:ex,settingsHydrated:eb}=(0,A.useStorage)(),ev=!1!==eb,eA=ex?.experimental?.requireMcpAppLaunchClick===!0,eC=(0,o.A)(),eE=(0,i.useId)(),eR=(0,i.useMemo)(()=>{var n;let i;return(i=S((n={toolOwnerScope:Z,toolResultContent:q,conversationId:e,ownerScopeId:t,serverName:r,uri:b,frameInstanceId:eE}).toolOwnerScope)?n.toolOwnerScope:function(e){if(void 0!==e)try{let t="string"==typeof e?JSON.parse(e):e,r=j(j(t)?._meta),n=r?.["io.flujo/host-owner-scope"];return S(n)?n:void 0}catch{return}}(n.toolResultContent))||(n.conversationId?`conversation:${n.conversationId}`:n.ownerScopeId?.trim()?`app:${n.ownerScopeId.trim().slice(0,500)}`:`app:${n.serverName}:${n.uri}:${n.frameInstanceId}`)},[e,eE,t,r,Z,q,b]),[ej,eS]=(0,i.useState)(ef),[eM,ek]=(0,i.useState)(!1),[eP,eT]=(0,i.useState)(null),[e$,eL]=(0,i.useState)(ev&&!eA?"granted":"loading"),[ez,eH]=(0,i.useState)(!1),[eU,eI]=(0,i.useState)(null),eD=(0,i.useRef)(!1);eD.current=ev&&("internal"===e$||"granted"===e$)&&(eh||ej);let eF=(0,i.useRef)(null);(0,i.useEffect)(()=>{eF.current=eP},[eP]),(0,i.useEffect)(()=>{if(!ev)return void eL("loading");if(!eA){eL("granted"),eI(null);return}let t=!0;eL("loading");let n=new URLSearchParams({serverName:r,uri:b});return e&&n.set("conversationId",e),fetch(`/api/mcp/app-consent?${n}`).then(async e=>e.ok?e.json():Promise.reject(Error("Consent lookup failed"))).then(e=>{t&&["internal","granted","prompt","denied"].includes(e.status??"")&&eL(e.status)}).catch(()=>{t&&eL("denied")}),()=>{t=!1}},[ev,eA,e,r,b]);let eN=(0,i.useCallback)(async t=>{eH(!0),eI(null);try{let n=await fetch("/api/mcp/app-consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverName:r,uri:b,conversationId:e,decision:t})});if(!n.ok)throw Error("Unable to save MCP App consent");let i=await n.json();eL("granted"===i.status?"granted":"denied")}catch{eI(ey("chat.app.consentSaveFailed"))}finally{eH(!1)}},[e,r,ey,b]),eW=(0,i.useCallback)(async()=>{eH(!0),eI(null);try{let e=new URLSearchParams({serverName:r,uri:b});if(!(await fetch(`/api/mcp/app-consent?${e}`,{method:"DELETE"})).ok)throw Error("Unable to reset MCP App consent");eL("prompt")}catch{eI(ey("chat.app.consentSaveFailed"))}finally{eH(!1)}},[r,ey,b]),[eO,eB]=(0,i.useState)(eh?"pip":"inline"),[eJ,e_]=(0,i.useState)(null),[eq,eK]=(0,i.useState)([]),[eY,eX]=(0,i.useState)(!1),eV=(0,i.useRef)(ef),{activeCursor:eG,startPointerDrag:eZ}=(0,P.LI)(),eQ=el??eO,e0=(0,i.useMemo)(()=>eh?["pip","fullscreen"]:["inline","fullscreen",...ei?["pip"]:[]],[eh,ei]),e1=(0,i.useRef)(null),e3=(0,i.useRef)(null),e2=(0,i.useRef)(null),e4=(0,i.useRef)(200),e6=(0,i.useRef)(null),e8=(0,i.useRef)(!1),e5=(0,i.useRef)(0),e9=(0,i.useRef)(!1),e7=(0,i.useRef)(null),te=(0,i.useRef)(null),tt=(0,i.useRef)(!1),tr=(0,i.useRef)(!0),tn=(0,i.useRef)([]),ti=(0,i.useRef)(eQ),to=(0,i.useRef)(e0),ts=(0,i.useRef)(k),tl=(0,i.useRef)(k),ta=(0,i.useRef)(eR),tc=(0,i.useRef)(eR);ta.current=eR;let tu=(0,i.useRef)(Promise.resolve()),td=(0,i.useRef)(void 0),th=(0,i.useRef)({toolName:k,args:B,resultContent:q,cancelledReason:ee,isError:et,updateId:Q});(0,i.useEffect)(()=>{eh||"fullscreen"!==eQ||e_(e=>{if(e)return e;let t=Math.min(Math.max(520,Math.round(.86*window.innerWidth)),window.innerWidth-24),r=Math.min(Math.max(360,Math.round(.84*window.innerHeight)),window.innerHeight-24);return{x:Math.round((window.innerWidth-t)/2),y:Math.round((window.innerHeight-r)/2),width:t,height:r}})},[eh,eQ]),(0,i.useEffect)(()=>{if(eh||"fullscreen"!==eQ)return;let e=()=>{let e={width:Math.min(480,window.innerWidth),height:Math.min(320,window.innerHeight)};e_(t=>t?(0,P.eH)(t,{width:window.innerWidth,height:window.innerHeight},e):t)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[eh,eQ]);let tp=(0,i.useCallback)(e=>{if("fullscreen"!==eQ||!e3.current||e.target.closest('button,[role="button"]'))return;e.preventDefault();let t=e3.current.getBoundingClientRect(),r=e.clientX,n=e.clientY;eZ(e,"move",e=>{e_({...(0,P.RA)({x:t.left+e.clientX-r,y:t.top+e.clientY-n},{width:t.width,height:t.height},{width:window.innerWidth,height:window.innerHeight}),width:t.width,height:t.height})})},[eQ,eZ]),tf=(0,i.useCallback)((e,t,r)=>{if("fullscreen"!==eQ||!e3.current)return;let n=e3.current.getBoundingClientRect(),i={x:n.left,y:n.top,width:n.width,height:n.height},o=e.clientX,s=e.clientY;eZ(e,r,e=>{e_((0,P.hU)(i,t,e.clientX-o,e.clientY-s,{width:window.innerWidth,height:window.innerHeight},{width:Math.min(480,window.innerWidth),height:Math.min(320,window.innerHeight)}))})},[eQ,eZ]),tm=(0,P.ri)(e3,"fullscreen"===eO&&!eh);th.current={toolName:k,args:B,resultContent:q,cancelledReason:ee,isError:et,updateId:Q},ts.current=k;let tw=(0,i.useRef)(er);(0,i.useEffect)(()=>{tw.current=er},[er]);let tg=(0,i.useRef)(en);(0,i.useEffect)(()=>{tg.current=en},[en]);let ty=(0,i.useRef)(ei);(0,i.useEffect)(()=>{ty.current=ei},[ei]);let tx=(0,i.useRef)(em);(0,i.useEffect)(()=>{em&&(tx.current=!0)},[em]);let tb=(0,i.useRef)(eo);(0,i.useEffect)(()=>{tb.current=eo},[eo]);let tv=(0,i.useRef)(es);(0,i.useEffect)(()=>{tv.current=es},[es]);let tA=(0,i.useRef)(ea);(0,i.useEffect)(()=>{tA.current=ea},[ea]);let tC=(0,i.useRef)(ec);(0,i.useEffect)(()=>{tC.current=ec},[ec]);let tE=(0,i.useRef)(eh);(0,i.useEffect)(()=>{tE.current=eh},[eh]),(0,i.useEffect)(()=>{ti.current=eQ},[eQ]),(0,i.useEffect)(()=>{to.current=e0},[e0]);let tR=(0,i.useCallback)(()=>{if(te.current)return te.current;e5.current+=1;let e=e6.current,t=e2.current,r=e9.current;e6.current=null,e2.current=null,e9.current=!1,e8.current=!1,tn.current=[],e7.current?.disconnect(),e7.current=null;let n=(async()=>{if(e&&r){let t;try{await Promise.race([e.teardownResource({},{timeout:1e3}),new Promise(e=>{t=setTimeout(e,1e3)})])}catch(e){T.debug("MCP App did not acknowledge resource teardown",e)}finally{t&&clearTimeout(t)}}try{await e?.close()}catch{}t?.remove()})();return te.current=n,n.finally(()=>{te.current===n&&(te.current=null)}),n},[]),tj=(0,i.useCallback)(()=>{tt.current||!ty.current||eF.current||(tt.current=!0,tR().then(()=>{tr.current&&(ty.current?.(),eS(!1))}).finally(()=>{tt.current=!1}))},[tR]),tS=(0,i.useCallback)((e,t,r,n,i)=>{tu.current=tu.current.catch(()=>void 0).then(async()=>{e6.current===e&&e9.current&&await K(e,t,r,n,i)}).catch(e=>{T.warn("MCP App tool delivery failed",e)})},[]),tM=(0,i.useCallback)(async()=>{if(te.current&&await te.current,e8.current||!e1.current)return;let t=e5.current+1;e5.current=t;let n=()=>e5.current===t&&e8.current;e8.current=!0,eK([]),ek(!0),eT(null);try{var i,o,s,l,a,c;let u,d,[h,p]=await Promise.all([C.S.readResourceFromApp(r,b),G(r,b,ts.current)]);if(!n())return;if(h?.httpStatus===403)throw Error(h?.error||ey("chat.app.accessDisabled"));if(!h||!1===h.success)throw Error(h?.error||ey("chat.app.readFailed"));let f=function(e,t){let r,n=e?.contents;if(!Array.isArray(n)||0===n.length)throw Error("Resource has no contents");let i=n.find(e=>e.uri===t&&"string"==typeof e.mimeType&&(0,R.q$)(e.mimeType)&&("string"==typeof e.text||"string"==typeof e.blob));if(!i)throw Error(`Resource ${t} did not return MCP App HTML`);try{if("string"==typeof i.text)r=i.text;else if("string"==typeof i.blob){var o;let e;o=i.blob,e=Uint8Array.from(atob(o),e=>e.charCodeAt(0)),r=new TextDecoder("utf-8",{fatal:!0}).decode(e)}else throw Error("Missing app resource body")}catch{throw Error(`Resource ${t} contains invalid base64 UTF-8 HTML`)}if(new TextEncoder().encode(r).length>R.Pt)throw Error(`Resource exceeds the ${Math.round(R.Pt/1024)} KiB size cap`);let s=I(i._meta??i.meta),l=I(s?.ui),a=x.c0.safeParse(l?.csp);if(l?.csp!==void 0&&!a.success)throw Error(`Resource ${t} declares an invalid CSP policy`);let c=x.Ml.safeParse(l?.permissions);if(l?.permissions!==void 0&&!c.success)throw Error(`Resource ${t} declares invalid sandbox permissions`);return{html:r,csp:a.success?_(a.data):void 0,rawCsp:a.success?a.data:void 0,permissions:c.success&&c.data.clipboardWrite?{clipboardWrite:{}}:void 0,prefersBorder:"boolean"==typeof l?.prefersBorder?l.prefersBorder:void 0}}(h.data,b);eX(!1===f.prefersBorder);let m=await O(r,b,e);if(!n()||!e1.current)return;m.allowAll&&f.rawCsp&&(f.csp=_(f.rawCsp,J(),!0));let w=document.createElement("iframe");w.title=ey("chat.app.frameTitle",{uri:b}),w.setAttribute("sandbox","allow-scripts allow-same-origin"),w.referrerPolicy="origin";let g=(0,x.Sy)(f.permissions);g&&w.setAttribute("allow",g);let y=!1===f.prefersBorder?"transparent":"#fff";w.style.cssText=tE.current||"fullscreen"===ti.current?`width:100%;height:100%;border:none;background:${y};`:`width:100%;min-height:120px;height:200px;border:none;background:${y};`+(!1===f.prefersBorder?"":"border-radius:4px;"),e1.current.appendChild(w),e2.current=w;let v=new URL(m.href);f.csp&&v.searchParams.set("csp",JSON.stringify(f.csp));let A=v.origin,j=new Promise((e,t)=>{let r=setTimeout(()=>{window.removeEventListener("message",n),t(Error(ey("chat.app.proxyTimeout")))},1e4),n=t=>{t.source===w.contentWindow&&t.origin===A&&t.data?.jsonrpc==="2.0"&&t.data?.method==="ui/notifications/sandbox-proxy-ready"&&(clearTimeout(r),window.removeEventListener("message",n),e())};window.addEventListener("message",n)});if(w.src=v.href,await j,!n()||e2.current!==w)return;let S=ti.current,M="inline";ti.current=M;let k=new x.T1((i=ta.current,o=e=>{e5.current===t&&e6.current===k&&(eT(e),ek(!1),tR().finally(()=>{tE.current&&tC.current?.()}))},s=C.S,l=e=>T.info(`MCP App tools/call: ${r}/${e}`),{getServerCapabilities:()=>({tools:{},resources:{}}),setNotificationHandler:()=>{},request:async(e,t)=>{let{method:n,params:a}=e;if("tools/call"===n){let e=E(a),n="string"==typeof e?.name?e.name:void 0;if(!n)throw Error("MCP App tool call is missing a tool name");l?.(n);let c=await s.callToolFromApp(r,n,E(e?.arguments)??{},void 0,t?.signal,i);if(c?.httpStatus===403){let e=c.error||"MCP Apps access was disabled for this server";throw o(e),Error(e)}if(!c||!1===c.success)throw Error(c?.error||`Tool call failed: ${n}`);return c.data}if("resources/read"===n){let e=E(a),n="string"==typeof e?.uri?e.uri:void 0;if(!n)throw Error("MCP App resource read is missing a URI");let i=await s.readResourceFromApp(r,n,t?.signal);if(i?.httpStatus===403){let e=i.error||"MCP Apps access was disabled for this server";throw o(e),Error(e)}if(!i||!1===i.success)throw Error(i?.error||`Resource read failed: ${n}`);return i.data}if("resources/list"===n)return{resources:[]};if("resources/templates/list"===n)return{resourceTemplates:[]};throw Error(`MCP App requested unsupported method: ${n}`)}}),$,{openLinks:{},serverTools:{},serverResources:{},logging:{},...tw.current?{message:{text:{}}}:{},...tg.current?{updateModelContext:{text:{},structuredContent:{}}}:{},sandbox:{csp:f.csp,permissions:f.permissions}},{hostContext:{...p?{toolInfo:p}:{},theme:"dark"===eC.palette.mode?"dark":"light",platform:"web",displayMode:M,availableDisplayModes:to.current,containerDimensions:V(e1.current,tE.current),locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,userAgent:navigator.userAgent,deviceCapabilities:{touch:navigator.maxTouchPoints>0,hover:window.matchMedia?.("(hover: hover)").matches??!1}}});e6.current=k;let P=()=>n()&&e6.current===k;if(k.onopenlink=async({url:e})=>{if(!P())return{isError:!0};let t=function(e){try{let t=new URL(e);if(!L.has(t.protocol)||t.username||t.password)return null;return t.href}catch{return null}}(e);if(!t)return T.warn("MCP App open-link rejected by URL policy",{serverName:r,uri:b}),{isError:!0};let n=window.open(t,"_blank","noopener,noreferrer");return n&&(n.opener=null),{}},k.ondownloadfile=async({contents:e})=>{if(!P())return{isError:!0};try{for(let t of e??[]){let e,r=I(I(t)?.resource);if(!r)continue;let n=("string"==typeof r.uri?r.uri.split("/").pop():"")||"download",i="string"==typeof r.mimeType?r.mimeType:"application/octet-stream";if("string"==typeof r.blob){let t=Uint8Array.from(atob(r.blob),e=>e.charCodeAt(0));e=new Blob([t],{type:i})}else e=new Blob([String(r.text??"")],{type:i});let o=URL.createObjectURL(e),s=document.createElement("a");s.href=o,s.download=n,document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(o),4e3)}return{}}catch(e){return T.warn("MCP App download failed",e),{isError:!0}}},k.onloggingmessage=e=>{P()&&T.debug("MCP App log",e?.data)},k.onmessage=async e=>{if(!P())return{};if(!tw.current)throw Error("This host cannot deliver ui/message in this surface");let t=function(e){let t=I(e);if(t?.role!=="user")throw Error('This host accepts ui/message only with role "user"');let r=t.content,n=Array.isArray(r)?r:r&&"object"==typeof r?[r]:[];if(0===n.length||!n.every(D))throw Error("This host accepts text-only ui/message content");let i=n.map(e=>e.text).join("\n").trim();if(!i)throw Error("ui/message text must not be empty");return i}(e);if(!await tw.current(t))throw Error("ui/message was not delivered");return{}},k.onupdatemodelcontext=async e=>{if(!P())return{};let t=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return"ui/update-model-context params must be an object";if(void 0!==e.content){if(!Array.isArray(e.content))return"Model context content must be an array";for(let t of e.content)if(!t||"object"!=typeof t||Array.isArray(t)||!H.has(t.type))return"Model context contains a modality this host did not advertise"}return void 0!==e.structuredContent&&(!e.structuredContent||"object"!=typeof e.structuredContent||Array.isArray(e.structuredContent))?"Model structuredContent must be an object":F(e)>U?`Model context exceeds ${U} bytes`:null}(e);if(t)throw Error(t);let n=`${r}::${b}`;if(!tg.current)throw Error("This host cannot preserve model context in this surface");if(!await tg.current(n,e))throw Error("MCP App model context was not stored");return{}},k.onsizechange=async({width:e,height:t})=>{if(!P()||tE.current)return;let r=function(e,t){let r={};if(Number.isFinite(e.width)&&e.width>0){let n=Number.isFinite(t)&&t>0?t:6e3;r.width=Math.min(e.width,n,6e3)}return Number.isFinite(e.height)&&e.height>0&&(r.height=Math.min(e.height,6e3)),r}({width:e,height:t},e1.current?.getBoundingClientRect().width||e1.current?.clientWidth||0);void 0!==r.height&&(e4.current=r.height,"fullscreen"!==ti.current&&(w.style.height=`${r.height}px`)),void 0!==r.width&&(w.style.width=`${r.width}px`,w.style.maxWidth="100%")},k.onrequestdisplaymode=async({mode:e})=>{if(!P())return{mode:ti.current};let t=ti.current,r=tn.current;if(!Y(e,to.current,r))return{mode:t};if("pip"===e&&!tE.current&&ty.current)return setTimeout(tj,0),{mode:t};let n=t;return(n=tA.current?await tA.current(e,[...r]):e)===t||Y(n,to.current,r)||(n=t),n!==t&&(ti.current=n,eB(n),await k.sendHostContextChange({displayMode:n})),{mode:n}},k.onrequestteardown=()=>{P()&&tR().finally(()=>{tC.current?tC.current():(ti.current="inline",eB("inline"),eS(!1))})},k.oninitialized=()=>{var e,t,r,n;if(!P())return;let i=k.getAppCapabilities()?.availableDisplayModes,o=Array.isArray(i)?[...new Set(i.filter(e=>z.includes(e)))]:[];tn.current=o,eK(o),tb.current?.(o.includes("pip")),tv.current?.([...o]),e9.current=!0;let s=(e=S,t=tE.current,r=to.current,n=o,t?Y("pip",r,n)?"fullscreen"===e&&Y("fullscreen",r,n)?"fullscreen":"pip":null:"fullscreen"===e&&Y("fullscreen",r,n)?"fullscreen":"inline");if(null===s){eT(ey("chat.app.canvasUnsupported")),ek(!1),tR();return}tx.current&&o.includes("pip")&&!tE.current&&ty.current&&setTimeout(tj,0),ti.current=s,eB(s),s!==M&&k.sendHostContextChange({displayMode:s});let l=e1.current;if(l&&"u">typeof ResizeObserver){let e=()=>{if(!P()||!e9.current)return;let e=l.getBoundingClientRect();e.width<=0||tE.current&&e.height<=0||k.sendHostContextChange({containerDimensions:V(l,tE.current)})};e7.current?.disconnect(),e7.current=new ResizeObserver(e),e7.current.observe(l),e()}let a=th.current;td.current=X(a.toolName,a.updateId,a.args,a.resultContent,a.cancelledReason,a.isError),(void 0!==a.args||void 0!==a.resultContent||void 0!==a.cancelledReason||!0===a.isError)&&tS(k,a.args,a.resultContent,a.cancelledReason,a.isError),ek(!1)},await k.connect((a=w.contentWindow,c=w.contentWindow,u=new x.hJ(a,c),d={start:async()=>{u.onmessage=(e,t)=>{d.onmessage?.("ui/message"!==e.method||!e.params||Array.isArray(e.params.content)||!e.params.content||"object"!=typeof e.params.content?e:{...e,params:{...e.params,content:[e.params.content]}},t)},u.onerror=e=>d.onerror?.(e),u.onclose=()=>d.onclose?.(),await u.start()},send:(e,t)=>u.send(e,t),close:()=>u.close(),setProtocolVersion:e=>u.setProtocolVersion?.(e)})),!P())return;await k.sendSandboxResourceReady({html:f.html,csp:f.csp,permissions:f.permissions})}catch(e){if(!n())return;T.warn(`Failed to mount MCP App ${b} from ${r}`,e),eT(e instanceof Error?e.message:ey("chat.app.loadFailed")),ek(!1),tR()}},[tj,eR,tS,r,tR,eC.palette.mode,b,ey]),tk=(0,i.useCallback)(()=>{!eM&&eD.current&&(ek(!0),eT(null),eF.current=null,tR().then(()=>{tr.current&&eD.current&&(N.delete(W((0,M.dJ)(),r,b,e)),tM())}))},[e,eM,tM,r,tR,b]),tP=(0,i.useCallback)(()=>{let e=!ej;e||"fullscreen"!==ti.current||(ti.current="inline",eB("inline"),e6.current?.sendHostContextChange({displayMode:"inline"})),e&&eg?.(),eS(e),e&&("internal"===e$||"granted"===e$)&&setTimeout(()=>{tM()},0)},[e$,ej,tM,eg]);(0,i.useEffect)(()=>{let e=eV.current;eV.current=ef,eh||!ef||e||ej||eS(!0)},[ef,eh,ej]),(0,i.useEffect)(()=>{eh&&("internal"===e$||"granted"===e$)&&!e8.current&&tM()},[e$,eh,tM]),(0,i.useEffect)(()=>{if(!eh&&("internal"===e$||"granted"===e$)&&ej&&!e8.current){let e=window.setTimeout(()=>{tM()},0);return()=>window.clearTimeout(e)}},[e$,ef,eh,ej,tM]),(0,i.useEffect)(()=>{let e=e2.current;if(e){if(eh||"fullscreen"===eQ){e.style.width="100%",e.style.height="100%",e.style.minHeight="0",e.style.borderRadius="0";return}e.style.width="100%",e.style.height=`${e4.current}px`,e.style.minHeight="120px",e.style.borderRadius=eY?"0":"4px"}},[eY,eh,eQ]),(0,i.useEffect)(()=>{tl.current===k&&tc.current===eR||(tl.current=k,tc.current=eR,(e8.current||te.current)&&tR().then(()=>{tr.current&&(tE.current||ej)&&tM()}))},[ej,tM,eR,tR,k]),(0,i.useEffect)(()=>{let e=X(k,Q,B,q,ee,et);e9.current&&e6.current&&e!==td.current&&(td.current=e,tR().then(()=>{tr.current&&(tE.current||ej)&&tM()}))},[ej,tM,tR,B,ee,et,k,q,Q]),(0,i.useEffect)(()=>{el&&e9.current&&e6.current&&ti.current!==el&&Y(el,to.current,tn.current)&&(ti.current=el,eB(el),e6.current.sendHostContextChange({displayMode:el}))},[el]),(0,i.useEffect)(()=>{e9.current&&e6.current&&e6.current?.sendHostContextChange({theme:"dark"===eC.palette.mode?"dark":"light"})},[eC.palette.mode]),(0,i.useEffect)(()=>{let e=ed??`${r}::${b}`;return eu?.(e,tR),()=>eu?.(e,null)},[eu,r,tR,ed,b]),(0,i.useEffect)(()=>{let e=e=>{let t=e.detail;t?.serverName===r&&(t.config?.enableMcpApps===!1||t.config?.disabled===!0)&&(eT(ey("chat.app.accessDisabled")),ek(!1),tR().finally(()=>{tE.current&&tC.current?.()}))};return window.addEventListener("flujo:mcp-server-config-changed",e),()=>{window.removeEventListener("flujo:mcp-server-config-changed",e)}},[r,tR,ey]),(0,i.useEffect)(()=>(tr.current=!0,()=>{tr.current=!1,tR()}),[tR]);let tT=("internal"===e$||"granted"===e$)&&(0,n.jsx)(s.A,{disabled:eM,onClick:tk,sx:{minHeight:44,flexShrink:0},children:ey("chat.app.reload")});if(eh)return(0,n.jsxs)(l.default,{sx:{height:"100%",width:"100%",minHeight:0,display:"flex",visibility:ep?"visible":"hidden",pointerEvents:ep?"auto":"none",flexDirection:"column"},children:[(0,n.jsx)(l.default,{sx:{display:"flex",justifyContent:"flex-end",flexShrink:0},children:tT}),ev&&eA&&"loading"===e$&&(0,n.jsx)(a.A,{variant:"body2",sx:{p:2},children:ey("chat.app.consentChecking")}),"prompt"===e$&&(0,n.jsxs)(l.default,{sx:{p:2},children:[(0,n.jsx)(a.A,{variant:"body2",sx:{mb:1},children:ey("chat.app.consentPrompt")}),(0,n.jsxs)(a.A,{variant:"caption",color:"text.secondary",sx:{display:"block",mb:1},children:[r," — ",b]}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-once")},children:ey("chat.app.consentAllowOnce")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eN("deny-always")},children:ey("chat.app.consentNeverAllow")})]}),"denied"===e$&&(0,n.jsxs)(l.default,{sx:{p:2},children:[(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",sx:{mb:1},children:ey("chat.app.consentBlocked")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eW()},children:ey("chat.app.consentAskAgain")})]}),eU&&(0,n.jsx)(c.A,{severity:"error",sx:{m:1},children:eU}),("internal"===e$||"granted"===e$)&&eM&&(0,n.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",gap:1,py:2,justifyContent:"center"},children:[(0,n.jsx)(u.default,{size:16,thickness:6}),(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",children:ey("chat.app.loading")})]}),eP&&(0,n.jsx)(c.A,{severity:"error",sx:{m:1},children:eP}),(0,n.jsx)(l.default,{ref:e1,sx:{flex:1,minHeight:0,width:"100%",display:eP?"none":"block"}})]});let t$=eq.includes("inline")&&eq.includes("fullscreen")&&e0.includes("fullscreen"),tL=eq.includes("inline")&&eq.includes("pip")&&e0.includes("pip")&&!!ei;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(l.default,{ref:e3,sx:{mt:1,...eY?{border:0,borderRadius:0}:{border:"1px solid",borderColor:"divider",borderRadius:1},overflow:"hidden",..."fullscreen"===eO?{position:"fixed",left:(eJ?.x??16)-tm.x,top:(eJ?.y??16)-tm.y,width:eJ?.width??"calc(100vw - 32px)",height:eJ?.height??"calc(100vh - 32px)",minWidth:"min(480px, 100vw)",minHeight:"min(320px, 100vh)",maxWidth:"100vw",maxHeight:"100vh",zIndex:1300,bgcolor:"background.paper",boxShadow:6,display:"flex",flexDirection:"column"}:{}},children:["fullscreen"===eO&&(0,n.jsx)(P.y1,{label:ey("chat.canvas.resize"),onResizeStart:tf}),(0,n.jsxs)(l.default,{onPointerDown:tp,sx:{display:"flex",alignItems:"center",gap:1,px:1,py:.5,bgcolor:"action.hover",cursor:"fullscreen"===eO?"move":"default",userSelect:"none",flexWrap:"wrap",flexShrink:0},children:[(0,n.jsx)(p.A,{fontSize:"small",color:"primary"}),(0,n.jsx)(a.A,{variant:"body2",sx:{fontWeight:500},children:ey("chat.app.fromServer",{server:r})}),ew>1&&(0,n.jsxs)(a.A,{variant:"caption",color:"text.secondary",children:["\xd7",ew]}),(0,n.jsx)(d.A,{title:ey("chat.app.sandboxHelp"),children:(0,n.jsx)(f.A,{fontSize:"small",color:"action"})}),(0,n.jsx)(l.default,{sx:{flex:1}}),ej&&tT,ej&&tL&&(0,n.jsx)(s.A,{size:"small",onClick:tj,children:ey("chat.app.canvas")}),ej&&(0,n.jsx)(d.A,{title:t$?"fullscreen"===eO?ey("chat.app.exitFullscreen"):ey("chat.app.fullscreen"):ey("chat.app.fullscreenUnsupported"),children:(0,n.jsx)("span",{children:(0,n.jsx)(s.A,{size:"small",disabled:!t$,"aria-label":"fullscreen"===eO?ey("chat.app.exitFullscreen"):ey("chat.app.fullscreen"),onClick:()=>{let e="fullscreen"===eO?"inline":"fullscreen";Y(e,e0,eq)&&(ti.current=e,eB(e),e6.current?.sendHostContextChange({displayMode:e}))},sx:{minWidth:0},children:"fullscreen"===eO?(0,n.jsx)(y.A,{fontSize:"small"}):(0,n.jsx)(g.A,{fontSize:"small"})})})}),(0,n.jsx)(s.A,{size:"small",onClick:tP,startIcon:ej?(0,n.jsx)(w.A,{}):(0,n.jsx)(m.A,{}),children:ej?ey("chat.app.hide"):ey("chat.app.open")})]}),ej&&"prompt"===e$&&(0,n.jsxs)(l.default,{sx:{p:1},children:[(0,n.jsx)(a.A,{variant:"body2",sx:{mb:1},children:ey("chat.app.consentPrompt")}),(0,n.jsx)(a.A,{variant:"caption",color:"text.secondary",sx:{display:"block",mb:1},children:b}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-once")},children:ey("chat.app.consentAllowOnce")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eN("deny-always")},children:ey("chat.app.consentNeverAllow")})]}),ej&&"denied"===e$&&(0,n.jsxs)(l.default,{sx:{p:1},children:[(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",sx:{mb:1},children:ey("chat.app.consentBlocked")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eW()},children:ey("chat.app.consentAskAgain")})]}),ej&&eU&&(0,n.jsx)(c.A,{severity:"error",sx:{m:1},children:eU}),(0,n.jsx)(h.A,{in:ej&&("internal"===e$||"granted"===e$),onExited:()=>{tR()},sx:"fullscreen"===eO?{flex:1,minHeight:0,display:"flex",flexDirection:"column","& .MuiCollapse-wrapper, & .MuiCollapse-wrapperInner":{height:"100%",minHeight:0,display:"flex",flexDirection:"column"}}:void 0,children:(0,n.jsxs)(l.default,{sx:{p:1,height:"fullscreen"===eO?"100%":"auto",minHeight:0,display:"flex",flexDirection:"column"},children:[eM&&(0,n.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",gap:1,py:2,justifyContent:"center"},children:[(0,n.jsx)(u.default,{size:16,thickness:6}),(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",children:ey("chat.app.loading")})]}),eP&&(0,n.jsx)(c.A,{severity:"error",sx:{my:1},children:eP}),(0,n.jsx)(l.default,{ref:e1,sx:{width:"100%",flex:"fullscreen"===eO?1:void 0,minHeight:0,height:"fullscreen"===eO?"100%":"auto",display:eP?"none":"block"}})]})})]}),(0,n.jsx)(P.Fy,{cursor:eG})]})}},77586:(e,t,r)=>{r.d(t,{Fy:()=>p,LI:()=>h,RA:()=>a,eH:()=>u,hU:()=>c,ri:()=>d,y1:()=>w});var n=r(95155),i=r(12115),o=r(4550);let s=(e,t,r)=>Math.min(Math.max(e,t),Math.max(t,r)),l={x:0,y:0};function a(e,t,r){return{x:s(e.x,0,Math.max(0,r.width-t.width)),y:s(e.y,0,Math.max(0,r.height-t.height))}}function c(e,t,r,n,i,o){let l=t.includes("left"),a=t.includes("right"),c=t.includes("top"),u=t.includes("bottom"),d=e.x+e.width,h=e.y+e.height,p=e.x,f=e.y,m=e.width,w=e.height;return l?(p=s(e.x+r,0,d-o.width),m=d-p):a&&(m=s(e.width+r,o.width,i.width-e.x)),c?(f=s(e.y+n,0,h-o.height),w=h-f):u&&(w=s(e.height+n,o.height,i.height-e.y)),{x:p,y:f,width:m,height:w}}function u(e,t,r){let n=s(e.width,r.width,t.width),i=s(e.height,r.height,t.height);return{x:s(e.x,0,t.width-n),y:s(e.y,0,t.height-i),width:n,height:i}}function d(e,t){let[r,n]=(0,i.useState)(l);return(0,i.useEffect)(()=>{if(!t)return void n(e=>0===e.x&&0===e.y?e:l);let r=()=>{let t=function(e){if(!e||"function"!=typeof window.getComputedStyle)return l;let t=window.getComputedStyle(e);if("fixed"!==t.position)return l;let r=Number.parseFloat(t.left),n=Number.parseFloat(t.top);if(!Number.isFinite(r)||!Number.isFinite(n))return l;let i=e.getBoundingClientRect(),o=Math.round(i.left-r),s=Math.round(i.top-n);return{x:1>Math.abs(o)?0:o,y:1>Math.abs(s)?0:s}}(e.current);n(e=>e.x===t.x&&e.y===t.y?e:t)};return r(),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[t,e]),r}function h(){let[e,t]=(0,i.useState)(null),r=(0,i.useRef)(null),n=(0,i.useRef)(!0);return(0,i.useEffect)(()=>(n.current=!0,()=>{n.current=!1,r.current?.(!1),r.current=null}),[]),{activeCursor:e,startPointerDrag:(0,i.useCallback)((e,i,o)=>{r.current?.(),e.preventDefault(),e.stopPropagation();let s=e.currentTarget,l=e.pointerId,a=s.ownerDocument,c=a.defaultView??window,u=a.body.style.userSelect,d=a.body.style.cursor;try{s.setPointerCapture?.(l)}catch{}a.body.style.userSelect="none",a.body.style.cursor=i??"",t(i);let h=e=>{e.pointerId===l&&(e.preventDefault(),o(e))},p=(e=!0)=>{c.removeEventListener("pointermove",h,!0),c.removeEventListener("pointerup",f,!0),c.removeEventListener("pointercancel",f,!0);try{s.hasPointerCapture?.(l)&&s.releasePointerCapture(l)}catch{}a.body.style.userSelect=u,a.body.style.cursor=d,e&&n.current&&t(null),r.current===p&&(r.current=null)},f=e=>{e.pointerId===l&&p()};r.current=p,c.addEventListener("pointermove",h,!0),c.addEventListener("pointerup",f,!0),c.addEventListener("pointercancel",f,!0)},[])}}let p=({cursor:e})=>e?(0,n.jsx)(o.default,{"aria-hidden":!0,"data-testid":"pointer-drag-shield",sx:{position:"fixed",inset:0,zIndex:0x7ffffffe,cursor:e,touchAction:"none"}}):null,f={top:{top:-3,left:10,right:10,height:8},right:{right:-3,top:10,bottom:10,width:8},bottom:{bottom:-3,left:10,right:10,height:8},left:{left:-3,top:10,bottom:10,width:8},"top-left":{top:-3,left:-3,width:14,height:14},"top-right":{top:-3,right:-3,width:14,height:14},"bottom-left":{bottom:-3,left:-3,width:14,height:14},"bottom-right":{bottom:-3,right:-3,width:14,height:14}},m=Object.keys(f),w=({label:e,onResizeStart:t})=>(0,n.jsx)(n.Fragment,{children:m.map(r=>{let i="top"===r||"bottom"===r?"ns-resize":"left"===r||"right"===r?"ew-resize":"top-left"===r||"bottom-right"===r?"nwse-resize":"nesw-resize";return(0,n.jsx)(o.default,{component:"span",role:"separator","aria-label":`${e} (${r})`,onPointerDown:e=>t(e,r,i),sx:{position:"absolute",zIndex:8,cursor:i,touchAction:"none",...f[r],..."bottom-right"===r?{"&::after":{content:'""',position:"absolute",right:3,bottom:3,width:7,height:7,borderRight:2,borderBottom:2,borderColor:"text.secondary",opacity:.7}}:{}}},r)})})}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2103],{22103:(e,t,r)=>{r.d(t,{uJ:()=>U,Ay:()=>Z,Yw:()=>F});var n=r(95155),i=r(12115),o=r(28683),s=r(52673),l=r(4550),a=r(37911),c=r(99306),u=r(89009),d=r(9098),h=r(70668),p=r(32038),f=r(42108),m=r(39734),w=r(88078),g=r(73254),y=r(98598),x=r(32635),b=r(6255),v=r(6310),A=r(80967),C=r(97312);function E(e){return null===e||"object"!=typeof e||Array.isArray(e)?void 0:e}var R=r(16803);let j=e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e;function S(e){return"string"==typeof e&&e.length>0&&e.length<=512&&e.trim()===e}var M=r(16007),k=r(49103),P=r(77586);let T=(0,k.h)("frontend/components/Chat/McpAppFrame"),$={name:"FLUJO",version:"3.48.9"},L=new Set(["https:","http:"]),z=["inline","fullscreen","pip"],H=new Set(["text"]),U=262144,I=e=>null===e||"object"!=typeof e||Array.isArray(e)?void 0:e,D=e=>{let t=I(e);return t?.type==="text"&&"string"==typeof t.text};function F(e){try{return new TextEncoder().encode(JSON.stringify(e)).length}catch{return 1/0}}let N=new Map;function W(e,t,r,n){return JSON.stringify([e,t,r,n??null])}async function O(e,t,r){let n=(0,M.dJ)(),i=W(n,e,t,r);if(!N.has(i)){let o=new URLSearchParams;o.set("serverName",e),o.set("uri",t),r&&o.set("conversationId",r);let s=fetch((0,M.TA)(`/api/mcp/app-sandbox${o.toString()?`?${o}`:""}`,n)).then(async e=>{if(!e.ok){let t="";try{let r=await e.json();"string"==typeof r.error&&r.error.trim()&&(t=`: ${r.error.trim()}`)}catch{}throw Error(`Sandbox endpoint discovery failed (${e.status})${t}`)}return await e.json()}).catch(e=>{throw N.delete(i),e});N.set(i,s)}let o=await N.get(i);return{href:function(e,t){let r;if("boolean"!=typeof e.shared)throw Error("Sandbox endpoint discovery did not describe its origin mode");if(!function(e){if("string"!=typeof e)return!1;let t=e.trim();if(0===t.length||t.length>253||t!==e||t!==t.toLowerCase()||/[^\w.-]|[^\x00-\x7f]/i.test(t)||/^\d+(\.\d+)*$/.test(t)||t.includes(":")||/[/?#@]/.test(t))return!1;let r=t.split(".");return!(0===r.length||r.some(e=>0===e.length))&&r.every(e=>e.length<=63&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e))}(e.originKey))throw Error("Sandbox endpoint discovery returned an invalid origin key");if("string"!=typeof e.token||0===e.token.length)throw Error("Sandbox endpoint discovery returned invalid credentials");if("string"!=typeof e.url)throw Error("Sandbox endpoint discovery did not return an isolated app URL");try{r=new URL(e.url)}catch{throw Error("Sandbox endpoint discovery returned an invalid public URL")}if("http:"!==r.protocol&&"https:"!==r.protocol||r.username||r.password)throw Error("Sandbox public URL must be an absolute HTTP(S) URL without credentials");if("https:"===t.protocol&&"https:"!==r.protocol)throw Error("HTTPS FLUJO deployments require an HTTPS MCP Apps sandbox URL");if(e.shared){if(r.searchParams.get("originKey")!==e.originKey)throw Error("Shared sandbox URL is not bound to the verified app origin key")}else if(!r.hostname.split(".").includes(e.originKey))throw Error("Sandbox URL is not bound to the verified app origin key");if(r.origin===t.origin)throw Error("MCP Apps sandbox must use a distinct origin from FLUJO");return r.searchParams.set("token",e.token),r.href}(o,window.location),allowAll:!0===o.allowAll}}function B(e,t,r=!1,n=!1){let i=e=>{let r=/^(https|wss):\/\/(\*\.)?([^/:?#]+)(?::(\d{1,5}))?$/i.exec(e);if(!r||!t.includes(r[1].toLowerCase()))return!1;let n=r[3].split(".");if(r[3].length>253||n.some(e=>0===e.length||e.length>63||!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(e)))return!1;let i=r[4]?Number(r[4]):void 0;return void 0===i||Number.isInteger(i)&&i>=1&&i<=65535},o=[],s=new Set;for(let l of e??[]){if(0===l.length||l.length>2048||/[^\x21-\x7e]/.test(l))continue;if("*"===l){if(n)return["*"];continue}let e=r?(0,R._w)(l,t.includes("wss")?["http","ws"]:["http"]):void 0;if(!e&&!i(l))continue;let a=e??l,c=a.toLowerCase();if(!s.has(c)&&(s.add(c),o.push(a),o.length>=64))break}return o}function J(e=window.location){return!!e&&"http:"===e.protocol}function _(e,t=J(),r=!1){return{connectDomains:B(e.connectDomains,["https","wss"],t,r),resourceDomains:B(e.resourceDomains,["https"],t,r),frameDomains:B(e.frameDomains,["https"],t,r),baseUriDomains:B(e.baseUriDomains,["https"],t,r)}}function q(e){if(e)try{return JSON.parse(e)}catch{return}}async function K(e,t,r,n,i){let o;if(await e.sendToolInput({arguments:(o=q(t))&&"object"==typeof o&&!Array.isArray(o)?o:{}}),void 0!==n)return void await e.sendToolCancelled({reason:n});let s=function(e,t){if(void 0===e)return!0===t?{content:[],isError:!0}:null;let r=b.TFo.safeParse(q(e));return r.success?{...r.data,...!0===t?{isError:!0}:{}}:{content:[{type:"text",text:e}],...!0===t?{isError:!0}:{}}}(r,i);s&&await e.sendToolResult(s)}function Y(e,t,r){return t.includes(e)&&r.includes(e)}function X(e,t,r,n,i,o){let s=void 0===t?`${r??""}\0${n??""}\0${i??""}\0${o??""}`:`${typeof t}:${String(t)}`;return`${e??""}\0${s}`}function V(e,t){let r=e.getBoundingClientRect(),n=Math.max(1,Math.round(r.width||e.clientWidth||1));return t?{width:n,height:Math.max(1,Math.round(r.height||e.clientHeight||1))}:{width:n,maxHeight:6e3}}async function G(e,t,r){try{let n=await C.S.listServerTools(e),i=Array.isArray(n.tools)?n.tools:[],o=r?i.find(e=>e?.name===r):i.find(e=>(0,R.Gt)(e?._meta)===t);if(o?.name&&o?.inputSchema&&(0,R.Gt)(o._meta)===t)return{tool:o}}catch(e){T.debug("Could not resolve the full MCP App tool definition",e)}}let Z=({conversationId:e,ownerScopeId:t,serverName:r,uri:b,toolName:k,toolArgs:B,toolResultContent:q,toolOwnerScope:Z,toolUpdateId:Q,toolCancelledReason:ee,toolIsError:et,onAppMessage:er,onUpdateModelContext:en,onRequestDock:ei,onDockable:eo,onAvailableDisplayModes:es,hostDisplayMode:el,onRequestDisplayMode:ea,onRequestClose:ec,onRegisterTeardown:eu,teardownRegistrationKey:ed,docked:eh=!1,visible:ep=!0,defaultExpanded:ef=!1,autoDock:em=!1,linkedToolCallCount:ew=1,onUserOpen:eg})=>{let{t:ey}=(0,v.s9)(),{settings:ex,settingsHydrated:eb}=(0,A.useStorage)(),ev=!1!==eb,eA=ex?.experimental?.requireMcpAppLaunchClick===!0,eC=(0,o.A)(),eE=(0,i.useId)(),eR=(0,i.useMemo)(()=>{var n;let i;return(i=S((n={toolOwnerScope:Z,toolResultContent:q,conversationId:e,ownerScopeId:t,serverName:r,uri:b,frameInstanceId:eE}).toolOwnerScope)?n.toolOwnerScope:function(e){if(void 0!==e)try{let t="string"==typeof e?JSON.parse(e):e,r=j(j(t)?._meta),n=r?.["io.flujo/host-owner-scope"];return S(n)?n:void 0}catch{return}}(n.toolResultContent))||(n.conversationId?`conversation:${n.conversationId}`:n.ownerScopeId?.trim()?`app:${n.ownerScopeId.trim().slice(0,500)}`:`app:${n.serverName}:${n.uri}:${n.frameInstanceId}`)},[e,eE,t,r,Z,q,b]),[ej,eS]=(0,i.useState)(ef),[eM,ek]=(0,i.useState)(!1),[eP,eT]=(0,i.useState)(null),[e$,eL]=(0,i.useState)(ev&&!eA?"granted":"loading"),[ez,eH]=(0,i.useState)(!1),[eU,eI]=(0,i.useState)(null),eD=(0,i.useRef)(!1);eD.current=ev&&("internal"===e$||"granted"===e$)&&(eh||ej);let eF=(0,i.useRef)(null);(0,i.useEffect)(()=>{eF.current=eP},[eP]),(0,i.useEffect)(()=>{if(!ev)return void eL("loading");if(!eA){eL("granted"),eI(null);return}let t=!0;eL("loading");let n=new URLSearchParams({serverName:r,uri:b});return e&&n.set("conversationId",e),fetch(`/api/mcp/app-consent?${n}`).then(async e=>e.ok?e.json():Promise.reject(Error("Consent lookup failed"))).then(e=>{t&&["internal","granted","prompt","denied"].includes(e.status??"")&&eL(e.status)}).catch(()=>{t&&eL("denied")}),()=>{t=!1}},[ev,eA,e,r,b]);let eN=(0,i.useCallback)(async t=>{eH(!0),eI(null);try{let n=await fetch("/api/mcp/app-consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverName:r,uri:b,conversationId:e,decision:t})});if(!n.ok)throw Error("Unable to save MCP App consent");let i=await n.json();eL("granted"===i.status?"granted":"denied")}catch{eI(ey("chat.app.consentSaveFailed"))}finally{eH(!1)}},[e,r,ey,b]),eW=(0,i.useCallback)(async()=>{eH(!0),eI(null);try{let e=new URLSearchParams({serverName:r,uri:b});if(!(await fetch(`/api/mcp/app-consent?${e}`,{method:"DELETE"})).ok)throw Error("Unable to reset MCP App consent");eL("prompt")}catch{eI(ey("chat.app.consentSaveFailed"))}finally{eH(!1)}},[r,ey,b]),[eO,eB]=(0,i.useState)(eh?"pip":"inline"),[eJ,e_]=(0,i.useState)(null),[eq,eK]=(0,i.useState)([]),[eY,eX]=(0,i.useState)(!1),eV=(0,i.useRef)(ef),{activeCursor:eG,startPointerDrag:eZ}=(0,P.LI)(),eQ=el??eO,e0=(0,i.useMemo)(()=>eh?["pip","fullscreen"]:["inline","fullscreen",...ei?["pip"]:[]],[eh,ei]),e1=(0,i.useRef)(null),e3=(0,i.useRef)(null),e2=(0,i.useRef)(null),e4=(0,i.useRef)(200),e6=(0,i.useRef)(null),e8=(0,i.useRef)(!1),e5=(0,i.useRef)(0),e9=(0,i.useRef)(!1),e7=(0,i.useRef)(null),te=(0,i.useRef)(null),tt=(0,i.useRef)(!1),tr=(0,i.useRef)(!0),tn=(0,i.useRef)([]),ti=(0,i.useRef)(eQ),to=(0,i.useRef)(e0),ts=(0,i.useRef)(k),tl=(0,i.useRef)(k),ta=(0,i.useRef)(eR),tc=(0,i.useRef)(eR);ta.current=eR;let tu=(0,i.useRef)(Promise.resolve()),td=(0,i.useRef)(void 0),th=(0,i.useRef)({toolName:k,args:B,resultContent:q,cancelledReason:ee,isError:et,updateId:Q});(0,i.useEffect)(()=>{eh||"fullscreen"!==eQ||e_(e=>{if(e)return e;let t=Math.min(Math.max(520,Math.round(.86*window.innerWidth)),window.innerWidth-24),r=Math.min(Math.max(360,Math.round(.84*window.innerHeight)),window.innerHeight-24);return{x:Math.round((window.innerWidth-t)/2),y:Math.round((window.innerHeight-r)/2),width:t,height:r}})},[eh,eQ]),(0,i.useEffect)(()=>{if(eh||"fullscreen"!==eQ)return;let e=()=>{let e={width:Math.min(480,window.innerWidth),height:Math.min(320,window.innerHeight)};e_(t=>t?(0,P.eH)(t,{width:window.innerWidth,height:window.innerHeight},e):t)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[eh,eQ]);let tp=(0,i.useCallback)(e=>{if("fullscreen"!==eQ||!e3.current||e.target.closest('button,[role="button"]'))return;e.preventDefault();let t=e3.current.getBoundingClientRect(),r=e.clientX,n=e.clientY;eZ(e,"move",e=>{e_({...(0,P.RA)({x:t.left+e.clientX-r,y:t.top+e.clientY-n},{width:t.width,height:t.height},{width:window.innerWidth,height:window.innerHeight}),width:t.width,height:t.height})})},[eQ,eZ]),tf=(0,i.useCallback)((e,t,r)=>{if("fullscreen"!==eQ||!e3.current)return;let n=e3.current.getBoundingClientRect(),i={x:n.left,y:n.top,width:n.width,height:n.height},o=e.clientX,s=e.clientY;eZ(e,r,e=>{e_((0,P.hU)(i,t,e.clientX-o,e.clientY-s,{width:window.innerWidth,height:window.innerHeight},{width:Math.min(480,window.innerWidth),height:Math.min(320,window.innerHeight)}))})},[eQ,eZ]),tm=(0,P.ri)(e3,"fullscreen"===eO&&!eh);th.current={toolName:k,args:B,resultContent:q,cancelledReason:ee,isError:et,updateId:Q},ts.current=k;let tw=(0,i.useRef)(er);(0,i.useEffect)(()=>{tw.current=er},[er]);let tg=(0,i.useRef)(en);(0,i.useEffect)(()=>{tg.current=en},[en]);let ty=(0,i.useRef)(ei);(0,i.useEffect)(()=>{ty.current=ei},[ei]);let tx=(0,i.useRef)(em);(0,i.useEffect)(()=>{em&&(tx.current=!0)},[em]);let tb=(0,i.useRef)(eo);(0,i.useEffect)(()=>{tb.current=eo},[eo]);let tv=(0,i.useRef)(es);(0,i.useEffect)(()=>{tv.current=es},[es]);let tA=(0,i.useRef)(ea);(0,i.useEffect)(()=>{tA.current=ea},[ea]);let tC=(0,i.useRef)(ec);(0,i.useEffect)(()=>{tC.current=ec},[ec]);let tE=(0,i.useRef)(eh);(0,i.useEffect)(()=>{tE.current=eh},[eh]),(0,i.useEffect)(()=>{ti.current=eQ},[eQ]),(0,i.useEffect)(()=>{to.current=e0},[e0]);let tR=(0,i.useCallback)(()=>{if(te.current)return te.current;e5.current+=1;let e=e6.current,t=e2.current,r=e9.current;e6.current=null,e2.current=null,e9.current=!1,e8.current=!1,tn.current=[],e7.current?.disconnect(),e7.current=null;let n=(async()=>{if(e&&r){let t;try{await Promise.race([e.teardownResource({},{timeout:1e3}),new Promise(e=>{t=setTimeout(e,1e3)})])}catch(e){T.debug("MCP App did not acknowledge resource teardown",e)}finally{t&&clearTimeout(t)}}try{await e?.close()}catch{}t?.remove()})();return te.current=n,n.finally(()=>{te.current===n&&(te.current=null)}),n},[]),tj=(0,i.useCallback)(()=>{tt.current||!ty.current||eF.current||(tt.current=!0,tR().then(()=>{tr.current&&(ty.current?.(),eS(!1))}).finally(()=>{tt.current=!1}))},[tR]),tS=(0,i.useCallback)((e,t,r,n,i)=>{tu.current=tu.current.catch(()=>void 0).then(async()=>{e6.current===e&&e9.current&&await K(e,t,r,n,i)}).catch(e=>{T.warn("MCP App tool delivery failed",e)})},[]),tM=(0,i.useCallback)(async()=>{if(te.current&&await te.current,e8.current||!e1.current)return;let t=e5.current+1;e5.current=t;let n=()=>e5.current===t&&e8.current;e8.current=!0,eK([]),ek(!0),eT(null);try{var i,o,s,l,a,c;let u,d,[h,p]=await Promise.all([C.S.readResourceFromApp(r,b),G(r,b,ts.current)]);if(!n())return;if(h?.httpStatus===403)throw Error(h?.error||ey("chat.app.accessDisabled"));if(!h||!1===h.success)throw Error(h?.error||ey("chat.app.readFailed"));let f=function(e,t){let r,n=e?.contents;if(!Array.isArray(n)||0===n.length)throw Error("Resource has no contents");let i=n.find(e=>e.uri===t&&"string"==typeof e.mimeType&&(0,R.q$)(e.mimeType)&&("string"==typeof e.text||"string"==typeof e.blob));if(!i)throw Error(`Resource ${t} did not return MCP App HTML`);try{if("string"==typeof i.text)r=i.text;else if("string"==typeof i.blob){var o;let e;o=i.blob,e=Uint8Array.from(atob(o),e=>e.charCodeAt(0)),r=new TextDecoder("utf-8",{fatal:!0}).decode(e)}else throw Error("Missing app resource body")}catch{throw Error(`Resource ${t} contains invalid base64 UTF-8 HTML`)}if(new TextEncoder().encode(r).length>R.Pt)throw Error(`Resource exceeds the ${Math.round(R.Pt/1024)} KiB size cap`);let s=I(i._meta??i.meta),l=I(s?.ui),a=x.c0.safeParse(l?.csp);if(l?.csp!==void 0&&!a.success)throw Error(`Resource ${t} declares an invalid CSP policy`);let c=x.Ml.safeParse(l?.permissions);if(l?.permissions!==void 0&&!c.success)throw Error(`Resource ${t} declares invalid sandbox permissions`);return{html:r,csp:a.success?_(a.data):void 0,rawCsp:a.success?a.data:void 0,permissions:c.success&&c.data.clipboardWrite?{clipboardWrite:{}}:void 0,prefersBorder:"boolean"==typeof l?.prefersBorder?l.prefersBorder:void 0}}(h.data,b);eX(!1===f.prefersBorder);let m=await O(r,b,e);if(!n()||!e1.current)return;m.allowAll&&f.rawCsp&&(f.csp=_(f.rawCsp,J(),!0));let w=document.createElement("iframe");w.title=ey("chat.app.frameTitle",{uri:b}),w.setAttribute("sandbox","allow-scripts allow-same-origin"),w.referrerPolicy="origin";let g=(0,x.Sy)(f.permissions);g&&w.setAttribute("allow",g);let y=!1===f.prefersBorder?"transparent":"#fff";w.style.cssText=tE.current||"fullscreen"===ti.current?`width:100%;height:100%;border:none;background:${y};`:`width:100%;min-height:120px;height:200px;border:none;background:${y};`+(!1===f.prefersBorder?"":"border-radius:4px;"),e1.current.appendChild(w),e2.current=w;let v=new URL(m.href);f.csp&&v.searchParams.set("csp",JSON.stringify(f.csp));let A=v.origin,j=new Promise((e,t)=>{let r=setTimeout(()=>{window.removeEventListener("message",n),t(Error(ey("chat.app.proxyTimeout")))},1e4),n=t=>{t.source===w.contentWindow&&t.origin===A&&t.data?.jsonrpc==="2.0"&&t.data?.method==="ui/notifications/sandbox-proxy-ready"&&(clearTimeout(r),window.removeEventListener("message",n),e())};window.addEventListener("message",n)});if(w.src=v.href,await j,!n()||e2.current!==w)return;let S=ti.current,M="inline";ti.current=M;let k=new x.T1((i=ta.current,o=e=>{e5.current===t&&e6.current===k&&(eT(e),ek(!1),tR().finally(()=>{tE.current&&tC.current?.()}))},s=C.S,l=e=>T.info(`MCP App tools/call: ${r}/${e}`),{getServerCapabilities:()=>({tools:{},resources:{}}),setNotificationHandler:()=>{},request:async(e,t)=>{let{method:n,params:a}=e;if("tools/call"===n){let e=E(a),n="string"==typeof e?.name?e.name:void 0;if(!n)throw Error("MCP App tool call is missing a tool name");l?.(n);let c=await s.callToolFromApp(r,n,E(e?.arguments)??{},void 0,t?.signal,i);if(c?.httpStatus===403){let e=c.error||"MCP Apps access was disabled for this server";throw o(e),Error(e)}if(!c||!1===c.success)throw Error(c?.error||`Tool call failed: ${n}`);return c.data}if("resources/read"===n){let e=E(a),n="string"==typeof e?.uri?e.uri:void 0;if(!n)throw Error("MCP App resource read is missing a URI");let i=await s.readResourceFromApp(r,n,t?.signal);if(i?.httpStatus===403){let e=i.error||"MCP Apps access was disabled for this server";throw o(e),Error(e)}if(!i||!1===i.success)throw Error(i?.error||`Resource read failed: ${n}`);return i.data}if("resources/list"===n)return{resources:[]};if("resources/templates/list"===n)return{resourceTemplates:[]};throw Error(`MCP App requested unsupported method: ${n}`)}}),$,{openLinks:{},serverTools:{},serverResources:{},logging:{},...tw.current?{message:{text:{}}}:{},...tg.current?{updateModelContext:{text:{},structuredContent:{}}}:{},sandbox:{csp:f.csp,permissions:f.permissions}},{hostContext:{...p?{toolInfo:p}:{},theme:"dark"===eC.palette.mode?"dark":"light",platform:"web",displayMode:M,availableDisplayModes:to.current,containerDimensions:V(e1.current,tE.current),locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,userAgent:navigator.userAgent,deviceCapabilities:{touch:navigator.maxTouchPoints>0,hover:window.matchMedia?.("(hover: hover)").matches??!1}}});e6.current=k;let P=()=>n()&&e6.current===k;if(k.onopenlink=async({url:e})=>{if(!P())return{isError:!0};let t=function(e){try{let t=new URL(e);if(!L.has(t.protocol)||t.username||t.password)return null;return t.href}catch{return null}}(e);if(!t)return T.warn("MCP App open-link rejected by URL policy",{serverName:r,uri:b}),{isError:!0};let n=window.open(t,"_blank","noopener,noreferrer");return n&&(n.opener=null),{}},k.ondownloadfile=async({contents:e})=>{if(!P())return{isError:!0};try{for(let t of e??[]){let e,r=I(I(t)?.resource);if(!r)continue;let n=("string"==typeof r.uri?r.uri.split("/").pop():"")||"download",i="string"==typeof r.mimeType?r.mimeType:"application/octet-stream";if("string"==typeof r.blob){let t=Uint8Array.from(atob(r.blob),e=>e.charCodeAt(0));e=new Blob([t],{type:i})}else e=new Blob([String(r.text??"")],{type:i});let o=URL.createObjectURL(e),s=document.createElement("a");s.href=o,s.download=n,document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(o),4e3)}return{}}catch(e){return T.warn("MCP App download failed",e),{isError:!0}}},k.onloggingmessage=e=>{P()&&T.debug("MCP App log",e?.data)},k.onmessage=async e=>{if(!P())return{};if(!tw.current)throw Error("This host cannot deliver ui/message in this surface");let t=function(e){let t=I(e);if(t?.role!=="user")throw Error('This host accepts ui/message only with role "user"');let r=t.content,n=Array.isArray(r)?r:r&&"object"==typeof r?[r]:[];if(0===n.length||!n.every(D))throw Error("This host accepts text-only ui/message content");let i=n.map(e=>e.text).join("\n").trim();if(!i)throw Error("ui/message text must not be empty");return i}(e);if(!await tw.current(t))throw Error("ui/message was not delivered");return{}},k.onupdatemodelcontext=async e=>{if(!P())return{};let t=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return"ui/update-model-context params must be an object";if(void 0!==e.content){if(!Array.isArray(e.content))return"Model context content must be an array";for(let t of e.content)if(!t||"object"!=typeof t||Array.isArray(t)||!H.has(t.type))return"Model context contains a modality this host did not advertise"}return void 0!==e.structuredContent&&(!e.structuredContent||"object"!=typeof e.structuredContent||Array.isArray(e.structuredContent))?"Model structuredContent must be an object":F(e)>U?`Model context exceeds ${U} bytes`:null}(e);if(t)throw Error(t);let n=`${r}::${b}`;if(!tg.current)throw Error("This host cannot preserve model context in this surface");if(!await tg.current(n,e))throw Error("MCP App model context was not stored");return{}},k.onsizechange=async({width:e,height:t})=>{if(!P()||tE.current)return;let r=function(e,t){let r={};if(Number.isFinite(e.width)&&e.width>0){let n=Number.isFinite(t)&&t>0?t:6e3;r.width=Math.min(e.width,n,6e3)}return Number.isFinite(e.height)&&e.height>0&&(r.height=Math.min(e.height,6e3)),r}({width:e,height:t},e1.current?.getBoundingClientRect().width||e1.current?.clientWidth||0);void 0!==r.height&&(e4.current=r.height,"fullscreen"!==ti.current&&(w.style.height=`${r.height}px`)),void 0!==r.width&&(w.style.width=`${r.width}px`,w.style.maxWidth="100%")},k.onrequestdisplaymode=async({mode:e})=>{if(!P())return{mode:ti.current};let t=ti.current,r=tn.current;if(!Y(e,to.current,r))return{mode:t};if("pip"===e&&!tE.current&&ty.current)return setTimeout(tj,0),{mode:t};let n=t;return(n=tA.current?await tA.current(e,[...r]):e)===t||Y(n,to.current,r)||(n=t),n!==t&&(ti.current=n,eB(n),await k.sendHostContextChange({displayMode:n})),{mode:n}},k.onrequestteardown=()=>{P()&&tR().finally(()=>{tC.current?tC.current():(ti.current="inline",eB("inline"),eS(!1))})},k.oninitialized=()=>{var e,t,r,n;if(!P())return;let i=k.getAppCapabilities()?.availableDisplayModes,o=Array.isArray(i)?[...new Set(i.filter(e=>z.includes(e)))]:[];tn.current=o,eK(o),tb.current?.(o.includes("pip")),tv.current?.([...o]),e9.current=!0;let s=(e=S,t=tE.current,r=to.current,n=o,t?Y("pip",r,n)?"fullscreen"===e&&Y("fullscreen",r,n)?"fullscreen":"pip":null:"fullscreen"===e&&Y("fullscreen",r,n)?"fullscreen":"inline");if(null===s){eT(ey("chat.app.canvasUnsupported")),ek(!1),tR();return}tx.current&&o.includes("pip")&&!tE.current&&ty.current&&setTimeout(tj,0),ti.current=s,eB(s),s!==M&&k.sendHostContextChange({displayMode:s});let l=e1.current;if(l&&"u">typeof ResizeObserver){let e=()=>{if(!P()||!e9.current)return;let e=l.getBoundingClientRect();e.width<=0||tE.current&&e.height<=0||k.sendHostContextChange({containerDimensions:V(l,tE.current)})};e7.current?.disconnect(),e7.current=new ResizeObserver(e),e7.current.observe(l),e()}let a=th.current;td.current=X(a.toolName,a.updateId,a.args,a.resultContent,a.cancelledReason,a.isError),(void 0!==a.args||void 0!==a.resultContent||void 0!==a.cancelledReason||!0===a.isError)&&tS(k,a.args,a.resultContent,a.cancelledReason,a.isError),ek(!1)},await k.connect((a=w.contentWindow,c=w.contentWindow,u=new x.hJ(a,c),d={start:async()=>{u.onmessage=(e,t)=>{d.onmessage?.("ui/message"!==e.method||!e.params||Array.isArray(e.params.content)||!e.params.content||"object"!=typeof e.params.content?e:{...e,params:{...e.params,content:[e.params.content]}},t)},u.onerror=e=>d.onerror?.(e),u.onclose=()=>d.onclose?.(),await u.start()},send:(e,t)=>u.send(e,t),close:()=>u.close(),setProtocolVersion:e=>u.setProtocolVersion?.(e)})),!P())return;await k.sendSandboxResourceReady({html:f.html,csp:f.csp,permissions:f.permissions})}catch(e){if(!n())return;T.warn(`Failed to mount MCP App ${b} from ${r}`,e),eT(e instanceof Error?e.message:ey("chat.app.loadFailed")),ek(!1),tR()}},[tj,eR,tS,r,tR,eC.palette.mode,b,ey]),tk=(0,i.useCallback)(()=>{!eM&&eD.current&&(ek(!0),eT(null),eF.current=null,tR().then(()=>{tr.current&&eD.current&&(N.delete(W((0,M.dJ)(),r,b,e)),tM())}))},[e,eM,tM,r,tR,b]),tP=(0,i.useCallback)(()=>{let e=!ej;e||"fullscreen"!==ti.current||(ti.current="inline",eB("inline"),e6.current?.sendHostContextChange({displayMode:"inline"})),e&&eg?.(),eS(e),e&&("internal"===e$||"granted"===e$)&&setTimeout(()=>{tM()},0)},[e$,ej,tM,eg]);(0,i.useEffect)(()=>{let e=eV.current;eV.current=ef,eh||!ef||e||ej||eS(!0)},[ef,eh,ej]),(0,i.useEffect)(()=>{eh&&("internal"===e$||"granted"===e$)&&!e8.current&&tM()},[e$,eh,tM]),(0,i.useEffect)(()=>{if(!eh&&("internal"===e$||"granted"===e$)&&ej&&!e8.current){let e=window.setTimeout(()=>{tM()},0);return()=>window.clearTimeout(e)}},[e$,ef,eh,ej,tM]),(0,i.useEffect)(()=>{let e=e2.current;if(e){if(eh||"fullscreen"===eQ){e.style.width="100%",e.style.height="100%",e.style.minHeight="0",e.style.borderRadius="0";return}e.style.width="100%",e.style.height=`${e4.current}px`,e.style.minHeight="120px",e.style.borderRadius=eY?"0":"4px"}},[eY,eh,eQ]),(0,i.useEffect)(()=>{tl.current===k&&tc.current===eR||(tl.current=k,tc.current=eR,(e8.current||te.current)&&tR().then(()=>{tr.current&&(tE.current||ej)&&tM()}))},[ej,tM,eR,tR,k]),(0,i.useEffect)(()=>{let e=X(k,Q,B,q,ee,et);e9.current&&e6.current&&e!==td.current&&(td.current=e,tR().then(()=>{tr.current&&(tE.current||ej)&&tM()}))},[ej,tM,tR,B,ee,et,k,q,Q]),(0,i.useEffect)(()=>{el&&e9.current&&e6.current&&ti.current!==el&&Y(el,to.current,tn.current)&&(ti.current=el,eB(el),e6.current.sendHostContextChange({displayMode:el}))},[el]),(0,i.useEffect)(()=>{e9.current&&e6.current&&e6.current?.sendHostContextChange({theme:"dark"===eC.palette.mode?"dark":"light"})},[eC.palette.mode]),(0,i.useEffect)(()=>{let e=ed??`${r}::${b}`;return eu?.(e,tR),()=>eu?.(e,null)},[eu,r,tR,ed,b]),(0,i.useEffect)(()=>{let e=e=>{let t=e.detail;t?.serverName===r&&(t.config?.enableMcpApps===!1||t.config?.disabled===!0)&&(eT(ey("chat.app.accessDisabled")),ek(!1),tR().finally(()=>{tE.current&&tC.current?.()}))};return window.addEventListener("flujo:mcp-server-config-changed",e),()=>{window.removeEventListener("flujo:mcp-server-config-changed",e)}},[r,tR,ey]),(0,i.useEffect)(()=>(tr.current=!0,()=>{tr.current=!1,tR()}),[tR]);let tT=("internal"===e$||"granted"===e$)&&(0,n.jsx)(s.A,{disabled:eM,onClick:tk,sx:{minHeight:44,flexShrink:0},children:ey("chat.app.reload")});if(eh)return(0,n.jsxs)(l.default,{sx:{height:"100%",width:"100%",minHeight:0,display:"flex",visibility:ep?"visible":"hidden",pointerEvents:ep?"auto":"none",flexDirection:"column"},children:[(0,n.jsx)(l.default,{sx:{display:"flex",justifyContent:"flex-end",flexShrink:0},children:tT}),ev&&eA&&"loading"===e$&&(0,n.jsx)(a.A,{variant:"body2",sx:{p:2},children:ey("chat.app.consentChecking")}),"prompt"===e$&&(0,n.jsxs)(l.default,{sx:{p:2},children:[(0,n.jsx)(a.A,{variant:"body2",sx:{mb:1},children:ey("chat.app.consentPrompt")}),(0,n.jsxs)(a.A,{variant:"caption",color:"text.secondary",sx:{display:"block",mb:1},children:[r," — ",b]}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-once")},children:ey("chat.app.consentAllowOnce")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eN("deny-always")},children:ey("chat.app.consentNeverAllow")})]}),"denied"===e$&&(0,n.jsxs)(l.default,{sx:{p:2},children:[(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",sx:{mb:1},children:ey("chat.app.consentBlocked")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eW()},children:ey("chat.app.consentAskAgain")})]}),eU&&(0,n.jsx)(c.A,{severity:"error",sx:{m:1},children:eU}),("internal"===e$||"granted"===e$)&&eM&&(0,n.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",gap:1,py:2,justifyContent:"center"},children:[(0,n.jsx)(u.default,{size:16,thickness:6}),(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",children:ey("chat.app.loading")})]}),eP&&(0,n.jsx)(c.A,{severity:"error",sx:{m:1},children:eP}),(0,n.jsx)(l.default,{ref:e1,sx:{flex:1,minHeight:0,width:"100%",display:eP?"none":"block"}})]});let t$=eq.includes("inline")&&eq.includes("fullscreen")&&e0.includes("fullscreen"),tL=eq.includes("inline")&&eq.includes("pip")&&e0.includes("pip")&&!!ei;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(l.default,{ref:e3,sx:{mt:1,...eY?{border:0,borderRadius:0}:{border:"1px solid",borderColor:"divider",borderRadius:1},overflow:"hidden",..."fullscreen"===eO?{position:"fixed",left:(eJ?.x??16)-tm.x,top:(eJ?.y??16)-tm.y,width:eJ?.width??"calc(100vw - 32px)",height:eJ?.height??"calc(100vh - 32px)",minWidth:"min(480px, 100vw)",minHeight:"min(320px, 100vh)",maxWidth:"100vw",maxHeight:"100vh",zIndex:1300,bgcolor:"background.paper",boxShadow:6,display:"flex",flexDirection:"column"}:{}},children:["fullscreen"===eO&&(0,n.jsx)(P.y1,{label:ey("chat.canvas.resize"),onResizeStart:tf}),(0,n.jsxs)(l.default,{onPointerDown:tp,sx:{display:"flex",alignItems:"center",gap:1,px:1,py:.5,bgcolor:"action.hover",cursor:"fullscreen"===eO?"move":"default",userSelect:"none",flexWrap:"wrap",flexShrink:0},children:[(0,n.jsx)(p.A,{fontSize:"small",color:"primary"}),(0,n.jsx)(a.A,{variant:"body2",sx:{fontWeight:500},children:ey("chat.app.fromServer",{server:r})}),ew>1&&(0,n.jsxs)(a.A,{variant:"caption",color:"text.secondary",children:["\xd7",ew]}),(0,n.jsx)(d.A,{title:ey("chat.app.sandboxHelp"),children:(0,n.jsx)(f.A,{fontSize:"small",color:"action"})}),(0,n.jsx)(l.default,{sx:{flex:1}}),ej&&tT,ej&&tL&&(0,n.jsx)(s.A,{size:"small",onClick:tj,children:ey("chat.app.canvas")}),ej&&(0,n.jsx)(d.A,{title:t$?"fullscreen"===eO?ey("chat.app.exitFullscreen"):ey("chat.app.fullscreen"):ey("chat.app.fullscreenUnsupported"),children:(0,n.jsx)("span",{children:(0,n.jsx)(s.A,{size:"small",disabled:!t$,"aria-label":"fullscreen"===eO?ey("chat.app.exitFullscreen"):ey("chat.app.fullscreen"),onClick:()=>{let e="fullscreen"===eO?"inline":"fullscreen";Y(e,e0,eq)&&(ti.current=e,eB(e),e6.current?.sendHostContextChange({displayMode:e}))},sx:{minWidth:0},children:"fullscreen"===eO?(0,n.jsx)(y.A,{fontSize:"small"}):(0,n.jsx)(g.A,{fontSize:"small"})})})}),(0,n.jsx)(s.A,{size:"small",onClick:tP,startIcon:ej?(0,n.jsx)(w.A,{}):(0,n.jsx)(m.A,{}),children:ej?ey("chat.app.hide"):ey("chat.app.open")})]}),ej&&"prompt"===e$&&(0,n.jsxs)(l.default,{sx:{p:1},children:[(0,n.jsx)(a.A,{variant:"body2",sx:{mb:1},children:ey("chat.app.consentPrompt")}),(0,n.jsx)(a.A,{variant:"caption",color:"text.secondary",sx:{display:"block",mb:1},children:b}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-once")},children:ey("chat.app.consentAllowOnce")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eN("deny-always")},children:ey("chat.app.consentNeverAllow")})]}),ej&&"denied"===e$&&(0,n.jsxs)(l.default,{sx:{p:1},children:[(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",sx:{mb:1},children:ey("chat.app.consentBlocked")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,onClick:()=>{eN("allow-always")},children:ey("chat.app.consentAllowAlways")}),(0,n.jsx)(s.A,{size:"small",disabled:ez,color:"inherit",onClick:()=>{eW()},children:ey("chat.app.consentAskAgain")})]}),ej&&eU&&(0,n.jsx)(c.A,{severity:"error",sx:{m:1},children:eU}),(0,n.jsx)(h.A,{in:ej&&("internal"===e$||"granted"===e$),onExited:()=>{tR()},sx:"fullscreen"===eO?{flex:1,minHeight:0,display:"flex",flexDirection:"column","& .MuiCollapse-wrapper, & .MuiCollapse-wrapperInner":{height:"100%",minHeight:0,display:"flex",flexDirection:"column"}}:void 0,children:(0,n.jsxs)(l.default,{sx:{p:1,height:"fullscreen"===eO?"100%":"auto",minHeight:0,display:"flex",flexDirection:"column"},children:[eM&&(0,n.jsxs)(l.default,{sx:{display:"flex",alignItems:"center",gap:1,py:2,justifyContent:"center"},children:[(0,n.jsx)(u.default,{size:16,thickness:6}),(0,n.jsx)(a.A,{variant:"body2",color:"text.secondary",children:ey("chat.app.loading")})]}),eP&&(0,n.jsx)(c.A,{severity:"error",sx:{my:1},children:eP}),(0,n.jsx)(l.default,{ref:e1,sx:{width:"100%",flex:"fullscreen"===eO?1:void 0,minHeight:0,height:"fullscreen"===eO?"100%":"auto",display:eP?"none":"block"}})]})})]}),(0,n.jsx)(P.Fy,{cursor:eG})]})}},77586:(e,t,r)=>{r.d(t,{Fy:()=>p,LI:()=>h,RA:()=>a,eH:()=>u,hU:()=>c,ri:()=>d,y1:()=>w});var n=r(95155),i=r(12115),o=r(4550);let s=(e,t,r)=>Math.min(Math.max(e,t),Math.max(t,r)),l={x:0,y:0};function a(e,t,r){return{x:s(e.x,0,Math.max(0,r.width-t.width)),y:s(e.y,0,Math.max(0,r.height-t.height))}}function c(e,t,r,n,i,o){let l=t.includes("left"),a=t.includes("right"),c=t.includes("top"),u=t.includes("bottom"),d=e.x+e.width,h=e.y+e.height,p=e.x,f=e.y,m=e.width,w=e.height;return l?(p=s(e.x+r,0,d-o.width),m=d-p):a&&(m=s(e.width+r,o.width,i.width-e.x)),c?(f=s(e.y+n,0,h-o.height),w=h-f):u&&(w=s(e.height+n,o.height,i.height-e.y)),{x:p,y:f,width:m,height:w}}function u(e,t,r){let n=s(e.width,r.width,t.width),i=s(e.height,r.height,t.height);return{x:s(e.x,0,t.width-n),y:s(e.y,0,t.height-i),width:n,height:i}}function d(e,t){let[r,n]=(0,i.useState)(l);return(0,i.useEffect)(()=>{if(!t)return void n(e=>0===e.x&&0===e.y?e:l);let r=()=>{let t=function(e){if(!e||"function"!=typeof window.getComputedStyle)return l;let t=window.getComputedStyle(e);if("fixed"!==t.position)return l;let r=Number.parseFloat(t.left),n=Number.parseFloat(t.top);if(!Number.isFinite(r)||!Number.isFinite(n))return l;let i=e.getBoundingClientRect(),o=Math.round(i.left-r),s=Math.round(i.top-n);return{x:1>Math.abs(o)?0:o,y:1>Math.abs(s)?0:s}}(e.current);n(e=>e.x===t.x&&e.y===t.y?e:t)};return r(),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[t,e]),r}function h(){let[e,t]=(0,i.useState)(null),r=(0,i.useRef)(null),n=(0,i.useRef)(!0);return(0,i.useEffect)(()=>(n.current=!0,()=>{n.current=!1,r.current?.(!1),r.current=null}),[]),{activeCursor:e,startPointerDrag:(0,i.useCallback)((e,i,o)=>{r.current?.(),e.preventDefault(),e.stopPropagation();let s=e.currentTarget,l=e.pointerId,a=s.ownerDocument,c=a.defaultView??window,u=a.body.style.userSelect,d=a.body.style.cursor;try{s.setPointerCapture?.(l)}catch{}a.body.style.userSelect="none",a.body.style.cursor=i??"",t(i);let h=e=>{e.pointerId===l&&(e.preventDefault(),o(e))},p=(e=!0)=>{c.removeEventListener("pointermove",h,!0),c.removeEventListener("pointerup",f,!0),c.removeEventListener("pointercancel",f,!0);try{s.hasPointerCapture?.(l)&&s.releasePointerCapture(l)}catch{}a.body.style.userSelect=u,a.body.style.cursor=d,e&&n.current&&t(null),r.current===p&&(r.current=null)},f=e=>{e.pointerId===l&&p()};r.current=p,c.addEventListener("pointermove",h,!0),c.addEventListener("pointerup",f,!0),c.addEventListener("pointercancel",f,!0)},[])}}let p=({cursor:e})=>e?(0,n.jsx)(o.default,{"aria-hidden":!0,"data-testid":"pointer-drag-shield",sx:{position:"fixed",inset:0,zIndex:0x7ffffffe,cursor:e,touchAction:"none"}}):null,f={top:{top:-3,left:10,right:10,height:8},right:{right:-3,top:10,bottom:10,width:8},bottom:{bottom:-3,left:10,right:10,height:8},left:{left:-3,top:10,bottom:10,width:8},"top-left":{top:-3,left:-3,width:14,height:14},"top-right":{top:-3,right:-3,width:14,height:14},"bottom-left":{bottom:-3,left:-3,width:14,height:14},"bottom-right":{bottom:-3,right:-3,width:14,height:14}},m=Object.keys(f),w=({label:e,onResizeStart:t})=>(0,n.jsx)(n.Fragment,{children:m.map(r=>{let i="top"===r||"bottom"===r?"ns-resize":"left"===r||"right"===r?"ew-resize":"top-left"===r||"bottom-right"===r?"nwse-resize":"nesw-resize";return(0,n.jsx)(o.default,{component:"span",role:"separator","aria-label":`${e} (${r})`,onPointerDown:e=>t(e,r,i),sx:{position:"absolute",zIndex:8,cursor:i,touchAction:"none",...f[r],..."bottom-right"===r?{"&::after":{content:'""',position:"absolute",right:3,bottom:3,width:7,height:7,borderRight:2,borderBottom:2,borderColor:"text.secondary",opacity:.7}}:{}}},r)})})}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3408],{8901:(e,t,a)=>{a.d(t,{IU:()=>r,Ri:()=>n,dD:()=>o});let o="flujo:big-tutorial";function r(e){window.dispatchEvent(new CustomEvent(o,{detail:e}))}function n(e){return e instanceof CustomEvent&&!!e.detail&&"string"==typeof e.detail.type}},13408:(e,t,a)=>{a.r(t),a.d(t,{TourProvider:()=>k,useTour:()=>y});var o=a(95155),r=a(12115),n=a(19260),s=a(80967),i=a(24437),l=a(90919),c=a(8901);let d="Reply helpfully to the user.";var p=a(65614),u=a(32897),h=a(97312),w=a(68588);let f=(0,a(49103).h)("frontend/contexts/TourContext"),g={status:"active",stepId:"intro"};class m extends Error{}let b=(0,r.createContext)({isActive:!1,stepIndex:0,dashboardRestoreId:0,saveDashboardDismissals:()=>{},canStartTour:!1,startTour:()=>{},next:()=>{},back:()=>{},endTour:()=>{},isBigTutorialActive:!1,bigTutorialProgress:g,bigTutorialBusy:!1,bigTutorialError:null,bigTutorialRunStatus:null,bigTutorialConnectedServer:null,startBigTutorial:async()=>{},resumeBigTutorial:async()=>{},nextBigTutorial:async()=>{},backBigTutorial:async()=>{},runBigTutorialAction:async()=>{},pauseBigTutorial:async()=>{},restartBigTutorial:async()=>{}}),y=()=>(0,r.useContext)(b);function v(e){let t=e.toLocaleLowerCase();return[["web search",12],["internet",10],["search_web",10],["web_search",10],["brave",9],["duckduckgo",9],["google search",9],["news",7],["browser",6],["search",5],["fetch",2]].reduce((e,[a,o])=>e+(t.includes(a)?o:0),0)}let k=({children:e})=>{let{settings:t,updateSettings:a,isLoading:y,settingsHydrated:k}=(0,s.useStorage)(),C=k&&!y,I=(0,r.useRef)(t);I.current=t;let[T,S]=(0,r.useState)(!1),[F,x]=(0,r.useState)(0),[E,A]=(0,r.useState)(0),[N,O]=(0,r.useState)(!1),[j,$]=(0,r.useState)(t.onboarding?.tutorials?.bigTutorialStage1??g),P=(0,r.useRef)(j),[L,D]=(0,r.useState)(!1),[R,M]=(0,r.useState)(null),[U,q]=(0,r.useState)(null),[J,B]=(0,r.useState)(null),H=(0,r.useRef)(!1),W=(0,r.useRef)(!1),V=(0,r.useRef)(Promise.resolve()),z=(0,r.useRef)(Promise.resolve()),_=(0,r.useCallback)(e=>{z.current=z.current.then(async()=>{let t=I.current,o=e(t);o!==t&&(await a(o),I.current===t&&(I.current=o))}).catch(e=>f.warn("Failed to persist guided tour settings",e))},[a]),G=(0,r.useCallback)(()=>{_(e=>({...e,onboarding:{...e.onboarding??{},completed:!0}}))},[_]),Y=(0,r.useCallback)(e=>{_(t=>({...t,onboarding:{...t.onboarding??{},completed:t.onboarding?.completed??!1,dashboardCardsHidden:!1,dashboardDismissedCards:e}}))},[_]),K=(0,r.useCallback)(e=>{let t=V.current.then(async()=>{let t=I.current,o={...t,onboarding:{...t.onboarding??{},completed:t.onboarding?.completed??!0,tutorials:{...t.onboarding?.tutorials??{},bigTutorialStage1:e}}};I.current=o,await a(o)}).catch(e=>{f.warn("Failed to persist Stage 1 tutorial progress",e)});return V.current=t,t},[a]),Q=(0,r.useCallback)(async e=>{P.current=e,$(e),await K(e)},[K]),X=(0,r.useCallback)(()=>{C&&(f.info("Starting guided tour"),A(e=>e+1),_(e=>{let t=e.onboarding,a=Array.isArray(t?.dashboardDismissedCards)?t.dashboardDismissedCards:[];return t?.dashboardCardsHidden===!0||a.some(e=>w.KV.includes(e))?{...e,onboarding:{...t??{},completed:t?.completed??!1,dashboardCardsHidden:!1,dashboardDismissedCards:a.filter(e=>!w.KV.includes(e))}}:e}),O(!1),x(0),S(!0))},[C,_]),Z=(0,r.useCallback)(()=>{f.info("Ending guided tour"),S(!1),G()},[G]),ee=(0,r.useCallback)(()=>{x(e=>e>=i.$.length-1?(S(!1),G(),e):e+1)},[G]),et=(0,r.useCallback)(()=>x(e=>Math.max(0,e-1)),[]),ea=(0,r.useCallback)(async()=>{let e=P.current,t=(await u.N6.loadModels()).filter(e=>e.id&&e.name?.trim()&&e.provider),a=t.find(e=>e.favorite&&!1!==e.supportsTools)??t.find(e=>!1!==e.supportsTools)??t.find(e=>e.favorite)??t[0];if(!a)throw new m("Connect an AI in AI Setup, then continue the tutorial.");let o=await p.g.loadFlows(),r=function(e){let t=e.find(e=>"chat"===e.name.trim().toLocaleLowerCase());if(!t)return null;let a=t.nodes.find(e=>"process"===e.data.type);return a?{flow:t,processNodeId:a.id}:null}(o);if(r){let o=r.flow.nodes.find(e=>e.id===r.processNodeId);if(!t.some(e=>e.id===o?.data.properties?.boundModel)){let e={...r.flow,nodes:r.flow.nodes.map(e=>e.id===r.processNodeId?{...e,data:{...e.data,properties:{...e.data.properties,boundModel:a.id}}}:e)},t=await p.g.updateFlow(e);if(!t.success)throw Error(t.error||"I could not connect the AI to the Chat agent.")}let n="string"==typeof o?.data.properties?.promptTemplate?o.data.properties.promptTemplate:void 0,s={...e,flowId:r.flow.id,processNodeId:r.processNodeId,taskPrompt:n};return await Q(s),s}if(o.find(e=>"chat"===e.name.trim().toLocaleLowerCase()))throw Error("I found a Chat agent, but it has no AI step. Add one or rename that agent, then restart this tutorial.");let s=function(e,t){if(!e.trim())throw Error("Connect an AI before creating the tutorial agent.");let a=Date.now(),o=t(),r=t(),n=t(),s=t(),i=[{id:r,type:"start",position:{x:250,y:80},data:{label:"Start Node",type:"start",properties:{promptTemplate:""}}},{id:n,type:"process",position:{x:250,y:260},data:{label:"Ask AI",type:"process",properties:{promptTemplate:d,inputMode:"full-history",outputMode:"latest-message",boundModel:e}}},{id:s,type:"finish",position:{x:250,y:440},data:{label:"Finish Node",type:"finish",properties:{}}}],l=[{id:t(),source:r,sourceHandle:"start-bottom",target:n,targetHandle:"process-top",type:"flowEdge",data:{edgeType:"flow"}},{id:t(),source:n,sourceHandle:"process-bottom",target:s,targetHandle:"finish-top",type:"flowEdge",data:{edgeType:"flow"}}];return{processNodeId:n,flow:{id:o,name:"Chat",description:"A friendly agent for everyday conversations.",favorite:!0,createdAt:a,updatedAt:a,nodes:i,edges:l}}}(a.id,n.A),i=await p.g.addFlow(s.flow);if(!i.success)throw Error(i.error||"I could not create the Chat agent.");let l={...e,flowId:s.flow.id,processNodeId:s.processNodeId,taskPrompt:d};return await Q(l),l},[Q]),eo=(0,r.useCallback)(async e=>{e instanceof m&&await Q({...P.current,stepId:"connect-ai",status:"active"}),M(e instanceof Error?e.message:String(e))},[Q]),er=(0,r.useCallback)(async()=>{let e={...g};S(!1),M(null),B(null),q(null),await Q(e),O(!0)},[Q]),en=(0,r.useCallback)(async()=>{await er()},[er]),es=(0,r.useCallback)(async()=>{let e=I.current.onboarding?.tutorials?.bigTutorialStage1,t=e&&"paused"===e.status?{...e,status:"active"}:{...g};S(!1),M(null),await Q(t),O(!0),"intro"!==t.stepId&&"connect-ai"!==t.stepId&&ea().catch(eo)},[Q,ea,eo]),ei=(0,r.useCallback)(async e=>{let t=P.current;l.pn.has(e)&&(M(null),await Q({...t,status:"active",stepId:e}))},[Q]),el=(0,r.useCallback)(async()=>{let e=l.pn.get(P.current.stepId);e?.next&&await ei(e.next)},[ei]),ec=(0,r.useCallback)(async()=>{let e=l.pn.get(P.current.stepId);e?.back&&await ei(e.back)},[ei]),ed=(0,r.useCallback)(async()=>{B(null);let e=P.current;e.flowId&&e.processNodeId||(e=await ea());let t=e.flowId?await p.g.getFlow(e.flowId):null;if(!t||!e.processNodeId)throw Error("I cannot find the Chat agent right now. Please try again.");let a=await h.S.loadServerConfigs();if(!Array.isArray(a))throw Error(a?.error||"I could not read your installed apps.");let o=a.filter(e=>!e.disabled),r=await Promise.all(o.map(async e=>{let t=await h.S.listServerTools(e.name);return{config:e,tools:t.error||!Array.isArray(t.tools)?[]:t.tools}})),n=t.nodes.find(t=>t.id===e.processNodeId),s="string"==typeof n?.data.properties?.boundModel?n.data.properties.boundModel:(await u.N6.loadModels())[0]?.id,i=[];if(s)try{i=(await p.g.suggestToolsForStep({flow:t,nodeId:e.processNodeId,modelId:s,goal:"Let this friendly chat agent search the web and answer questions about current news and events."})).suggestions.filter(e=>v(`${e.server} ${e.tool} ${e.reason}`)>0).map(e=>e.server)}catch(e){f.warn("Stage 1 app suggestion failed; using the live tool catalog",e)}let l=r.map(({config:e,tools:t})=>({name:e.name,score:Math.max(100*!!i.includes(e.name),...t.map(t=>v(`${e.name} ${t.name} ${t.description??""}`))),toolCount:t.length})).filter(e=>e.toolCount>0&&e.score>0).sort((e,t)=>t.score-e.score||e.name.localeCompare(t.name));if(l[0]){let a=t.nodes.some(e=>"mcp"===e.data.type&&e.data.properties?.boundServer===l[0].name),o={...e,status:"active",recommendedServerName:l[0].name,nestedTutorialId:void 0,stepId:a?"app-instructions":e.nestedTutorialId?"return-to-app-picker":"connect-app"};await Q(o);return}let c=a.filter(e=>e.disabled).map(e=>({config:e,score:v(`${e.name} ${e.rootPath??""}`)})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score)[0]?.config;if(c)return void await Q({...e,status:"active",stepId:"enable-app",recommendedServerName:c.name,nestedTutorialId:"enable-web-app"});let d=o.find(e=>v(`${e.name} ${e.rootPath??""}`)>0);if(d)throw Error(`${d.name} is installed but is not ready yet. Give it a moment, then check again.`);await Q({...e,status:"active",stepId:"install-app-intro",recommendedServerName:void 0,nestedTutorialId:"install-web-app"})},[Q,ea]),ep=(0,r.useCallback)(async()=>{let e=l.pn.get(P.current.stepId);if(e&&!L){D(!0),M(null);try{if("start"===e.action)await ea(),e.next&&await ei(e.next);else if("send-example"===e.action){await ea();let t=P.current.conversationId;if(!t)throw Error("Start a new conversation and choose the Chat agent before sending the example.");q(null),(0,c.IU)({type:"send-example",conversationId:t,message:"Hey! What happened on the internet today?"}),e.next&&await ei(e.next)}else if("check-apps"===e.action)await ed();else if("finish"===e.action){let e={...P.current,status:"completed",stepId:"complete",nestedTutorialId:void 0};await Q(e),O(!1)}else e.next&&await ei(e.next)}catch(e){await eo(e)}finally{D(!1)}}},[L,ed,Q,ea,eo,ei]),eu=(0,r.useCallback)(async()=>{let e={...P.current,status:"paused"};await Q(e),O(!1)},[Q]);return(0,r.useEffect)(()=>{let e=e=>{(0,c.Ri)(e)&&N&&("conversation-created"===e.detail.type?Q({...P.current,conversationId:e.detail.conversationId}):"chat-run-status"===e.detail.type?e.detail.conversationId===P.current.conversationId&&q(e.detail.status):"app-connected"===e.detail.type&&B(e.detail.serverName))};return window.addEventListener(c.dD,e),()=>window.removeEventListener(c.dD,e)},[Q,N]),(0,r.useEffect)(()=>{y||!k||H.current||(H.current=!0,t.onboarding?.completed!==!0&&"/"===window.location.pathname&&(f.info("First run detected — auto-starting guided tour"),X()))},[y,k,t.onboarding?.completed,X]),(0,r.useEffect)(()=>{if(y||!k||W.current)return;W.current=!0;let e=t.onboarding?.tutorials?.bigTutorialStage1;e?.status==="active"&&(P.current=e,$(e),O(!0),"intro"!==e.stepId&&"connect-ai"!==e.stepId&&ea().catch(eo))},[ea,eo,y,t.onboarding,k]),(0,r.useEffect)(()=>{if(!k||N)return;let e=t.onboarding?.tutorials?.bigTutorialStage1;e&&(P.current=e,$(e))},[N,t.onboarding?.tutorials?.bigTutorialStage1,k]),(0,o.jsx)(b.Provider,{value:{isActive:T,stepIndex:F,dashboardRestoreId:E,saveDashboardDismissals:Y,canStartTour:C,startTour:X,next:ee,back:et,endTour:Z,isBigTutorialActive:N,bigTutorialProgress:j,bigTutorialBusy:L,bigTutorialError:R,bigTutorialRunStatus:U,bigTutorialConnectedServer:J,startBigTutorial:er,resumeBigTutorial:es,nextBigTutorial:el,backBigTutorial:ec,runBigTutorialAction:ep,pauseBigTutorial:eu,restartBigTutorial:en},children:e})}},24437:(e,t,a)=>{a.d(t,{$:()=>o});let o=[{id:"manage-ai-setup",path:"/",target:'[data-tour="manage-ai-setup"]',placement:"top",title:"tour.manageAi.title",body:"tour.manageAi.body"},{id:"nav-models",path:"/",target:'[data-tour="nav-models"]',placement:"bottom",title:"tour.aiNav.title",body:"tour.aiNav.body"},{id:"models-overview",path:"/models",target:'[data-tour="models-overview"]',placement:"center",title:"tour.aiOverview.title",body:"tour.aiOverview.body"},{id:"add-model",path:"/models",target:'[data-tour="add-model"]',placement:"bottom",title:"tour.connectAi.title",body:"tour.connectAi.body"},{id:"ai-setup-wizard",path:"/models",route:"/models?add=1",target:'[data-tour="ai-setup-wizard"]',placement:"right",title:"tour.aiWizard.title",body:"tour.aiWizard.body"},{id:"dashboard-create-flow",path:"/",target:'[data-tour="dashboard-create-flow"]',placement:"top",title:"tour.backDashboard.title",body:"tour.backDashboard.body"},{id:"new-flow",path:"/flows",target:'[data-tour="new-flow"]',placement:"bottom",title:"tour.createAgent.title",body:"tour.createAgent.body"},{id:"chat-input",path:"/chat",target:'[data-tour="chat-input"]',placement:"top",title:"tour.talk.title",body:"tour.talk.body"}]},65614:(e,t,a)=>{a.d(t,{g:()=>s});var o=a(19260);let r=(0,a(49103).h)("frontend/services/flow/index");class n{async loadFlows(e={}){r.debug("loadFlows: Entering method");try{if(this.flowsCache&&!e.refresh)return r.debug("loadFlows: Using cached flows",{count:this.flowsCache.length}),this.flowsCache;let t=await fetch("/api/flow");if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to load flows")}let a=await t.json();return r.debug("loadFlows: Loaded flows from API",{count:a.length}),this.flowsCache=a,a}catch(e){return r.warn("loadFlows: Failed to load flows:",e),[]}}async suggestToolsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-tools",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not suggest connected tools.");return a}async generateNameForFlow(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generate-name",...e})}),a=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof a?.name)throw Error(a?.error||"Could not generate a workflow name.");return{name:a.name}}async applyToolsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-tools",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not connect the approved tools.");return a.flow}async suggestAgentsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-agents",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not suggest connected agents.");return a}async applyAgentsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-agents",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not connect the approved agents.");return a.flow}async improvePromptForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"improve-prompt",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not improve this prompt.");return a}async checkPlausibility(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"check-plausibility",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not check flow plausibility.");return a}async getFlow(e){r.debug("getFlow: Entering method",{flowId:e});try{if(this.flowsCache){let t=this.flowsCache.find(t=>t.id===e);if(t)return r.debug("getFlow: Using cached flow",{flowId:e}),t}let t=await fetch(`/api/flow/${encodeURIComponent(e)}`);if(!t.ok){if(404===t.status)return r.debug(`getFlow: Flow ${e} not found`),null;let a=await t.json();throw Error(a.error||`Failed to get flow: ${e}`)}let a=await t.json();return r.debug("getFlow: Retrieved flow from API",{flowId:e}),a}catch(t){return r.warn(`getFlow: Failed to get flow ${e}:`,t),null}}async createModelAgent(e){let t=await fetch("/api/flow/model-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof a?.flowId||"string"!=typeof a?.name)throw Error(a?.error||"Could not create the agent.");return this.flowsCache=null,{flowId:a.flowId,name:a.name}}async addFlow(e){r.debug("addFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to add flow"}}let a=await t.json();return this.flowsCache&&this.flowsCache.push(a),r.debug("addFlow: Flow added successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("addFlow: Failed to add flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to add flow"}}}async generateFlow(e,t,a){r.debug("generateFlow: Entering method",{modelId:t,allowInstall:a?.allowInstall,allowSubflows:a?.allowSubflows,maxDepth:a?.maxDepth});try{let o=await fetch("/api/flow/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:e,modelId:t,allowInstall:a?.allowInstall===!0,allowSubflows:a?.allowSubflows!==!1,..."number"==typeof a?.maxDepth?{maxDepth:a.maxDepth}:{}})}),n=await o.json().catch(()=>null);if(!o.ok)return{success:!1,error:n?.error||"Failed to generate flow"};let s=Array.isArray(n.flows)&&n.flows.length>0?n.flows:[{flow:n.flow,validation:n.validation}];return r.debug("generateFlow: Draft generated",{flowId:n.flow?.id,flowCount:s.length,attempts:n.attempts,errorCount:n.validation?.errorCount,installedServers:n.installedServers?.length??0}),{success:!0,flow:n.flow,validation:n.validation,flows:s,rootFlowId:n.rootFlowId??n.flow?.id,attempts:n.attempts,installedServers:n.installedServers??[]}}catch(e){return r.warn("generateFlow: Failed to generate flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to generate flow"}}}async improveFlow(e,t,a,o){r.debug("improveFlow: Entering method",{flowId:e?.id,modelId:a,allowInstall:o?.allowInstall});try{let n=await fetch("/api/flow/improve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flow:e,relatedFlows:o?.relatedFlows,description:t,modelId:a,allowInstall:o?.allowInstall===!0})}),s=await n.json().catch(()=>null);if(!n.ok)return{success:!1,error:s?.error||"Failed to improve flow"};return r.debug("improveFlow: Draft revised",{flowId:s.flow?.id,attempts:s.attempts,errorCount:s.validation?.errorCount,installedServers:s.installedServers?.length??0}),{success:!0,flow:s.flow,validation:s.validation,flows:Array.isArray(s.flows)&&s.flows.length>0?s.flows:[{flow:s.flow,validation:s.validation}],rootFlowId:s.rootFlowId??s.flow?.id,attempts:s.attempts,installedServers:s.installedServers??[]}}catch(e){return r.warn("improveFlow: Failed to improve flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to improve flow"}}}async convertProcessToSubflow(e,t,a,o){try{let r=await fetch(`/api/flow/${encodeURIComponent(e.id)}/convert-process-to-subflow`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentFlow:e,childFlow:t,processNodeId:a,expectedUpdatedAt:o})}),n=await r.json().catch(()=>null);if(!r.ok)return{success:!1,error:n?.error||"Failed to convert Process to Subflow."};let s=n.parentFlow,i=n.childFlow;if(this.flowsCache){let e=this.flowsCache.findIndex(e=>e.id===s.id);e>=0?this.flowsCache[e]=s:this.flowsCache.push(s),this.flowsCache.some(e=>e.id===i.id)||this.flowsCache.push(i)}return{success:!0,parentFlow:s,childFlow:i}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Failed to convert Process to Subflow."}}}async updateFlow(e){r.debug("updateFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch(`/api/flow/${encodeURIComponent(e.id)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to update flow"}}let a=await t.json();if(this.flowsCache){let t=this.flowsCache.findIndex(t=>t.id===e.id);t>=0?this.flowsCache[t]=a:this.flowsCache.push(a)}return r.debug("updateFlow: Flow updated successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("updateFlow: Failed to update flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to update flow"}}}async deleteFlow(e){r.debug("deleteFlow: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to delete flow"}}return this.flowsCache&&(this.flowsCache=this.flowsCache.filter(t=>t.id!==e)),r.debug("deleteFlow: Flow deleted successfully",{flowId:e}),{success:!0}}catch(e){return r.warn("deleteFlow: Failed to delete flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to delete flow"}}}async listFlowVersions(e){r.debug("listFlowVersions: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}/versions`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to list flow versions")}let a=await t.json();return Array.isArray(a.versions)?a.versions:[]}catch(t){return r.warn(`listFlowVersions: Failed for flow ${e}:`,t),[]}}async getFlowVersion(e,t){r.debug("getFlowVersion: Entering method",{flowId:e,versionId:t});try{let a=await fetch(`/api/flow/${encodeURIComponent(e)}/versions/${encodeURIComponent(t)}`);if(!a.ok){if(404===a.status)return null;let e=await a.json().catch(()=>null);throw Error(e?.error||"Failed to get flow version")}return await a.json()}catch(a){return r.warn(`getFlowVersion: Failed for ${e}/${t}:`,a),null}}createNode(e,t){return r.debug("createNode: Entering method",{type:e,position:t}),{id:(0,o.A)(),type:e,position:t,data:{label:`${"mcp"===e?"MCP":e.charAt(0).toUpperCase()+e.slice(1)} Node`,type:e,properties:"process"===e?{inputMode:"full-history"}:"static"===e?{entries:[]}:"subflow"===e?{resultPresentation:"separate",sessionScope:"per-key"}:{}}}}createStartNode(){return{id:(0,o.A)(),type:"start",position:{x:250,y:150},data:{label:"Start Node",type:"start",properties:{promptTemplate:""}}}}createNewFlow(e="NewFlow"){r.debug("createNewFlow: Entering method",{name:e});let t=Date.now();return{id:(0,o.A)(),name:e,createdAt:t,updatedAt:t,nodes:[this.createStartNode()],edges:[]}}createHistoryEntry(e,t){return r.debug("createHistoryEntry: Entering method"),{nodes:[...e],edges:[...t]}}generateSampleFlow(e="Sample Flow"){return r.debug("generateSampleFlow: Entering method",{name:e}),{id:(0,o.A)(),name:e,nodes:[{id:"1",type:"start",position:{x:250,y:50},data:{label:"Start Node",type:"start",properties:{prompt:"Enter your query here",systemMessage:"You are a helpful assistant",temperature:0}}},{id:"2",type:"process",position:{x:250,y:200},data:{label:"Process Node",type:"process",properties:{operation:"transform",enabled:!0}}},{id:"3",type:"finish",position:{x:250,y:350},data:{label:"Finish Node",type:"finish",properties:{format:"json",template:'{ "result": {{data}} }'}}},{id:"4",type:"mcp",position:{x:450,y:200},data:{label:"MCP Node",type:"mcp",properties:{channels:2,mode:"parallel"}}}],edges:[{id:"e1-2",source:"1",target:"2",type:"custom"},{id:"e2-3",source:"2",target:"3",type:"custom"}]}}constructor(){this.flowsCache=null}}let s=new n},90919:(e,t,a)=>{a.d(t,{G7:()=>l,m_:()=>c,pn:()=>i,qS:()=>s});let o=e=>e.flowId?`/flows?flow=${encodeURIComponent(e.flowId)}&mode=edit`:"/flows",r=e=>e.conversationId?`/chat?conversation=${encodeURIComponent(e.conversationId)}`:"/chat",n=e=>(e??"").replace(/\\/g,"\\\\").replace(/"/g,'\\"'),s=[{id:"intro",path:"/",placement:"center",title:"Give a chat agent internet access",body:"We’ll improve your Chat agent together. By the end, it will be able to look things up on the internet.",next:"go-to-chat",action:"start",actionLabel:"Start tutorial"},{id:"connect-ai",path:"/models",route:()=>"/models?add=1",target:'[data-tour="ai-setup-wizard"]',placement:"right",title:"Connect an AI first",body:"Save an AI connection in this wizard, then continue here. We will use its first answer to check that it works. If a connection already exists, close the wizard to review or test it.",next:"go-to-chat",action:"start",actionLabel:"Continue with connected AI",back:"intro"},{id:"go-to-chat",path:"/",target:'[data-tour="nav-chat"]',placement:"bottom",title:"Let’s start in Chat",body:"Go to Chat. I’ll use a fresh conversation for this explanation.",next:"new-conversation",back:"intro",advanceOnTargetClick:!0},{id:"new-conversation",path:"/chat",target:'[data-tour="chat-new-conversation"]',placement:"right",title:"Start a new conversation",body:"Choose New conversation so our little experiment stays separate from your other chats.",next:"flow-picker-explain",back:"go-to-chat",advanceOnTargetClick:!0},{id:"flow-picker-explain",path:"/chat",route:r,target:'[data-tour="chat-flow-picker"]',placement:"bottom",title:"This chooses the agent",body:"Different agents can do different things. It all depends on what you set up for them.",next:"open-flow-picker",back:"new-conversation"},{id:"open-flow-picker",path:"/chat",route:r,target:'[data-tour="chat-flow-picker"]',placement:"bottom",title:"Choose the Chat agent",body:"Open the agent picker.",next:"choose-chat",back:"flow-picker-explain",advanceOnTargetClick:!0},{id:"choose-chat",path:"/chat",route:r,target:e=>e.flowId?`[data-tutorial-flow-id="${n(e.flowId)}"]`:void 0,placement:"right",title:"Select Chat",body:"There it is. Select the Chat agent for this conversation.",next:"chat-overview",back:"open-flow-picker",advanceOnTargetClick:!0,onEnter:"open-chat-flow-picker"},{id:"chat-overview",path:"/chat",route:r,target:'[data-tour="chat-flow-picker"]',placement:"bottom",title:"Ready",body:"This conversation is now using your Chat agent. Let’s see what it can do before we change anything.",next:"send-first-question",back:"choose-chat"},{id:"send-first-question",path:"/chat",route:r,target:'[data-tour="chat-input"]',placement:"top",title:"Try a current-events question",body:"I’ll ask: “Hey! What happened on the internet today?”",next:"wait-for-first-answer",back:"chat-overview",action:"send-example",actionLabel:"Send example"},{id:"wait-for-first-answer",path:"/chat",route:r,placement:"center",waitFor:'[data-tutorial-chat-status="completed"]',title:"Waiting for the answer…",body:"The tutorial will continue as soon as the Chat agent finishes.",next:"plain-chat",back:"send-first-question"},{id:"plain-chat",path:"/chat",route:r,target:'[data-tour="chat-messages"]',placement:"left",title:"This is a simple chat",body:"It can respond, but it cannot look anything up yet. That’s not a lot.",next:"why-apps",back:"send-first-question"},{id:"why-apps",path:"/chat",route:r,placement:"center",title:"Agents can use apps",body:"You might want web search, news, or even a spreadsheet on your computer. We can give an agent access to the apps it needs.",next:"builder-shortcut",back:"plain-chat"},{id:"builder-shortcut",path:"/chat",route:r,target:'[data-tour="chat-open-agent"]',placement:"bottom",title:"A useful shortcut",body:"This button jumps straight into the editor. We could use it, but let’s start from the Agents page so the whole path makes sense.",next:"agents-navigation",back:"why-apps"},{id:"agents-navigation",path:"/chat",route:r,target:'[data-tour="nav-flows"]',placement:"bottom",title:"Open your Agents page",body:"Let’s go!",next:"agents-overview",back:"builder-shortcut",advanceOnTargetClick:!0},{id:"agents-overview",path:"/flows",target:'[data-tour="agents-search"]',placement:"bottom",title:"These are your agents",body:"This page keeps every agent you’ve created. Let’s find your Chat agent.",next:"find-chat-agent",back:"agents-navigation"},{id:"find-chat-agent",path:"/flows",target:'[data-tour="agents-search"]',placement:"bottom",title:"Search for Chat",body:"I’ve narrowed the list down to “Chat” for you.",next:"edit-chat-agent",back:"agents-overview",onEnter:"filter-chat-agent"},{id:"edit-chat-agent",path:"/flows",target:e=>e.flowId?`[data-tutorial-edit-flow-id="${n(e.flowId)}"]`:void 0,placement:"top",title:"Ah, there it is",body:"Open the Chat agent for editing.",next:"builder-overview",back:"find-chat-agent",advanceOnTargetClick:!0},{id:"builder-overview",path:"/flows",route:o,target:'[data-tour="flow-builder"]',placement:"center",title:"This is the Flow Builder",body:"An agent is a small sequence of steps. Your Chat agent is intentionally simple.",next:"start-node",back:"edit-chat-agent"},{id:"start-node",path:"/flows",route:o,target:'[data-tour="flow-start-node"]',placement:"right",title:"It starts here",body:"The Start step is where each new request enters the agent.",next:"process-node",back:"builder-overview"},{id:"process-node",path:"/flows",route:o,target:'[data-tour="flow-process-node"]',placement:"right",title:"Then the AI answers",body:"This single AI step is where the magic happens.",next:"finish-node",back:"start-node"},{id:"finish-node",path:"/flows",route:o,target:'[data-tour="flow-finish-node"]',placement:"right",title:"Then it finishes",body:"The Finish step sends the result back to the conversation.",next:"select-process",back:"process-node"},{id:"select-process",path:"/flows",route:o,target:'[data-tour="flow-process-node"]',placement:"right",title:"Select the AI step",body:"Click the AI step to see its simple settings on the right.",next:"inspector",back:"finish-node",advanceOnTargetClick:!0},{id:"inspector",path:"/flows",route:o,target:'[data-tour="flow-inspector"]',placement:"left",title:"The settings panel",body:"This is where you tell the selected step what should happen.",next:"task-prompt",back:"select-process"},{id:"task-prompt",path:"/flows",route:o,target:'[data-tour="flow-task-prompt"]',placement:"left",title:"The task prompt",body:e=>{let t=e.taskPrompt?.trim()||"Reply helpfully to the user.",a=t.length>180?`${t.slice(0,177)}…`:t;return`Right now it says: “${a}” You can rewrite this in everyday language.`},next:"full-settings",back:"inspector"},{id:"full-settings",path:"/flows",route:o,target:'[data-tour="flow-full-settings"], [data-tour="flow-process-node"]',placement:"left",title:"More settings are available",body:"Double-click the AI step, or choose Full settings here, whenever you need the complete set of options.",next:"connected-apps",back:"task-prompt"},{id:"connected-apps",path:"/flows",route:o,target:'[data-tour="flow-connected-apps"]',placement:"left",title:"Connect an app here",body:"Down here, you can connect one of your installed apps to this AI step.",next:"open-app-picker",back:"full-settings"},{id:"open-app-picker",path:"/flows",route:o,target:'[data-tour="flow-add-app"]',placement:"left",title:"Add a web-search app",body:"Choose the + button. I’ll check which installed app is the best fit.",next:"suggest-app",back:"connected-apps",advanceOnTargetClick:!0},{id:"suggest-app",path:"/flows",route:o,placement:"center",title:"Let me check something real quick",body:"I’ll look at the apps that are actually installed and ask the step helper for a useful web-search option.",back:"open-app-picker",action:"check-apps",actionLabel:"Check installed apps"},{id:"connect-app",path:"/flows",route:o,target:e=>e.recommendedServerName?`[data-tutorial-server-name="${n(e.recommendedServerName)}"]`:void 0,placement:"left",title:e=>`Use ${e.recommendedServerName??"this app"}`,body:"Great. Click the app to connect it to this AI step. Its available actions will be included automatically.",next:"wait-for-app-connection",back:"suggest-app",advanceOnTargetClick:!0,onEnter:"prepare-app-picker"},{id:"wait-for-app-connection",path:"/flows",route:o,placement:"center",waitFor:'[data-tutorial-app-connected="true"]',title:"Connecting the app…",body:"I’ll continue as soon as the app is connected to the AI step.",next:"app-instructions",back:"connect-app"},{id:"app-instructions",path:"/flows",route:o,target:'[data-tour="flow-task-prompt"]',placement:"left",title:"Optional: give special instructions",body:"If you want, you can add when or how the agent should use this app. The simple prompt is enough for now.",next:"save-agent",back:"wait-for-app-connection"},{id:"save-agent",path:"/flows",route:o,target:'[data-tour="flow-save"]',placement:"bottom",title:"Save your improved agent",body:"Save the change so Chat can use the connected app.",next:"wait-for-save",back:"app-instructions",advanceOnTargetClick:!0},{id:"wait-for-save",path:"/flows",route:o,placement:"center",waitFor:'[data-tutorial-save-status="saved"]',title:"Saving…",body:"I’ll continue when the updated agent is safely saved.",next:"return-to-chat",back:"save-agent"},{id:"return-to-chat",path:"/chat",route:r,target:'[data-tour="chat-input"]',placement:"top",title:"Let’s see it in action",body:"We’re back in the same conversation. Let’s ask the same question again.",next:"send-second-question",back:"wait-for-save"},{id:"send-second-question",path:"/chat",route:r,target:'[data-tour="chat-input"]',placement:"top",title:"Try it again",body:"This time, the agent can use the app you connected.",next:"wait-for-second-answer",back:"return-to-chat",action:"send-example",actionLabel:"Ask again"},{id:"wait-for-second-answer",path:"/chat",route:r,placement:"center",waitFor:'[data-tutorial-chat-status="completed"]',title:"Waiting for the improved answer…",body:"The agent may take a little longer while it looks things up.",next:"complete",back:"send-second-question"},{id:"complete",path:"/chat",route:r,placement:"center",title:"Much better, isn’t it?",body:"That’s how you edit an agent and connect an app to it. Keep flowing.",back:"send-second-question",action:"finish",actionLabel:"Finish Stage 1"},{id:"install-app-intro",path:"/mcp",target:'[data-tour="add-mcp-server"]',placement:"bottom",title:"Add a web-search app",body:"I couldn’t find a working web-search app yet. Open the app setup and we’ll add one.",next:"install-app-marketplace",advanceOnTargetClick:!0,nested:"install-web-app"},{id:"install-app-marketplace",path:"/mcp",target:'[data-tour="mcp-marketplace-tab"]',placement:"bottom",title:"Open the Marketplace",body:"The Marketplace lists apps you can add to FLUJO.",next:"install-app-search",back:"install-app-intro",advanceOnTargetClick:!0,onEnter:"open-app-marketplace",nested:"install-web-app"},{id:"install-app-search",path:"/mcp",target:'[data-tour="mcp-marketplace-search"]',placement:"bottom",title:"Search for web search",body:"Search for “web search” and install a trustworthy option. Finish any setup it asks for, then let me check again.",back:"install-app-marketplace",action:"check-apps",actionLabel:"I installed one — check again",onEnter:"open-app-marketplace",nested:"install-web-app"},{id:"enable-app",path:"/mcp",target:e=>e.recommendedServerName?`[data-tutorial-server-toggle="${n(e.recommendedServerName)}"]`:void 0,placement:"top",title:e=>`Turn on ${e.recommendedServerName??"the app"}`,body:"The app is installed, but it is switched off. Turn it on so the agent can use it.",next:"enable-app-check",advanceOnTargetClick:!0,nested:"enable-web-app"},{id:"enable-app-check",path:"/mcp",placement:"center",title:"Give it a moment to connect",body:"Once it is ready, I’ll check its available actions and take us back to the Chat agent.",back:"enable-app",action:"check-apps",actionLabel:"Check the app",nested:"enable-web-app"},{id:"return-to-app-picker",path:"/flows",route:o,target:'[data-tour="flow-process-node"]',placement:"right",title:"Back to the Chat agent",body:"Select the AI step again, then we’ll connect the app we just prepared.",next:"return-select-process",advanceOnTargetClick:!0},{id:"return-select-process",path:"/flows",route:o,target:'[data-tour="flow-add-app"]',placement:"left",title:"Open the app picker",body:"Choose + one more time.",next:"connect-app",back:"return-to-app-picker",advanceOnTargetClick:!0}],i=new Map(s.map(e=>[e.id,e]));function l(e,t){return"function"==typeof e?e(t):e}function c(e,t){return"function"==typeof e.target?e.target(t):e.target}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3408],{8901:(e,t,a)=>{a.d(t,{IU:()=>r,Ri:()=>n,dD:()=>o});let o="flujo:big-tutorial";function r(e){window.dispatchEvent(new CustomEvent(o,{detail:e}))}function n(e){return e instanceof CustomEvent&&!!e.detail&&"string"==typeof e.detail.type}},13408:(e,t,a)=>{a.r(t),a.d(t,{TourProvider:()=>k,useTour:()=>y});var o=a(95155),r=a(12115),n=a(19260),s=a(80967),i=a(24437),l=a(90919),c=a(8901);let d="Reply helpfully to the user.";var p=a(65614),u=a(32897),h=a(97312),w=a(68588);let f=(0,a(49103).h)("frontend/contexts/TourContext"),g={status:"active",stepId:"intro"};class m extends Error{}let b=(0,r.createContext)({isActive:!1,stepIndex:0,dashboardRestoreId:0,saveDashboardDismissals:()=>{},canStartTour:!1,startTour:()=>{},next:()=>{},back:()=>{},endTour:()=>{},isBigTutorialActive:!1,bigTutorialProgress:g,bigTutorialBusy:!1,bigTutorialError:null,bigTutorialRunStatus:null,bigTutorialConnectedServer:null,startBigTutorial:async()=>{},resumeBigTutorial:async()=>{},nextBigTutorial:async()=>{},backBigTutorial:async()=>{},runBigTutorialAction:async()=>{},pauseBigTutorial:async()=>{},restartBigTutorial:async()=>{}}),y=()=>(0,r.useContext)(b);function v(e){let t=e.toLocaleLowerCase();return[["web search",12],["internet",10],["search_web",10],["web_search",10],["brave",9],["duckduckgo",9],["google search",9],["news",7],["browser",6],["search",5],["fetch",2]].reduce((e,[a,o])=>e+(t.includes(a)?o:0),0)}let k=({children:e})=>{let{settings:t,updateSettings:a,isLoading:y,settingsHydrated:k}=(0,s.useStorage)(),C=k&&!y,I=(0,r.useRef)(t);I.current=t;let[T,S]=(0,r.useState)(!1),[F,x]=(0,r.useState)(0),[E,A]=(0,r.useState)(0),[N,O]=(0,r.useState)(!1),[j,$]=(0,r.useState)(t.onboarding?.tutorials?.bigTutorialStage1??g),P=(0,r.useRef)(j),[L,D]=(0,r.useState)(!1),[R,M]=(0,r.useState)(null),[U,q]=(0,r.useState)(null),[J,B]=(0,r.useState)(null),H=(0,r.useRef)(!1),W=(0,r.useRef)(!1),V=(0,r.useRef)(Promise.resolve()),z=(0,r.useRef)(Promise.resolve()),_=(0,r.useCallback)(e=>{z.current=z.current.then(async()=>{let t=I.current,o=e(t);o!==t&&(await a(o),I.current===t&&(I.current=o))}).catch(e=>f.warn("Failed to persist guided tour settings",e))},[a]),G=(0,r.useCallback)(()=>{_(e=>({...e,onboarding:{...e.onboarding??{},completed:!0}}))},[_]),Y=(0,r.useCallback)(e=>{_(t=>({...t,onboarding:{...t.onboarding??{},completed:t.onboarding?.completed??!1,dashboardCardsHidden:!1,dashboardDismissedCards:e}}))},[_]),K=(0,r.useCallback)(e=>{let t=V.current.then(async()=>{let t=I.current,o={...t,onboarding:{...t.onboarding??{},completed:t.onboarding?.completed??!0,tutorials:{...t.onboarding?.tutorials??{},bigTutorialStage1:e}}};I.current=o,await a(o)}).catch(e=>{f.warn("Failed to persist Stage 1 tutorial progress",e)});return V.current=t,t},[a]),Q=(0,r.useCallback)(async e=>{P.current=e,$(e),await K(e)},[K]),X=(0,r.useCallback)(()=>{C&&(f.info("Starting guided tour"),A(e=>e+1),_(e=>{let t=e.onboarding,a=Array.isArray(t?.dashboardDismissedCards)?t.dashboardDismissedCards:[];return t?.dashboardCardsHidden===!0||a.some(e=>w.KV.includes(e))?{...e,onboarding:{...t??{},completed:t?.completed??!1,dashboardCardsHidden:!1,dashboardDismissedCards:a.filter(e=>!w.KV.includes(e))}}:e}),O(!1),x(0),S(!0))},[C,_]),Z=(0,r.useCallback)(()=>{f.info("Ending guided tour"),S(!1),G()},[G]),ee=(0,r.useCallback)(()=>{x(e=>e>=i.$.length-1?(S(!1),G(),e):e+1)},[G]),et=(0,r.useCallback)(()=>x(e=>Math.max(0,e-1)),[]),ea=(0,r.useCallback)(async()=>{let e=P.current,t=(await u.N6.loadModels()).filter(e=>e.id&&e.name?.trim()&&e.provider),a=t.find(e=>e.favorite&&!1!==e.supportsTools)??t.find(e=>!1!==e.supportsTools)??t.find(e=>e.favorite)??t[0];if(!a)throw new m("Connect an AI in AI Setup, then continue the tutorial.");let o=await p.g.loadFlows(),r=function(e){let t=e.find(e=>"chat"===e.name.trim().toLocaleLowerCase());if(!t)return null;let a=t.nodes.find(e=>"process"===e.data.type);return a?{flow:t,processNodeId:a.id}:null}(o);if(r){let o=r.flow.nodes.find(e=>e.id===r.processNodeId);if(!t.some(e=>e.id===o?.data.properties?.boundModel)){let e={...r.flow,nodes:r.flow.nodes.map(e=>e.id===r.processNodeId?{...e,data:{...e.data,properties:{...e.data.properties,boundModel:a.id}}}:e)},t=await p.g.updateFlow(e);if(!t.success)throw Error(t.error||"I could not connect the AI to the Chat agent.")}let n="string"==typeof o?.data.properties?.promptTemplate?o.data.properties.promptTemplate:void 0,s={...e,flowId:r.flow.id,processNodeId:r.processNodeId,taskPrompt:n};return await Q(s),s}if(o.find(e=>"chat"===e.name.trim().toLocaleLowerCase()))throw Error("I found a Chat agent, but it has no AI step. Add one or rename that agent, then restart this tutorial.");let s=function(e,t){if(!e.trim())throw Error("Connect an AI before creating the tutorial agent.");let a=Date.now(),o=t(),r=t(),n=t(),s=t(),i=[{id:r,type:"start",position:{x:250,y:80},data:{label:"Start Node",type:"start",properties:{promptTemplate:""}}},{id:n,type:"process",position:{x:250,y:260},data:{label:"Ask AI",type:"process",properties:{promptTemplate:d,inputMode:"full-history",outputMode:"latest-message",boundModel:e}}},{id:s,type:"finish",position:{x:250,y:440},data:{label:"Finish Node",type:"finish",properties:{}}}],l=[{id:t(),source:r,sourceHandle:"start-bottom",target:n,targetHandle:"process-top",type:"flowEdge",data:{edgeType:"flow"}},{id:t(),source:n,sourceHandle:"process-bottom",target:s,targetHandle:"finish-top",type:"flowEdge",data:{edgeType:"flow"}}];return{processNodeId:n,flow:{id:o,name:"Chat",description:"A friendly agent for everyday conversations.",favorite:!0,createdAt:a,updatedAt:a,nodes:i,edges:l}}}(a.id,n.A),i=await p.g.addFlow(s.flow);if(!i.success)throw Error(i.error||"I could not create the Chat agent.");let l={...e,flowId:s.flow.id,processNodeId:s.processNodeId,taskPrompt:d};return await Q(l),l},[Q]),eo=(0,r.useCallback)(async e=>{e instanceof m&&await Q({...P.current,stepId:"connect-ai",status:"active"}),M(e instanceof Error?e.message:String(e))},[Q]),er=(0,r.useCallback)(async()=>{let e={...g};S(!1),M(null),B(null),q(null),await Q(e),O(!0)},[Q]),en=(0,r.useCallback)(async()=>{await er()},[er]),es=(0,r.useCallback)(async()=>{let e=I.current.onboarding?.tutorials?.bigTutorialStage1,t=e&&"paused"===e.status?{...e,status:"active"}:{...g};S(!1),M(null),await Q(t),O(!0),"intro"!==t.stepId&&"connect-ai"!==t.stepId&&ea().catch(eo)},[Q,ea,eo]),ei=(0,r.useCallback)(async e=>{let t=P.current;l.pn.has(e)&&(M(null),await Q({...t,status:"active",stepId:e}))},[Q]),el=(0,r.useCallback)(async()=>{let e=l.pn.get(P.current.stepId);e?.next&&await ei(e.next)},[ei]),ec=(0,r.useCallback)(async()=>{let e=l.pn.get(P.current.stepId);e?.back&&await ei(e.back)},[ei]),ed=(0,r.useCallback)(async()=>{B(null);let e=P.current;e.flowId&&e.processNodeId||(e=await ea());let t=e.flowId?await p.g.getFlow(e.flowId):null;if(!t||!e.processNodeId)throw Error("I cannot find the Chat agent right now. Please try again.");let a=await h.S.loadServerConfigs();if(!Array.isArray(a))throw Error(a?.error||"I could not read your installed apps.");let o=a.filter(e=>!e.disabled),r=await Promise.all(o.map(async e=>{let t=await h.S.listServerTools(e.name);return{config:e,tools:t.error||!Array.isArray(t.tools)?[]:t.tools}})),n=t.nodes.find(t=>t.id===e.processNodeId),s="string"==typeof n?.data.properties?.boundModel?n.data.properties.boundModel:(await u.N6.loadModels())[0]?.id,i=[];if(s)try{i=(await p.g.suggestToolsForStep({flow:t,nodeId:e.processNodeId,modelId:s,goal:"Let this friendly chat agent search the web and answer questions about current news and events."})).suggestions.filter(e=>v(`${e.server} ${e.tool} ${e.reason}`)>0).map(e=>e.server)}catch(e){f.warn("Stage 1 app suggestion failed; using the live tool catalog",e)}let l=r.map(({config:e,tools:t})=>({name:e.name,score:Math.max(100*!!i.includes(e.name),...t.map(t=>v(`${e.name} ${t.name} ${t.description??""}`))),toolCount:t.length})).filter(e=>e.toolCount>0&&e.score>0).sort((e,t)=>t.score-e.score||e.name.localeCompare(t.name));if(l[0]){let a=t.nodes.some(e=>"mcp"===e.data.type&&e.data.properties?.boundServer===l[0].name),o={...e,status:"active",recommendedServerName:l[0].name,nestedTutorialId:void 0,stepId:a?"app-instructions":e.nestedTutorialId?"return-to-app-picker":"connect-app"};await Q(o);return}let c=a.filter(e=>e.disabled).map(e=>({config:e,score:v(`${e.name} ${e.rootPath??""}`)})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score)[0]?.config;if(c)return void await Q({...e,status:"active",stepId:"enable-app",recommendedServerName:c.name,nestedTutorialId:"enable-web-app"});let d=o.find(e=>v(`${e.name} ${e.rootPath??""}`)>0);if(d)throw Error(`${d.name} is installed but is not ready yet. Give it a moment, then check again.`);await Q({...e,status:"active",stepId:"install-app-intro",recommendedServerName:void 0,nestedTutorialId:"install-web-app"})},[Q,ea]),ep=(0,r.useCallback)(async()=>{let e=l.pn.get(P.current.stepId);if(e&&!L){D(!0),M(null);try{if("start"===e.action)await ea(),e.next&&await ei(e.next);else if("send-example"===e.action){await ea();let t=P.current.conversationId;if(!t)throw Error("Start a new conversation and choose the Chat agent before sending the example.");q(null),(0,c.IU)({type:"send-example",conversationId:t,message:"Hey! What happened on the internet today?"}),e.next&&await ei(e.next)}else if("check-apps"===e.action)await ed();else if("finish"===e.action){let e={...P.current,status:"completed",stepId:"complete",nestedTutorialId:void 0};await Q(e),O(!1)}else e.next&&await ei(e.next)}catch(e){await eo(e)}finally{D(!1)}}},[L,ed,Q,ea,eo,ei]),eu=(0,r.useCallback)(async()=>{let e={...P.current,status:"paused"};await Q(e),O(!1)},[Q]);return(0,r.useEffect)(()=>{let e=e=>{(0,c.Ri)(e)&&N&&("conversation-created"===e.detail.type?Q({...P.current,conversationId:e.detail.conversationId}):"chat-run-status"===e.detail.type?e.detail.conversationId===P.current.conversationId&&q(e.detail.status):"app-connected"===e.detail.type&&B(e.detail.serverName))};return window.addEventListener(c.dD,e),()=>window.removeEventListener(c.dD,e)},[Q,N]),(0,r.useEffect)(()=>{y||!k||H.current||(H.current=!0,t.onboarding?.completed!==!0&&"/"===window.location.pathname&&(f.info("First run detected — auto-starting guided tour"),X()))},[y,k,t.onboarding?.completed,X]),(0,r.useEffect)(()=>{if(y||!k||W.current)return;W.current=!0;let e=t.onboarding?.tutorials?.bigTutorialStage1;e?.status==="active"&&(P.current=e,$(e),O(!0),"intro"!==e.stepId&&"connect-ai"!==e.stepId&&ea().catch(eo))},[ea,eo,y,t.onboarding,k]),(0,r.useEffect)(()=>{if(!k||N)return;let e=t.onboarding?.tutorials?.bigTutorialStage1;e&&(P.current=e,$(e))},[N,t.onboarding?.tutorials?.bigTutorialStage1,k]),(0,o.jsx)(b.Provider,{value:{isActive:T,stepIndex:F,dashboardRestoreId:E,saveDashboardDismissals:Y,canStartTour:C,startTour:X,next:ee,back:et,endTour:Z,isBigTutorialActive:N,bigTutorialProgress:j,bigTutorialBusy:L,bigTutorialError:R,bigTutorialRunStatus:U,bigTutorialConnectedServer:J,startBigTutorial:er,resumeBigTutorial:es,nextBigTutorial:el,backBigTutorial:ec,runBigTutorialAction:ep,pauseBigTutorial:eu,restartBigTutorial:en},children:e})}},24437:(e,t,a)=>{a.d(t,{$:()=>o});let o=[{id:"manage-ai-setup",path:"/",target:'[data-tour="manage-ai-setup"]',placement:"top",title:"tour.manageAi.title",body:"tour.manageAi.body"},{id:"nav-models",path:"/",target:'[data-tour="nav-models"]',placement:"bottom",title:"tour.aiNav.title",body:"tour.aiNav.body"},{id:"models-overview",path:"/models",target:'[data-tour="models-overview"]',placement:"center",title:"tour.aiOverview.title",body:"tour.aiOverview.body"},{id:"add-model",path:"/models",target:'[data-tour="add-model"]',placement:"bottom",title:"tour.connectAi.title",body:"tour.connectAi.body"},{id:"ai-setup-wizard",path:"/models",route:"/models?add=1",target:'[data-tour="ai-setup-wizard"]',placement:"right",title:"tour.aiWizard.title",body:"tour.aiWizard.body"},{id:"dashboard-create-flow",path:"/",target:'[data-tour="dashboard-create-flow"]',placement:"top",title:"tour.backDashboard.title",body:"tour.backDashboard.body"},{id:"new-flow",path:"/flows",target:'[data-tour="new-flow"]',placement:"bottom",title:"tour.createAgent.title",body:"tour.createAgent.body"},{id:"chat-input",path:"/chat",target:'[data-tour="chat-input"]',placement:"top",title:"tour.talk.title",body:"tour.talk.body"}]},65614:(e,t,a)=>{a.d(t,{g:()=>s});var o=a(19260);let r=(0,a(49103).h)("frontend/services/flow/index");class n{async loadFlows(e={}){r.debug("loadFlows: Entering method");try{if(this.flowsCache&&!e.refresh)return r.debug("loadFlows: Using cached flows",{count:this.flowsCache.length}),this.flowsCache;let t=await fetch("/api/flow");if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to load flows")}let a=await t.json();return r.debug("loadFlows: Loaded flows from API",{count:a.length}),this.flowsCache=a,a}catch(e){return r.warn("loadFlows: Failed to load flows:",e),[]}}async suggestToolsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-tools",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not suggest connected tools.");return a}async generateNameForFlow(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generate-name",...e})}),a=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof a?.name)throw Error(a?.error||"Could not generate a workflow name.");return{name:a.name}}async applyToolsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-tools",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not connect the approved tools.");return a.flow}async suggestAgentsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-agents",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not suggest connected agents.");return a}async applyAgentsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-agents",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not connect the approved agents.");return a.flow}async improvePromptForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"improve-prompt",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not improve this prompt.");return a}async checkPlausibility(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"check-plausibility",...e})}),a=await t.json().catch(()=>null);if(!t.ok)throw Error(a?.error||"Could not check flow plausibility.");return a}async getFlow(e){r.debug("getFlow: Entering method",{flowId:e});try{if(this.flowsCache){let t=this.flowsCache.find(t=>t.id===e);if(t)return r.debug("getFlow: Using cached flow",{flowId:e}),t}let t=await fetch(`/api/flow/${encodeURIComponent(e)}`);if(!t.ok){if(404===t.status)return r.debug(`getFlow: Flow ${e} not found`),null;let a=await t.json();throw Error(a.error||`Failed to get flow: ${e}`)}let a=await t.json();return r.debug("getFlow: Retrieved flow from API",{flowId:e}),a}catch(t){return r.warn(`getFlow: Failed to get flow ${e}:`,t),null}}async createModelAgent(e){let t=await fetch("/api/flow/model-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof a?.flowId||"string"!=typeof a?.name)throw Error(a?.error||"Could not create the agent.");return this.flowsCache=null,{flowId:a.flowId,name:a.name}}async addFlow(e){r.debug("addFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to add flow"}}let a=await t.json();return this.flowsCache&&this.flowsCache.push(a),r.debug("addFlow: Flow added successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("addFlow: Failed to add flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to add flow"}}}async generateFlow(e,t,a){r.debug("generateFlow: Entering method",{modelId:t,allowInstall:a?.allowInstall,allowSubflows:a?.allowSubflows,maxDepth:a?.maxDepth});try{let o=await fetch("/api/flow/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:e,modelId:t,allowInstall:a?.allowInstall===!0,allowSubflows:a?.allowSubflows!==!1,..."number"==typeof a?.maxDepth?{maxDepth:a.maxDepth}:{}})}),n=await o.json().catch(()=>null);if(!o.ok)return{success:!1,error:n?.error||"Failed to generate flow"};let s=Array.isArray(n.flows)&&n.flows.length>0?n.flows:[{flow:n.flow,validation:n.validation}];return r.debug("generateFlow: Draft generated",{flowId:n.flow?.id,flowCount:s.length,attempts:n.attempts,errorCount:n.validation?.errorCount,installedServers:n.installedServers?.length??0}),{success:!0,flow:n.flow,validation:n.validation,flows:s,rootFlowId:n.rootFlowId??n.flow?.id,attempts:n.attempts,installedServers:n.installedServers??[]}}catch(e){return r.warn("generateFlow: Failed to generate flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to generate flow"}}}async improveFlow(e,t,a,o){r.debug("improveFlow: Entering method",{flowId:e?.id,modelId:a,allowInstall:o?.allowInstall});try{let n=await fetch("/api/flow/improve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flow:e,relatedFlows:o?.relatedFlows,description:t,modelId:a,allowInstall:o?.allowInstall===!0})}),s=await n.json().catch(()=>null);if(!n.ok)return{success:!1,error:s?.error||"Failed to improve flow"};return r.debug("improveFlow: Draft revised",{flowId:s.flow?.id,attempts:s.attempts,errorCount:s.validation?.errorCount,installedServers:s.installedServers?.length??0}),{success:!0,flow:s.flow,validation:s.validation,flows:Array.isArray(s.flows)&&s.flows.length>0?s.flows:[{flow:s.flow,validation:s.validation}],rootFlowId:s.rootFlowId??s.flow?.id,attempts:s.attempts,installedServers:s.installedServers??[]}}catch(e){return r.warn("improveFlow: Failed to improve flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to improve flow"}}}async convertProcessToSubflow(e,t,a,o){try{let r=await fetch(`/api/flow/${encodeURIComponent(e.id)}/convert-process-to-subflow`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentFlow:e,childFlow:t,processNodeId:a,expectedUpdatedAt:o})}),n=await r.json().catch(()=>null);if(!r.ok)return{success:!1,error:n?.error||"Failed to convert Process to Subflow."};let s=n.parentFlow,i=n.childFlow;if(this.flowsCache){let e=this.flowsCache.findIndex(e=>e.id===s.id);e>=0?this.flowsCache[e]=s:this.flowsCache.push(s),this.flowsCache.some(e=>e.id===i.id)||this.flowsCache.push(i)}return{success:!0,parentFlow:s,childFlow:i}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Failed to convert Process to Subflow."}}}async updateFlow(e){r.debug("updateFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch(`/api/flow/${encodeURIComponent(e.id)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to update flow"}}let a=await t.json();if(this.flowsCache){let t=this.flowsCache.findIndex(t=>t.id===e.id);t>=0?this.flowsCache[t]=a:this.flowsCache.push(a)}return r.debug("updateFlow: Flow updated successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("updateFlow: Failed to update flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to update flow"}}}async deleteFlow(e){r.debug("deleteFlow: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);return{success:!1,error:"string"==typeof e?.error&&e.error?e.error:"Failed to delete flow"}}return this.flowsCache&&(this.flowsCache=this.flowsCache.filter(t=>t.id!==e)),r.debug("deleteFlow: Flow deleted successfully",{flowId:e}),{success:!0}}catch(e){return r.warn("deleteFlow: Failed to delete flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to delete flow"}}}async listFlowVersions(e){r.debug("listFlowVersions: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}/versions`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to list flow versions")}let a=await t.json();return Array.isArray(a.versions)?a.versions:[]}catch(t){return r.warn(`listFlowVersions: Failed for flow ${e}:`,t),[]}}async getFlowVersion(e,t){r.debug("getFlowVersion: Entering method",{flowId:e,versionId:t});try{let a=await fetch(`/api/flow/${encodeURIComponent(e)}/versions/${encodeURIComponent(t)}`);if(!a.ok){if(404===a.status)return null;let e=await a.json().catch(()=>null);throw Error(e?.error||"Failed to get flow version")}return await a.json()}catch(a){return r.warn(`getFlowVersion: Failed for ${e}/${t}:`,a),null}}createNode(e,t){return r.debug("createNode: Entering method",{type:e,position:t}),{id:(0,o.A)(),type:e,position:t,data:{label:`${"mcp"===e?"MCP":e.charAt(0).toUpperCase()+e.slice(1)} Node`,type:e,properties:"process"===e?{inputMode:"full-history"}:"static"===e?{entries:[]}:"subflow"===e?{resultPresentation:"separate",sessionScope:"per-key"}:{}}}}createStartNode(){return{id:(0,o.A)(),type:"start",position:{x:250,y:150},data:{label:"Start Node",type:"start",properties:{promptTemplate:""}}}}createNewFlow(e="NewFlow"){r.debug("createNewFlow: Entering method",{name:e});let t=Date.now();return{id:(0,o.A)(),name:e,createdAt:t,updatedAt:t,nodes:[this.createStartNode()],edges:[]}}createHistoryEntry(e,t){return r.debug("createHistoryEntry: Entering method"),{nodes:[...e],edges:[...t]}}generateSampleFlow(e="Sample Flow"){return r.debug("generateSampleFlow: Entering method",{name:e}),{id:(0,o.A)(),name:e,nodes:[{id:"1",type:"start",position:{x:250,y:50},data:{label:"Start Node",type:"start",properties:{prompt:"Enter your query here",systemMessage:"You are a helpful assistant",temperature:0}}},{id:"2",type:"process",position:{x:250,y:200},data:{label:"Process Node",type:"process",properties:{operation:"transform",enabled:!0}}},{id:"3",type:"finish",position:{x:250,y:350},data:{label:"Finish Node",type:"finish",properties:{format:"json",template:'{ "result": {{data}} }'}}},{id:"4",type:"mcp",position:{x:450,y:200},data:{label:"MCP Node",type:"mcp",properties:{channels:2,mode:"parallel"}}}],edges:[{id:"e1-2",source:"1",target:"2",type:"custom"},{id:"e2-3",source:"2",target:"3",type:"custom"}]}}constructor(){this.flowsCache=null}}let s=new n},90919:(e,t,a)=>{a.d(t,{G7:()=>l,m_:()=>c,pn:()=>i,qS:()=>s});let o=e=>e.flowId?`/flows?flow=${encodeURIComponent(e.flowId)}&mode=edit`:"/flows",r=e=>e.conversationId?`/chat?conversation=${encodeURIComponent(e.conversationId)}`:"/chat",n=e=>(e??"").replace(/\\/g,"\\\\").replace(/"/g,'\\"'),s=[{id:"intro",path:"/",placement:"center",title:"Give a chat agent internet access",body:"We’ll improve your Chat agent together. By the end, it will be able to look things up on the internet.",next:"go-to-chat",action:"start",actionLabel:"Start tutorial"},{id:"connect-ai",path:"/models",route:()=>"/models?add=1",target:'[data-tour="ai-setup-wizard"]',placement:"right",title:"Connect an AI first",body:"Save an AI connection in this wizard, then continue here. We will use its first answer to check that it works. If a connection already exists, close the wizard to review or test it.",next:"go-to-chat",action:"start",actionLabel:"Continue with connected AI",back:"intro"},{id:"go-to-chat",path:"/",target:'[data-tour="nav-chat"]',placement:"bottom",title:"Let’s start in Chat",body:"Go to Chat. I’ll use a fresh conversation for this explanation.",next:"new-conversation",back:"intro",advanceOnTargetClick:!0},{id:"new-conversation",path:"/chat",target:'[data-tour="chat-new-conversation"]',placement:"right",title:"Start a new conversation",body:"Choose New conversation so our little experiment stays separate from your other chats.",next:"flow-picker-explain",back:"go-to-chat",advanceOnTargetClick:!0},{id:"flow-picker-explain",path:"/chat",route:r,target:'[data-tour="chat-flow-picker"]',placement:"bottom",title:"This chooses the agent",body:"Different agents can do different things. It all depends on what you set up for them.",next:"open-flow-picker",back:"new-conversation"},{id:"open-flow-picker",path:"/chat",route:r,target:'[data-tour="chat-flow-picker"]',placement:"bottom",title:"Choose the Chat agent",body:"Open the agent picker.",next:"choose-chat",back:"flow-picker-explain",advanceOnTargetClick:!0},{id:"choose-chat",path:"/chat",route:r,target:e=>e.flowId?`[data-tutorial-flow-id="${n(e.flowId)}"]`:void 0,placement:"right",title:"Select Chat",body:"There it is. Select the Chat agent for this conversation.",next:"chat-overview",back:"open-flow-picker",advanceOnTargetClick:!0,onEnter:"open-chat-flow-picker"},{id:"chat-overview",path:"/chat",route:r,target:'[data-tour="chat-flow-picker"]',placement:"bottom",title:"Ready",body:"This conversation is now using your Chat agent. Let’s see what it can do before we change anything.",next:"send-first-question",back:"choose-chat"},{id:"send-first-question",path:"/chat",route:r,target:'[data-tour="chat-input"]',placement:"top",title:"Try a current-events question",body:"I’ll ask: “Hey! What happened on the internet today?”",next:"wait-for-first-answer",back:"chat-overview",action:"send-example",actionLabel:"Send example"},{id:"wait-for-first-answer",path:"/chat",route:r,placement:"center",waitFor:'[data-tutorial-chat-status="completed"]',title:"Waiting for the answer…",body:"The tutorial will continue as soon as the Chat agent finishes.",next:"plain-chat",back:"send-first-question"},{id:"plain-chat",path:"/chat",route:r,target:'[data-tour="chat-messages"]',placement:"left",title:"This is a simple chat",body:"It can respond, but it cannot look anything up yet. That’s not a lot.",next:"why-apps",back:"send-first-question"},{id:"why-apps",path:"/chat",route:r,placement:"center",title:"Agents can use apps",body:"You might want web search, news, or even a spreadsheet on your computer. We can give an agent access to the apps it needs.",next:"builder-shortcut",back:"plain-chat"},{id:"builder-shortcut",path:"/chat",route:r,target:'[data-tour="chat-open-agent"]',placement:"bottom",title:"A useful shortcut",body:"This button jumps straight into the editor. We could use it, but let’s start from the Agents page so the whole path makes sense.",next:"agents-navigation",back:"why-apps"},{id:"agents-navigation",path:"/chat",route:r,target:'[data-tour="nav-flows"]',placement:"bottom",title:"Open your Agents page",body:"Let’s go!",next:"agents-overview",back:"builder-shortcut",advanceOnTargetClick:!0},{id:"agents-overview",path:"/flows",target:'[data-tour="agents-search"]',placement:"bottom",title:"These are your agents",body:"This page keeps every agent you’ve created. Let’s find your Chat agent.",next:"find-chat-agent",back:"agents-navigation"},{id:"find-chat-agent",path:"/flows",target:'[data-tour="agents-search"]',placement:"bottom",title:"Search for Chat",body:"I’ve narrowed the list down to “Chat” for you.",next:"edit-chat-agent",back:"agents-overview",onEnter:"filter-chat-agent"},{id:"edit-chat-agent",path:"/flows",target:e=>e.flowId?`[data-tutorial-edit-flow-id="${n(e.flowId)}"]`:void 0,placement:"top",title:"Ah, there it is",body:"Open the Chat agent for editing.",next:"builder-overview",back:"find-chat-agent",advanceOnTargetClick:!0},{id:"builder-overview",path:"/flows",route:o,target:'[data-tour="flow-builder"]',placement:"center",title:"This is the Flow Builder",body:"An agent is a small sequence of steps. Your Chat agent is intentionally simple.",next:"start-node",back:"edit-chat-agent"},{id:"start-node",path:"/flows",route:o,target:'[data-tour="flow-start-node"]',placement:"right",title:"It starts here",body:"The Start step is where each new request enters the agent.",next:"process-node",back:"builder-overview"},{id:"process-node",path:"/flows",route:o,target:'[data-tour="flow-process-node"]',placement:"right",title:"Then the AI answers",body:"This single AI step is where the magic happens.",next:"finish-node",back:"start-node"},{id:"finish-node",path:"/flows",route:o,target:'[data-tour="flow-finish-node"]',placement:"right",title:"Then it finishes",body:"The Finish step sends the result back to the conversation.",next:"select-process",back:"process-node"},{id:"select-process",path:"/flows",route:o,target:'[data-tour="flow-process-node"]',placement:"right",title:"Select the AI step",body:"Click the AI step to see its simple settings on the right.",next:"inspector",back:"finish-node",advanceOnTargetClick:!0},{id:"inspector",path:"/flows",route:o,target:'[data-tour="flow-inspector"]',placement:"left",title:"The settings panel",body:"This is where you tell the selected step what should happen.",next:"task-prompt",back:"select-process"},{id:"task-prompt",path:"/flows",route:o,target:'[data-tour="flow-task-prompt"]',placement:"left",title:"The task prompt",body:e=>{let t=e.taskPrompt?.trim()||"Reply helpfully to the user.",a=t.length>180?`${t.slice(0,177)}…`:t;return`Right now it says: “${a}” You can rewrite this in everyday language.`},next:"full-settings",back:"inspector"},{id:"full-settings",path:"/flows",route:o,target:'[data-tour="flow-full-settings"], [data-tour="flow-process-node"]',placement:"left",title:"More settings are available",body:"Double-click the AI step, or choose Full settings here, whenever you need the complete set of options.",next:"connected-apps",back:"task-prompt"},{id:"connected-apps",path:"/flows",route:o,target:'[data-tour="flow-connected-apps"]',placement:"left",title:"Connect an app here",body:"Down here, you can connect one of your installed apps to this AI step.",next:"open-app-picker",back:"full-settings"},{id:"open-app-picker",path:"/flows",route:o,target:'[data-tour="flow-add-app"]',placement:"left",title:"Add a web-search app",body:"Choose the + button. I’ll check which installed app is the best fit.",next:"suggest-app",back:"connected-apps",advanceOnTargetClick:!0},{id:"suggest-app",path:"/flows",route:o,placement:"center",title:"Let me check something real quick",body:"I’ll look at the apps that are actually installed and ask the step helper for a useful web-search option.",back:"open-app-picker",action:"check-apps",actionLabel:"Check installed apps"},{id:"connect-app",path:"/flows",route:o,target:e=>e.recommendedServerName?`[data-tutorial-server-name="${n(e.recommendedServerName)}"]`:void 0,placement:"left",title:e=>`Use ${e.recommendedServerName??"this app"}`,body:"Great. Click the app to connect it to this AI step. Its available actions will be included automatically.",next:"wait-for-app-connection",back:"suggest-app",advanceOnTargetClick:!0,onEnter:"prepare-app-picker"},{id:"wait-for-app-connection",path:"/flows",route:o,placement:"center",waitFor:'[data-tutorial-app-connected="true"]',title:"Connecting the app…",body:"I’ll continue as soon as the app is connected to the AI step.",next:"app-instructions",back:"connect-app"},{id:"app-instructions",path:"/flows",route:o,target:'[data-tour="flow-task-prompt"]',placement:"left",title:"Optional: give special instructions",body:"If you want, you can add when or how the agent should use this app. The simple prompt is enough for now.",next:"save-agent",back:"wait-for-app-connection"},{id:"save-agent",path:"/flows",route:o,target:'[data-tour="flow-save"]',placement:"bottom",title:"Save your improved agent",body:"Save the change so Chat can use the connected app.",next:"wait-for-save",back:"app-instructions",advanceOnTargetClick:!0},{id:"wait-for-save",path:"/flows",route:o,placement:"center",waitFor:'[data-tutorial-save-status="saved"]',title:"Saving…",body:"I’ll continue when the updated agent is safely saved.",next:"return-to-chat",back:"save-agent"},{id:"return-to-chat",path:"/chat",route:r,target:'[data-tour="chat-input"]',placement:"top",title:"Let’s see it in action",body:"We’re back in the same conversation. Let’s ask the same question again.",next:"send-second-question",back:"wait-for-save"},{id:"send-second-question",path:"/chat",route:r,target:'[data-tour="chat-input"]',placement:"top",title:"Try it again",body:"This time, the agent can use the app you connected.",next:"wait-for-second-answer",back:"return-to-chat",action:"send-example",actionLabel:"Ask again"},{id:"wait-for-second-answer",path:"/chat",route:r,placement:"center",waitFor:'[data-tutorial-chat-status="completed"]',title:"Waiting for the improved answer…",body:"The agent may take a little longer while it looks things up.",next:"complete",back:"send-second-question"},{id:"complete",path:"/chat",route:r,placement:"center",title:"Much better, isn’t it?",body:"That’s how you edit an agent and connect an app to it. Keep flowing.",back:"send-second-question",action:"finish",actionLabel:"Finish Stage 1"},{id:"install-app-intro",path:"/mcp",target:'[data-tour="add-mcp-server"]',placement:"bottom",title:"Add a web-search app",body:"I couldn’t find a working web-search app yet. Open the app setup and we’ll add one.",next:"install-app-marketplace",advanceOnTargetClick:!0,nested:"install-web-app"},{id:"install-app-marketplace",path:"/mcp",target:'[data-tour="mcp-marketplace-tab"]',placement:"bottom",title:"Open the Marketplace",body:"The Marketplace lists apps you can add to FLUJO.",next:"install-app-search",back:"install-app-intro",advanceOnTargetClick:!0,onEnter:"open-app-marketplace",nested:"install-web-app"},{id:"install-app-search",path:"/mcp",target:'[data-tour="mcp-marketplace-search"]',placement:"bottom",title:"Search for web search",body:"Search for “web search” and install a trustworthy option. Finish any setup it asks for, then let me check again.",back:"install-app-marketplace",action:"check-apps",actionLabel:"I installed one — check again",onEnter:"open-app-marketplace",nested:"install-web-app"},{id:"enable-app",path:"/mcp",target:e=>e.recommendedServerName?`[data-tutorial-server-toggle="${n(e.recommendedServerName)}"]`:void 0,placement:"top",title:e=>`Turn on ${e.recommendedServerName??"the app"}`,body:"The app is installed, but it is switched off. Turn it on so the agent can use it.",next:"enable-app-check",advanceOnTargetClick:!0,nested:"enable-web-app"},{id:"enable-app-check",path:"/mcp",placement:"center",title:"Give it a moment to connect",body:"Once it is ready, I’ll check its available actions and take us back to the Chat agent.",back:"enable-app",action:"check-apps",actionLabel:"Check the app",nested:"enable-web-app"},{id:"return-to-app-picker",path:"/flows",route:o,target:'[data-tour="flow-process-node"]',placement:"right",title:"Back to the Chat agent",body:"Select the AI step again, then we’ll connect the app we just prepared.",next:"return-select-process",advanceOnTargetClick:!0},{id:"return-select-process",path:"/flows",route:o,target:'[data-tour="flow-add-app"]',placement:"left",title:"Open the app picker",body:"Choose + one more time.",next:"connect-app",back:"return-to-app-picker",advanceOnTargetClick:!0}],i=new Map(s.map(e=>[e.id,e]));function l(e,t){return"function"==typeof e?e(t):e}function c(e,t){return"function"==typeof e.target?e.target(t):e.target}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9894],{21129:(e,t,o)=>{o.d(t,{$Q:()=>P,C2:()=>N,H0:()=>O,IK:()=>Q,IP:()=>V,M6:()=>z,Rt:()=>J,Uw:()=>K,dD:()=>ea,lA:()=>et,nH:()=>T,pF:()=>er,v2:()=>ee,vm:()=>G,vp:()=>A,z3:()=>el,z9:()=>eo});var l=o(95155),r=o(12115),a=o(81750),s=o(61278),n=o(86670),i=o(83363),d=o(28683),p=o(82755),c=o(4550),u=o(94771),f=o(37911),h=o(47335),m=o(89894),y=o(61690),w=o(34812),g=o(58143),b=o(69939),k=o(74708),x=o(28748),v=o(50866),F=o(7877),j=o(94111),I=o(95863),C=o(97436),S=o(6310);let T=j.L.light.resource,E=j.Z.resource,A=j.L.light.signal,$=j.Z.signal,P=j.L.light.trigger,N=j.Z.trigger,O=j.L.light.static,V=j.Z.static,B={start:{main:()=>j.L.light.start,light:()=>j.L.dark.start},process:{main:e=>e.palette.primary.main,light:e=>e.palette.primary.light},finish:{main:e=>e.palette.success.main,light:e=>e.palette.success.light},mcp:{main:e=>e.palette.info.main,light:e=>e.palette.info.light},subflow:{main:e=>e.palette.warning.main,light:e=>e.palette.warning.light},resource:{main:()=>T,light:()=>E},signal:{main:()=>A,light:()=>$},trigger:{main:()=>P,light:()=>N},static:{main:()=>O,light:()=>V}},M=(e,t)=>(B[e]??B.start).main(t),X=(0,n.Ay)(p.A,{shouldForwardProp:e=>!["nodeType","selected"].includes(e)})(({theme:e,nodeType:t,selected:o})=>({padding:e.spacing(1.6),width:"210px",position:"relative",overflow:"visible",borderRadius:"16px",backgroundColor:e.palette.background.paper,backgroundImage:`linear-gradient(145deg, ${(0,i.X4)(M(t,e),.08)}, transparent 42%)`,border:`1px solid ${e.palette.divider}`,borderLeft:`3px solid ${M(t,e)}`,boxShadow:o?`0 0 0 3px ${(0,i.X4)(e.palette.secondary.main,.28)}, 0 18px 45px ${(0,i.X4)(M(t,e),.18)}`:`0 12px 34px ${(0,i.X4)(e.palette.common.black,"dark"===e.palette.mode?.28:.1)}`,transition:"transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease","&:hover":{borderColor:(0,i.X4)(M(t,e),.58),boxShadow:`0 0 0 1px ${(0,i.X4)(M(t,e),.35)}, 0 18px 45px ${(0,i.X4)(M(t,e),.16)}`,transform:"translateY(-2px)"},"& .react-flow__handle::after":{content:'""',position:"absolute",inset:-8,borderRadius:"50%"},"@media (pointer: coarse)":{"& .react-flow__handle::after":{inset:-14}}})),R=(0,n.Ay)(c.default,{shouldForwardProp:e=>"nodeType"!==e})(({theme:e,nodeType:t})=>({display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${(0,i.X4)((B[t]??B.start).light(e),.28)}`,marginBottom:e.spacing(1),paddingBottom:e.spacing(.5)})),L=(0,n.Ay)(c.default)({display:"flex",alignItems:"center",gap:"8px"}),D=(0,n.Ay)(c.default)(({theme:e})=>({marginTop:e.spacing(1),fontSize:"0.8rem"})),J="flowQuickConnect",U={start:[{handleId:"start-bottom",side:"bottom"}],process:[{handleId:"process-bottom",side:"bottom"},{handleId:"process-left-mcp",side:"left",anchor:"30%"},{handleId:"process-right-mcp",side:"right",anchor:"30%"},{handleId:"process-left-resource",side:"left",anchor:"70%"},{handleId:"process-right-resource",side:"right",anchor:"70%"}],finish:[],mcp:[],subflow:[{handleId:"subflow-bottom",side:"bottom"}],resource:[{handleId:"resource-out",side:"right"}],signal:[{handleId:"signal-bottom",side:"bottom"}],trigger:[{handleId:"trigger-bottom",side:"bottom"}],static:[{handleId:"static-bottom",side:"bottom"},{handleId:"static-left-mcp",side:"left",anchor:"50%"},{handleId:"static-right-mcp",side:"right",anchor:"50%"}]},_={top:-90,right:0,bottom:90,left:180},z=(e,t)=>M(e,t),W=e=>({backgroundColor:e.palette.info.main,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),q=e=>({backgroundColor:e.palette.primary.main,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),H=e=>({backgroundColor:e.palette.info.main,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),Z=e=>({backgroundColor:T,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),Y=({id:e,data:t,nodeType:o,selected:n})=>{let i=(0,d.A)(),{t:p,tp:j,formatList:E}=(0,S.s9)(),$=(0,r.useContext)(C.G),[N,V]=(0,r.useState)(!1),B=(0,r.useRef)(null),M=(0,r.useRef)(null),z=(0,I.b)(t,o,{t:p,tp:j,formatList:E},$);(0,r.useEffect)(()=>()=>{B.current&&clearTimeout(B.current),M.current&&clearTimeout(M.current)},[]),(0,r.useEffect)(()=>{n&&(B.current&&clearTimeout(B.current),M.current&&clearTimeout(M.current),B.current=null,M.current=null,V(!1))},[n]);let Y=!!n||N,G=()=>{M.current&&clearTimeout(M.current),M.current=null,n||N||B.current||(B.current=setTimeout(()=>{V(!0),B.current=null},450))},K=()=>{B.current&&clearTimeout(B.current),B.current=null,n||(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{V(!1),M.current=null},180))},Q=e=>{e.stopPropagation()};return(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)(X,{"data-tour":`flow-${o}-node`,elevation:2,nodeType:o,selected:n,onMouseEnter:G,onMouseLeave:K,children:[(()=>{if("mcp"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"mcp-top",type:"target",position:s.yX.Top,style:W(i)}),(0,l.jsx)(a.h7,{id:"mcp-right",type:"target",position:s.yX.Right,style:W(i)}),(0,l.jsx)(a.h7,{id:"mcp-bottom",type:"source",position:s.yX.Bottom,style:W(i)}),(0,l.jsx)(a.h7,{id:"mcp-left",type:"target",position:s.yX.Left,style:W(i)})]});if("process"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"process-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"process-bottom",type:"source",position:s.yX.Bottom,style:q(i)}),(0,l.jsx)(a.h7,{id:"process-left-mcp",type:"source",position:s.yX.Left,style:{...H(i),top:"30%"}}),(0,l.jsx)(a.h7,{id:"process-right-mcp",type:"source",position:s.yX.Right,style:{...H(i),top:"30%"}}),(0,l.jsx)(a.h7,{id:"process-left-resource",type:"source",position:s.yX.Left,style:{...Z(i),top:"70%"}}),(0,l.jsx)(a.h7,{id:"process-right-resource",type:"source",position:s.yX.Right,style:{...Z(i),top:"70%"}})]});if("resource"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"resource-in",type:"target",position:s.yX.Left,style:Z(i)}),(0,l.jsx)(a.h7,{id:"resource-out",type:"source",position:s.yX.Right,style:Z(i)})]});if("start"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"start-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"start-bottom",type:"source",position:s.yX.Bottom,style:q(i)})]});if("finish"===o)return(0,l.jsx)(a.h7,{id:"finish-top",type:"target",position:s.yX.Top,style:q(i)});else if("subflow"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"subflow-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"subflow-bottom",type:"source",position:s.yX.Bottom,style:q(i)})]});else if("signal"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"signal-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"signal-bottom",type:"source",position:s.yX.Bottom,style:q(i)})]});else if("static"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"static-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"static-bottom",type:"source",position:s.yX.Bottom,style:q(i)}),(0,l.jsx)(a.h7,{id:"static-left-mcp",type:"source",position:s.yX.Left,style:{...H(i),top:"50%"}}),(0,l.jsx)(a.h7,{id:"static-right-mcp",type:"source",position:s.yX.Right,style:{...H(i),top:"50%"}})]});else if("trigger"===o)return(0,l.jsx)(a.h7,{id:"trigger-bottom",type:"source",position:s.yX.Bottom,style:{...q(i),backgroundColor:P}});return null})(),U[o].map(t=>{let r=p("flows.canvas.quickConnect",{node:z.label,side:p(`flows.canvas.side.${t.side}`)}),n=t.handleId.includes("-mcp"),d=t.handleId.includes("-resource"),f=n?i.palette.info.main:d?T:i.palette.primary.main,h=(0,l.jsx)(u.A,{className:"nodrag nopan",size:"small","aria-label":r,title:r,onPointerDown:Q,onClick:o=>{let l;return o.preventDefault(),o.stopPropagation(),l=o.currentTarget.getBoundingClientRect(),void document.dispatchEvent(new CustomEvent(J,{detail:{nodeId:e,handleId:t.handleId,side:t.side,clientX:l.left+l.width/2,clientY:l.top+l.height/2}}))},sx:{width:32,height:32,p:0,color:i.palette.getContrastText(f),bgcolor:f,border:"2px solid",borderColor:"background.paper",boxShadow:3,transition:"transform 140ms ease, filter 140ms ease","&:hover, &:focus-visible":{bgcolor:f,filter:"brightness(0.9)",transform:"scale(1.08)"}},children:n?(0,l.jsx)(v.A,{sx:{fontSize:17}}):d?(0,l.jsx)(g.A,{sx:{fontSize:18}}):(0,l.jsx)(F.A,{sx:{fontSize:19,transform:`rotate(${_[t.side]}deg)`}})});return("process"===o||"static"===o)&&t.anchor?Y?(0,l.jsx)(c.default,{onMouseEnter:G,onMouseLeave:K,sx:{position:"absolute",top:t.anchor,..."left"===t.side?{left:-50}:{right:-50},transform:"translateY(-50%)",zIndex:5},children:h},t.handleId):null:(0,l.jsx)(a.ER,{nodeId:e,isVisible:Y,position:s.yX[t.side.charAt(0).toUpperCase()+t.side.slice(1)],align:t.align??"center",offset:10,onMouseEnter:G,onMouseLeave:K,children:h},t.handleId)}),(0,l.jsx)(R,{nodeType:o,children:(0,l.jsxs)(L,{children:[(e=>{switch(e){case"start":default:return(0,l.jsx)(h.A,{sx:{color:"#7E889E"}});case"process":return(0,l.jsx)(m.A,{color:"primary"});case"finish":return(0,l.jsx)(y.A,{color:"success"});case"mcp":return(0,l.jsx)(m.A,{color:"info"});case"subflow":return(0,l.jsx)(w.A,{sx:{color:"warning.main"}});case"resource":return(0,l.jsx)(g.A,{sx:{color:T}});case"signal":return(0,l.jsx)(b.A,{sx:{color:A}});case"trigger":return(0,l.jsx)(k.A,{sx:{color:P}});case"static":return(0,l.jsx)(x.A,{sx:{color:O}})}})(o),(0,l.jsx)(f.A,{variant:"subtitle2",sx:{fontWeight:"bold"},children:z.label})]})}),z.summary.length>0&&(0,l.jsx)(D,{"aria-label":p("flows.nodeInfo.summary"),children:z.summary.map(e=>(0,l.jsxs)(c.default,{sx:{mb:.5},children:[(0,l.jsxs)(f.A,{component:"span",variant:"caption",sx:{fontWeight:"bold",mr:.5},children:[e.label,":"]}),(0,l.jsx)(f.A,{component:"span",variant:"caption",color:"text.secondary",sx:{whiteSpace:e.multiline?"pre-line":"normal",overflowWrap:"anywhere"},children:e.value})]},e.key))})]})})},G=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"start",selected:e.selected})}),K=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"process",selected:e.selected})}),Q=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"finish",selected:e.selected})}),ee=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"mcp",selected:e.selected})}),et=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"subflow",selected:e.selected})}),eo=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"resource",selected:e.selected})}),el=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"signal",selected:e.selected})}),er=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"trigger",selected:e.selected})}),ea=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"static",selected:e.selected})})},65614:(e,t,o)=>{o.d(t,{g:()=>s});var l=o(19260);let r=(0,o(49103).h)("frontend/services/flow/index");class a{async loadFlows(e={}){r.debug("loadFlows: Entering method");try{if(this.flowsCache&&!e.refresh)return r.debug("loadFlows: Using cached flows",{count:this.flowsCache.length}),this.flowsCache;let t=await fetch("/api/flow");if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to load flows")}let o=await t.json();return r.debug("loadFlows: Loaded flows from API",{count:o.length}),this.flowsCache=o,o}catch(e){return r.warn("loadFlows: Failed to load flows:",e),[]}}async suggestToolsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-tools",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not suggest connected tools.");return o}async generateNameForFlow(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generate-name",...e})}),o=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof o?.name)throw Error(o?.error||"Could not generate a workflow name.");return{name:o.name}}async applyToolsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-tools",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not connect the approved tools.");return o.flow}async suggestAgentsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-agents",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not suggest connected agents.");return o}async applyAgentsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-agents",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not connect the approved agents.");return o.flow}async improvePromptForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"improve-prompt",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not improve this prompt.");return o}async checkPlausibility(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"check-plausibility",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not check flow plausibility.");return o}async getFlow(e){r.debug("getFlow: Entering method",{flowId:e});try{if(this.flowsCache){let t=this.flowsCache.find(t=>t.id===e);if(t)return r.debug("getFlow: Using cached flow",{flowId:e}),t}let t=await fetch(`/api/flow/${encodeURIComponent(e)}`);if(!t.ok){if(404===t.status)return r.debug(`getFlow: Flow ${e} not found`),null;let o=await t.json();throw Error(o.error||`Failed to get flow: ${e}`)}let o=await t.json();return r.debug("getFlow: Retrieved flow from API",{flowId:e}),o}catch(t){return r.warn(`getFlow: Failed to get flow ${e}:`,t),null}}async createModelAgent(e){let t=await fetch("/api/flow/model-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),o=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof o?.flowId||"string"!=typeof o?.name)throw Error(o?.error||"Could not create the agent.");return this.flowsCache=null,{flowId:o.flowId,name:o.name}}async addFlow(e){r.debug("addFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to add flow"}}let o=await t.json();return this.flowsCache&&this.flowsCache.push(o),r.debug("addFlow: Flow added successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("addFlow: Failed to add flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to add flow"}}}async generateFlow(e,t,o){r.debug("generateFlow: Entering method",{modelId:t,allowInstall:o?.allowInstall,allowSubflows:o?.allowSubflows,maxDepth:o?.maxDepth});try{let l=await fetch("/api/flow/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:e,modelId:t,allowInstall:o?.allowInstall===!0,allowSubflows:o?.allowSubflows!==!1,..."number"==typeof o?.maxDepth?{maxDepth:o.maxDepth}:{}})}),a=await l.json().catch(()=>null);if(!l.ok)return{success:!1,error:a?.error||"Failed to generate flow"};let s=Array.isArray(a.flows)&&a.flows.length>0?a.flows:[{flow:a.flow,validation:a.validation}];return r.debug("generateFlow: Draft generated",{flowId:a.flow?.id,flowCount:s.length,attempts:a.attempts,errorCount:a.validation?.errorCount,installedServers:a.installedServers?.length??0}),{success:!0,flow:a.flow,validation:a.validation,flows:s,rootFlowId:a.rootFlowId??a.flow?.id,attempts:a.attempts,installedServers:a.installedServers??[]}}catch(e){return r.warn("generateFlow: Failed to generate flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to generate flow"}}}async improveFlow(e,t,o,l){r.debug("improveFlow: Entering method",{flowId:e?.id,modelId:o,allowInstall:l?.allowInstall});try{let a=await fetch("/api/flow/improve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flow:e,relatedFlows:l?.relatedFlows,description:t,modelId:o,allowInstall:l?.allowInstall===!0})}),s=await a.json().catch(()=>null);if(!a.ok)return{success:!1,error:s?.error||"Failed to improve flow"};return r.debug("improveFlow: Draft revised",{flowId:s.flow?.id,attempts:s.attempts,errorCount:s.validation?.errorCount,installedServers:s.installedServers?.length??0}),{success:!0,flow:s.flow,validation:s.validation,flows:Array.isArray(s.flows)&&s.flows.length>0?s.flows:[{flow:s.flow,validation:s.validation}],rootFlowId:s.rootFlowId??s.flow?.id,attempts:s.attempts,installedServers:s.installedServers??[]}}catch(e){return r.warn("improveFlow: Failed to improve flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to improve flow"}}}async convertProcessToSubflow(e,t,o,l){try{let r=await fetch(`/api/flow/${encodeURIComponent(e.id)}/convert-process-to-subflow`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentFlow:e,childFlow:t,processNodeId:o,expectedUpdatedAt:l})}),a=await r.json().catch(()=>null);if(!r.ok)return{success:!1,error:a?.error||"Failed to convert Process to Subflow."};let s=a.parentFlow,n=a.childFlow;if(this.flowsCache){let e=this.flowsCache.findIndex(e=>e.id===s.id);e>=0?this.flowsCache[e]=s:this.flowsCache.push(s),this.flowsCache.some(e=>e.id===n.id)||this.flowsCache.push(n)}return{success:!0,parentFlow:s,childFlow:n}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Failed to convert Process to Subflow."}}}async updateFlow(e){r.debug("updateFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch(`/api/flow/${encodeURIComponent(e.id)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to update flow"}}let o=await t.json();if(this.flowsCache){let t=this.flowsCache.findIndex(t=>t.id===e.id);t>=0?this.flowsCache[t]=o:this.flowsCache.push(o)}return r.debug("updateFlow: Flow updated successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("updateFlow: Failed to update flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to update flow"}}}async deleteFlow(e){r.debug("deleteFlow: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to delete flow"}}return this.flowsCache&&(this.flowsCache=this.flowsCache.filter(t=>t.id!==e)),r.debug("deleteFlow: Flow deleted successfully",{flowId:e}),{success:!0}}catch(e){return r.warn("deleteFlow: Failed to delete flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to delete flow"}}}async listFlowVersions(e){r.debug("listFlowVersions: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}/versions`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to list flow versions")}let o=await t.json();return Array.isArray(o.versions)?o.versions:[]}catch(t){return r.warn(`listFlowVersions: Failed for flow ${e}:`,t),[]}}async getFlowVersion(e,t){r.debug("getFlowVersion: Entering method",{flowId:e,versionId:t});try{let o=await fetch(`/api/flow/${encodeURIComponent(e)}/versions/${encodeURIComponent(t)}`);if(!o.ok){if(404===o.status)return null;let e=await o.json().catch(()=>null);throw Error(e?.error||"Failed to get flow version")}return await o.json()}catch(o){return r.warn(`getFlowVersion: Failed for ${e}/${t}:`,o),null}}createNode(e,t){return r.debug("createNode: Entering method",{type:e,position:t}),{id:(0,l.A)(),type:e,position:t,data:{label:`${"mcp"===e?"MCP":e.charAt(0).toUpperCase()+e.slice(1)} Node`,type:e,properties:"process"===e?{inputMode:"full-history"}:"static"===e?{entries:[]}:"subflow"===e?{resultPresentation:"separate",sessionScope:"per-key"}:{}}}}createStartNode(){return{id:(0,l.A)(),type:"start",position:{x:250,y:150},data:{label:"Start Node",type:"start",properties:{promptTemplate:""}}}}createNewFlow(e="NewFlow"){r.debug("createNewFlow: Entering method",{name:e});let t=Date.now();return{id:(0,l.A)(),name:e,createdAt:t,updatedAt:t,nodes:[this.createStartNode()],edges:[]}}createHistoryEntry(e,t){return r.debug("createHistoryEntry: Entering method"),{nodes:[...e],edges:[...t]}}generateSampleFlow(e="Sample Flow"){return r.debug("generateSampleFlow: Entering method",{name:e}),{id:(0,l.A)(),name:e,nodes:[{id:"1",type:"start",position:{x:250,y:50},data:{label:"Start Node",type:"start",properties:{prompt:"Enter your query here",systemMessage:"You are a helpful assistant",temperature:0}}},{id:"2",type:"process",position:{x:250,y:200},data:{label:"Process Node",type:"process",properties:{operation:"transform",enabled:!0}}},{id:"3",type:"finish",position:{x:250,y:350},data:{label:"Finish Node",type:"finish",properties:{format:"json",template:'{ "result": {{data}} }'}}},{id:"4",type:"mcp",position:{x:450,y:200},data:{label:"MCP Node",type:"mcp",properties:{channels:2,mode:"parallel"}}}],edges:[{id:"e1-2",source:"1",target:"2",type:"custom"},{id:"e2-3",source:"2",target:"3",type:"custom"}]}}constructor(){this.flowsCache=null}}let s=new a},94111:(e,t,o)=>{o.d(t,{L:()=>l,Z:()=>r});let l={light:{start:"#7E889E",process:"#6355E8",finish:"#15885A",mcp:"#129DB8",subflow:"#C67A13",resource:"#18AFA3",signal:"#9A78FF",trigger:"#EF5D8E",static:"#8A6BD1"},dark:{start:"#B7C0D2",process:"#8B7CFF",finish:"#57D59B",mcp:"#31D2ED",subflow:"#F6BC66",resource:"#63D8CE",signal:"#C4B2FF",trigger:"#FF9ABD",static:"#BFA8F0"}},r={resource:"#63D8CE",signal:"#C4B2FF",trigger:"#FF9ABD",static:"#BFA8F0"}},95863:(e,t,o)=>{o.d(t,{b:()=>w});let l=/credential|token|authorization|secret|password|api[-_ ]?key|environment|(^|[_-])env($|[_-])/i,r=(e,t,o,l)=>e?e.t(t,l):o,a=(e,t,o,l)=>e?e.tp(t,o):l,s={start:[{key:"promptTemplate",label:"Prompt template"}],process:[{key:"promptTemplate",label:"Prompt template"},{key:"boundModel",label:"Bound model"},{key:"modelName",label:"Model name"},{key:"inputMode",label:"Input mode",defaultValue:"full-history"},{key:"isolatedPrompt",label:"Isolated prompt",defaultValue:!1},{key:"allowCallerPrompt",label:"Allow caller prompt",defaultValue:!0},{key:"outputMode",label:"Output mode",defaultValue:"full-conversation"},{key:"excludeModelPrompt",label:"Exclude model prompt",defaultValue:!1},{key:"excludeStartNodePrompt",label:"Exclude start prompt",defaultValue:!1},{key:"excludeSystemPrompt",label:"Exclude system prompt",defaultValue:!1},{key:"enableTodoTool",label:"Enable todo tool",defaultValue:!1},{key:"captureVariable",label:"Capture variable"},{key:"captureResource",label:"Capture resource"},{key:"captureKv",label:"Capture key-value reference"},{key:"inputSchema",label:"Input schema"},{key:"outputSchema",label:"Output schema"},{key:"handoffTools",label:"Handoff tools"},{key:"mcpNodes",label:"Attached MCP nodes"}],finish:[{key:"successMessage",label:"Success message"},{key:"conditional",label:"Conditional completion",defaultValue:!1},{key:"condition",label:"Completion condition"}],mcp:[{key:"boundServer",label:"Bound server"},{key:"enabledTools",label:"Enabled tools"},{key:"toolTimeout",label:"Tool timeout"},{key:"roots",label:"Roots"},{key:"nameIsCustom",label:"Custom name",defaultValue:!1}],subflow:[{key:"subflowId",label:"Bound subflow"},{key:"parallelSubflowIds",label:"Parallel subflows"},{key:"parallelSubflowIdsVar",label:"Parallel subflow variable"},{key:"spawnBriefs",label:"Spawn briefs"},{key:"promptTemplate",label:"Prompt template"},{key:"inputMode",label:"Input mode",defaultValue:"full-history"},{key:"allowCallerPrompt",label:"Allow caller prompt",defaultValue:!0},{key:"allowCallerFanout",label:"Allow caller fan-out",defaultValue:!1},{key:"mapOverList",label:"Map over list",defaultValue:!1},{key:"itemSplit",label:"Item split",defaultValue:"json-array"},{key:"sequential",label:"Sequential",defaultValue:!1},{key:"concurrencyLimit",label:"Concurrency limit",defaultValue:4},{key:"errorStrategy",label:"Error strategy",defaultValue:"collect-all"},{key:"joinSeparator",label:"Join separator"},{key:"outputMode",label:"Output mode",defaultValue:"steps"},{key:"saveConversation",label:"Save conversation",defaultValue:!0}],resource:[{key:"scope",label:"Scope",defaultValue:"run"},{key:"boundServer",label:"Bound server"},{key:"uri",label:"Resource URI"},{key:"runName",label:"Run resource name"}],signal:[{key:"topic",label:"Topic"},{key:"payloadTemplate",label:"Payload template"}],static:[{key:"entries",label:"Entries"},{key:"injectOnce",label:"Inject once",defaultValue:!1}],trigger:[{key:"executionId",label:"Execution ID"},{key:"name",label:"Name"},{key:"enabled",label:"Enabled",defaultValue:!0},{key:"trigger",label:"Trigger configuration"},{key:"overlapStrategy",label:"Overlap strategy",defaultValue:"skip"},{key:"prompt",label:"Initial prompt"}]},n=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),i=e=>e.replace(/\s+/g," ").trim(),d=(e,t)=>{if(e.length<=t)return e;let o=e.slice(0,Math.max(0,t-1)),l=o.lastIndexOf(" "),r=l>Math.floor(.6*t)?o.slice(0,l):o;return`${r.trimEnd()}…`},p=e=>{let t="string"==typeof e?e:void 0;if(void 0!==t)return i(t)||void 0},c=e=>Array.isArray(e)?e.filter(e=>"string"==typeof e).map(i).filter(Boolean):[],u=(e,t,o)=>{if(!Object.prototype.hasOwnProperty.call(e,t))return`${o} (default)`;let l=e[t];return"string"==typeof l?i(l)||"empty":null===l?"null":String(l)},f=e=>{if("string"!=typeof e)return;if(!e.trim())return"empty";let t=e.split(/\r?\n/).map(i).filter(Boolean).slice(0,3).map(e=>d(e,90));return t.length?t.join("\n"):"empty"},h=(e,t=0)=>{if("string"==typeof e)return d(e,500);if(null===e||"number"==typeof e||"boolean"==typeof e)return e;if(void 0===e)return"[absent]";if("bigint"==typeof e)return e.toString();if("object"!=typeof e)return String(e);if(t>=3)return"[depth limit]";if(Array.isArray(e)){let o=e.slice(0,12).map(e=>h(e,t+1));return e.length>12&&o.push(`[${e.length-12} more items]`),o}let o=Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).slice(0,20),r={};for(let[e,a]of o)r[e]=l.test(e)?"[redacted]":h(a,t+1);let a=Object.keys(e).length;return a>20&&(r["…"]=`[${a-20} more fields]`),r},m=e=>{let t=h(e);return"string"==typeof t?t:JSON.stringify(t,null,2)},y=(e,t,o,l)=>{if(!Object.prototype.hasOwnProperty.call(o,e))return void 0!==l?{key:e,label:t,state:"default",value:`[default: ${m(l)}]`}:{key:e,label:t,state:"absent",value:"[absent]"};let r=o[e],a=""===r||Array.isArray(r)&&0===r.length;return{key:e,label:t,state:a?"empty":"configured",value:a?""===r?"[empty string]":"[empty array]":m(r)}},w=(e,t,o,l)=>{let i,h,m,w=e||{},g=n(w.properties)?w.properties:{};"signal"===t&&"string"==typeof g.topic&&(g={...g,topic:g.topic.trim()});let b="signal"===t?r(o,"flows.nodeInfo.signal","Signal"):r(o,"flows.nodeInfo.noLabel","No Label"),k=p(w.label)||b,x="signal"===t&&p(g.topic)||k,v=[],F=p(w.description);if(F&&v.push({key:"description",label:r(o,"flows.nodeInfo.description","Description"),value:d(F,180)}),"process"===t){let e;j=g,v.push({key:"modes",label:r(o,"flows.nodeInfo.modes","Modes"),value:`${u(j,"inputMode","full-history")} → ${u(j,"outputMode","full-conversation")}`}),void 0!==(e=f(j.promptTemplate))&&v.push({key:"prompt",label:r(o,"flows.nodeInfo.prompt","Prompt"),value:e,multiline:!0})}else if("subflow"===t)((e,t,o,l)=>{let s=p(t.subflowId),n=c(t.parallelSubflowIds),i=p(t.parallelSubflowIdsVar),d=c(t.spawnBriefs),f=r(o,"flows.nodeInfo.notBound","Not bound");s?f=l?.get(s)||s:n.length?f=a(o,"flows.nodeInfo.parallelFlow",n.length,`${n.length} parallel flow${1===n.length?"":"s"}`):i&&(f=r(o,"flows.nodeInfo.flowsFrom",`Flows from ${i}`,{variable:i})),e.push({key:"target",label:r(o,"flows.nodeInfo.target","Target"),value:f}),e.push({key:"modes",label:r(o,"flows.nodeInfo.modes","Modes"),value:`${u(t,"inputMode","full-history")} → ${u(t,"outputMode","steps")}`});let h="number"==typeof t.concurrencyLimit?Math.max(1,Math.floor(t.concurrencyLimit)):4,m=[r(o,"flows.nodeInfo.maxChildren",`max ${h} simultaneous children`,{count:h})];if(!s&&(n.length>0||i)&&m.push(!0===t.sequential?r(o,"flows.nodeInfo.sequentialFanout","sequential fan-out"):r(o,"flows.nodeInfo.parallelFanout","parallel fan-out")),!0===t.mapOverList){let e=u(t,"itemSplit","json-array");m.push(r(o,"flows.nodeInfo.mapList",`map list (${e})`,{mode:e}))}d.length&&m.push(a(o,"flows.nodeInfo.spawnBrief",d.length,`${d.length} spawn brief${1===d.length?"":"s"}`)),e.push({key:"execution",label:r(o,"flows.nodeInfo.execution","Execution"),value:m.join(" \xb7 ")})})(v,g,o,l);else if("mcp"===t){var j,I=g;v.push({key:"server",label:r(o,"flows.nodeInfo.server","Server"),value:p(I.boundServer)||r(o,"flows.nodeInfo.notBound","Not bound")});let e=c(I.enabledTools);if(e.length){let t=e.slice(0,3),l=e.length-t.length;v.push({key:"tools",label:r(o,"flows.nodeInfo.tools","Tools"),value:`${o?o.formatList(t):t.join(", ")}${l>0?` ${r(o,"flows.nodeInfo.more",`+${l} more`,{count:l})}`:""} (${e.length})`})}else v.push({key:"tools",label:r(o,"flows.nodeInfo.tools","Tools"),value:r(o,"flows.nodeInfo.noneEnabled","None enabled")})}else((e,t,o,l)=>{if("start"===t){let t=f(o.promptTemplate);void 0!==t&&e.push({key:"prompt",label:r(l,"flows.nodeInfo.prompt","Prompt"),value:t,multiline:!0})}else if("resource"===t){let t=u(o,"scope","run");e.push({key:"scope",label:r(l,"flows.nodeInfo.scope","Scope"),value:t});let a=p(o.uri)||p(o.runName);a&&e.push({key:"resource",label:r(l,"flows.nodeInfo.resource","Resource"),value:d(a,100)})}else if("signal"===t){let t=f(o.payloadTemplate);void 0!==t&&e.push({key:"payload",label:r(l,"flows.nodeInfo.payload","Payload"),value:t,multiline:!0})}else if("static"===t){let t=Array.isArray(o.entries)?o.entries:[];e.push({key:"entries",label:r(l,"flows.nodeInfo.entries","Entries"),value:String(t.length)});let a=t.find(e=>n(e));if(a){let t=f("toolCall"===a.kind?a.toolName:a.content);void 0!==t&&e.push({key:"first",label:r(l,"flows.nodeInfo.first","First entry"),value:t,multiline:!0})}}else if("trigger"===t){let t=n(o.trigger)?o.trigger:{};e.push({key:"trigger",label:r(l,"flows.nodeInfo.trigger","Trigger"),value:p(t.type)||r(l,"flows.nodeInfo.notConfigured","Not configured")}),e.push({key:"enabled",label:r(l,"flows.nodeInfo.status","Status"),value:!1===o.enabled?r(l,"flows.nodeInfo.disabled","Disabled"):r(l,"flows.nodeInfo.enabled","Enabled")})}})(v,t,g,o);let C={type:"string"==typeof w.type&&w.type?w.type:t,label:x};Object.prototype.hasOwnProperty.call(w,"description")&&(C.description=w.description);let S=[y("type",o?"type":"Type",C),y("label",o?"label":"Label",C),y("description",o?"description":"Description",C)].map(e=>({...e,key:`metadata.${e.key}`}));for(let e of s[t])S.push(y(e.key,o?e.key:e.label,g,e.defaultValue));return{label:x,summary:v,technicalDetails:S,technicalText:(i=S.filter(e=>e.key.startsWith("metadata.")),h=S.filter(e=>!e.key.startsWith("metadata.")),m=e=>`${e.label}: ${e.value}`,[r(o,"flows.nodeInfo.nodeMetadata","Node metadata"),...i.map(m),"",r(o,"flows.nodeInfo.supportedProperties","Supported properties"),...h.map(m)].join("\n"))}}},97436:(e,t,o)=>{o.d(t,{G:()=>l});let l=(0,o(12115).createContext)(new Map)}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9894],{21129:(e,t,o)=>{o.d(t,{$Q:()=>P,C2:()=>N,H0:()=>O,IK:()=>Q,IP:()=>V,M6:()=>z,Rt:()=>J,Uw:()=>K,dD:()=>ea,lA:()=>et,nH:()=>T,pF:()=>er,v2:()=>ee,vm:()=>G,vp:()=>A,z3:()=>el,z9:()=>eo});var l=o(95155),r=o(12115),a=o(81750),s=o(61278),n=o(86670),i=o(83363),d=o(28683),p=o(82755),c=o(4550),u=o(94771),f=o(37911),h=o(47335),m=o(89894),y=o(61690),w=o(34812),g=o(58143),b=o(69939),k=o(74708),x=o(28748),v=o(50866),F=o(7877),j=o(94111),I=o(95863),C=o(97436),S=o(6310);let T=j.L.light.resource,E=j.Z.resource,A=j.L.light.signal,$=j.Z.signal,P=j.L.light.trigger,N=j.Z.trigger,O=j.L.light.static,V=j.Z.static,B={start:{main:()=>j.L.light.start,light:()=>j.L.dark.start},process:{main:e=>e.palette.primary.main,light:e=>e.palette.primary.light},finish:{main:e=>e.palette.success.main,light:e=>e.palette.success.light},mcp:{main:e=>e.palette.info.main,light:e=>e.palette.info.light},subflow:{main:e=>e.palette.warning.main,light:e=>e.palette.warning.light},resource:{main:()=>T,light:()=>E},signal:{main:()=>A,light:()=>$},trigger:{main:()=>P,light:()=>N},static:{main:()=>O,light:()=>V}},M=(e,t)=>(B[e]??B.start).main(t),X=(0,n.Ay)(p.A,{shouldForwardProp:e=>!["nodeType","selected"].includes(e)})(({theme:e,nodeType:t,selected:o})=>({padding:e.spacing(1.6),width:"210px",position:"relative",overflow:"visible",borderRadius:"16px",backgroundColor:e.palette.background.paper,backgroundImage:`linear-gradient(145deg, ${(0,i.X4)(M(t,e),.08)}, transparent 42%)`,border:`1px solid ${e.palette.divider}`,borderLeft:`3px solid ${M(t,e)}`,boxShadow:o?`0 0 0 3px ${(0,i.X4)(e.palette.secondary.main,.28)}, 0 18px 45px ${(0,i.X4)(M(t,e),.18)}`:`0 12px 34px ${(0,i.X4)(e.palette.common.black,"dark"===e.palette.mode?.28:.1)}`,transition:"transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease","&:hover":{borderColor:(0,i.X4)(M(t,e),.58),boxShadow:`0 0 0 1px ${(0,i.X4)(M(t,e),.35)}, 0 18px 45px ${(0,i.X4)(M(t,e),.16)}`,transform:"translateY(-2px)"},"& .react-flow__handle::after":{content:'""',position:"absolute",inset:-8,borderRadius:"50%"},"@media (pointer: coarse)":{"& .react-flow__handle::after":{inset:-14}}})),R=(0,n.Ay)(c.default,{shouldForwardProp:e=>"nodeType"!==e})(({theme:e,nodeType:t})=>({display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${(0,i.X4)((B[t]??B.start).light(e),.28)}`,marginBottom:e.spacing(1),paddingBottom:e.spacing(.5)})),L=(0,n.Ay)(c.default)({display:"flex",alignItems:"center",gap:"8px"}),D=(0,n.Ay)(c.default)(({theme:e})=>({marginTop:e.spacing(1),fontSize:"0.8rem"})),J="flowQuickConnect",U={start:[{handleId:"start-bottom",side:"bottom"}],process:[{handleId:"process-bottom",side:"bottom"},{handleId:"process-left-mcp",side:"left",anchor:"30%"},{handleId:"process-right-mcp",side:"right",anchor:"30%"},{handleId:"process-left-resource",side:"left",anchor:"70%"},{handleId:"process-right-resource",side:"right",anchor:"70%"}],finish:[],mcp:[],subflow:[{handleId:"subflow-bottom",side:"bottom"}],resource:[{handleId:"resource-out",side:"right"}],signal:[{handleId:"signal-bottom",side:"bottom"}],trigger:[{handleId:"trigger-bottom",side:"bottom"}],static:[{handleId:"static-bottom",side:"bottom"},{handleId:"static-left-mcp",side:"left",anchor:"50%"},{handleId:"static-right-mcp",side:"right",anchor:"50%"}]},_={top:-90,right:0,bottom:90,left:180},z=(e,t)=>M(e,t),W=e=>({backgroundColor:e.palette.info.main,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),q=e=>({backgroundColor:e.palette.primary.main,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),H=e=>({backgroundColor:e.palette.info.main,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),Z=e=>({backgroundColor:T,borderColor:"dark"===e.palette.mode?e.palette.background.paper:"white",width:16,height:16,borderRadius:8,borderWidth:2}),Y=({id:e,data:t,nodeType:o,selected:n})=>{let i=(0,d.A)(),{t:p,tp:j,formatList:E}=(0,S.s9)(),$=(0,r.useContext)(C.G),[N,V]=(0,r.useState)(!1),B=(0,r.useRef)(null),M=(0,r.useRef)(null),z=(0,I.b)(t,o,{t:p,tp:j,formatList:E},$);(0,r.useEffect)(()=>()=>{B.current&&clearTimeout(B.current),M.current&&clearTimeout(M.current)},[]),(0,r.useEffect)(()=>{n&&(B.current&&clearTimeout(B.current),M.current&&clearTimeout(M.current),B.current=null,M.current=null,V(!1))},[n]);let Y=!!n||N,G=()=>{M.current&&clearTimeout(M.current),M.current=null,n||N||B.current||(B.current=setTimeout(()=>{V(!0),B.current=null},450))},K=()=>{B.current&&clearTimeout(B.current),B.current=null,n||(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{V(!1),M.current=null},180))},Q=e=>{e.stopPropagation()};return(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)(X,{"data-tour":`flow-${o}-node`,elevation:2,nodeType:o,selected:n,onMouseEnter:G,onMouseLeave:K,children:[(()=>{if("mcp"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"mcp-top",type:"target",position:s.yX.Top,style:W(i)}),(0,l.jsx)(a.h7,{id:"mcp-right",type:"target",position:s.yX.Right,style:W(i)}),(0,l.jsx)(a.h7,{id:"mcp-bottom",type:"source",position:s.yX.Bottom,style:W(i)}),(0,l.jsx)(a.h7,{id:"mcp-left",type:"target",position:s.yX.Left,style:W(i)})]});if("process"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"process-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"process-bottom",type:"source",position:s.yX.Bottom,style:q(i)}),(0,l.jsx)(a.h7,{id:"process-left-mcp",type:"source",position:s.yX.Left,style:{...H(i),top:"30%"}}),(0,l.jsx)(a.h7,{id:"process-right-mcp",type:"source",position:s.yX.Right,style:{...H(i),top:"30%"}}),(0,l.jsx)(a.h7,{id:"process-left-resource",type:"source",position:s.yX.Left,style:{...Z(i),top:"70%"}}),(0,l.jsx)(a.h7,{id:"process-right-resource",type:"source",position:s.yX.Right,style:{...Z(i),top:"70%"}})]});if("resource"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"resource-in",type:"target",position:s.yX.Left,style:Z(i)}),(0,l.jsx)(a.h7,{id:"resource-out",type:"source",position:s.yX.Right,style:Z(i)})]});if("start"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"start-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"start-bottom",type:"source",position:s.yX.Bottom,style:q(i)})]});if("finish"===o)return(0,l.jsx)(a.h7,{id:"finish-top",type:"target",position:s.yX.Top,style:q(i)});else if("subflow"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"subflow-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"subflow-bottom",type:"source",position:s.yX.Bottom,style:q(i)})]});else if("signal"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"signal-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"signal-bottom",type:"source",position:s.yX.Bottom,style:q(i)})]});else if("static"===o)return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.h7,{id:"static-top",type:"target",position:s.yX.Top,style:q(i)}),(0,l.jsx)(a.h7,{id:"static-bottom",type:"source",position:s.yX.Bottom,style:q(i)}),(0,l.jsx)(a.h7,{id:"static-left-mcp",type:"source",position:s.yX.Left,style:{...H(i),top:"50%"}}),(0,l.jsx)(a.h7,{id:"static-right-mcp",type:"source",position:s.yX.Right,style:{...H(i),top:"50%"}})]});else if("trigger"===o)return(0,l.jsx)(a.h7,{id:"trigger-bottom",type:"source",position:s.yX.Bottom,style:{...q(i),backgroundColor:P}});return null})(),U[o].map(t=>{let r=p("flows.canvas.quickConnect",{node:z.label,side:p(`flows.canvas.side.${t.side}`)}),n=t.handleId.includes("-mcp"),d=t.handleId.includes("-resource"),f=n?i.palette.info.main:d?T:i.palette.primary.main,h=(0,l.jsx)(u.A,{className:"nodrag nopan",size:"small","aria-label":r,title:r,onPointerDown:Q,onClick:o=>{let l;return o.preventDefault(),o.stopPropagation(),l=o.currentTarget.getBoundingClientRect(),void document.dispatchEvent(new CustomEvent(J,{detail:{nodeId:e,handleId:t.handleId,side:t.side,clientX:l.left+l.width/2,clientY:l.top+l.height/2}}))},sx:{width:32,height:32,p:0,color:i.palette.getContrastText(f),bgcolor:f,border:"2px solid",borderColor:"background.paper",boxShadow:3,transition:"transform 140ms ease, filter 140ms ease","&:hover, &:focus-visible":{bgcolor:f,filter:"brightness(0.9)",transform:"scale(1.08)"}},children:n?(0,l.jsx)(v.A,{sx:{fontSize:17}}):d?(0,l.jsx)(g.A,{sx:{fontSize:18}}):(0,l.jsx)(F.A,{sx:{fontSize:19,transform:`rotate(${_[t.side]}deg)`}})});return("process"===o||"static"===o)&&t.anchor?Y?(0,l.jsx)(c.default,{onMouseEnter:G,onMouseLeave:K,sx:{position:"absolute",top:t.anchor,..."left"===t.side?{left:-50}:{right:-50},transform:"translateY(-50%)",zIndex:5},children:h},t.handleId):null:(0,l.jsx)(a.ER,{nodeId:e,isVisible:Y,position:s.yX[t.side.charAt(0).toUpperCase()+t.side.slice(1)],align:t.align??"center",offset:10,onMouseEnter:G,onMouseLeave:K,children:h},t.handleId)}),(0,l.jsx)(R,{nodeType:o,children:(0,l.jsxs)(L,{children:[(e=>{switch(e){case"start":default:return(0,l.jsx)(h.A,{sx:{color:"#7E889E"}});case"process":return(0,l.jsx)(m.A,{color:"primary"});case"finish":return(0,l.jsx)(y.A,{color:"success"});case"mcp":return(0,l.jsx)(m.A,{color:"info"});case"subflow":return(0,l.jsx)(w.A,{sx:{color:"warning.main"}});case"resource":return(0,l.jsx)(g.A,{sx:{color:T}});case"signal":return(0,l.jsx)(b.A,{sx:{color:A}});case"trigger":return(0,l.jsx)(k.A,{sx:{color:P}});case"static":return(0,l.jsx)(x.A,{sx:{color:O}})}})(o),(0,l.jsx)(f.A,{variant:"subtitle2",sx:{fontWeight:"bold"},children:z.label})]})}),z.summary.length>0&&(0,l.jsx)(D,{"aria-label":p("flows.nodeInfo.summary"),children:z.summary.map(e=>(0,l.jsxs)(c.default,{sx:{mb:.5},children:[(0,l.jsxs)(f.A,{component:"span",variant:"caption",sx:{fontWeight:"bold",mr:.5},children:[e.label,":"]}),(0,l.jsx)(f.A,{component:"span",variant:"caption",color:"text.secondary",sx:{whiteSpace:e.multiline?"pre-line":"normal",overflowWrap:"anywhere"},children:e.value})]},e.key))})]})})},G=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"start",selected:e.selected})}),K=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"process",selected:e.selected})}),Q=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"finish",selected:e.selected})}),ee=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"mcp",selected:e.selected})}),et=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"subflow",selected:e.selected})}),eo=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"resource",selected:e.selected})}),el=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"signal",selected:e.selected})}),er=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"trigger",selected:e.selected})}),ea=(0,r.memo)(function(e){return(0,l.jsx)(Y,{...e,nodeType:"static",selected:e.selected})})},65614:(e,t,o)=>{o.d(t,{g:()=>s});var l=o(19260);let r=(0,o(49103).h)("frontend/services/flow/index");class a{async loadFlows(e={}){r.debug("loadFlows: Entering method");try{if(this.flowsCache&&!e.refresh)return r.debug("loadFlows: Using cached flows",{count:this.flowsCache.length}),this.flowsCache;let t=await fetch("/api/flow");if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to load flows")}let o=await t.json();return r.debug("loadFlows: Loaded flows from API",{count:o.length}),this.flowsCache=o,o}catch(e){return r.warn("loadFlows: Failed to load flows:",e),[]}}async suggestToolsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-tools",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not suggest connected tools.");return o}async generateNameForFlow(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generate-name",...e})}),o=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof o?.name)throw Error(o?.error||"Could not generate a workflow name.");return{name:o.name}}async applyToolsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-tools",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not connect the approved tools.");return o.flow}async suggestAgentsForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"suggest-agents",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not suggest connected agents.");return o}async applyAgentsToStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"apply-agents",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not connect the approved agents.");return o.flow}async improvePromptForStep(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"improve-prompt",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not improve this prompt.");return o}async checkPlausibility(e){let t=await fetch("/api/flow/assist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"check-plausibility",...e})}),o=await t.json().catch(()=>null);if(!t.ok)throw Error(o?.error||"Could not check flow plausibility.");return o}async getFlow(e){r.debug("getFlow: Entering method",{flowId:e});try{if(this.flowsCache){let t=this.flowsCache.find(t=>t.id===e);if(t)return r.debug("getFlow: Using cached flow",{flowId:e}),t}let t=await fetch(`/api/flow/${encodeURIComponent(e)}`);if(!t.ok){if(404===t.status)return r.debug(`getFlow: Flow ${e} not found`),null;let o=await t.json();throw Error(o.error||`Failed to get flow: ${e}`)}let o=await t.json();return r.debug("getFlow: Retrieved flow from API",{flowId:e}),o}catch(t){return r.warn(`getFlow: Failed to get flow ${e}:`,t),null}}async createModelAgent(e){let t=await fetch("/api/flow/model-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),o=await t.json().catch(()=>null);if(!t.ok||"string"!=typeof o?.flowId||"string"!=typeof o?.name)throw Error(o?.error||"Could not create the agent.");return this.flowsCache=null,{flowId:o.flowId,name:o.name}}async addFlow(e){r.debug("addFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to add flow"}}let o=await t.json();return this.flowsCache&&this.flowsCache.push(o),r.debug("addFlow: Flow added successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("addFlow: Failed to add flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to add flow"}}}async generateFlow(e,t,o){r.debug("generateFlow: Entering method",{modelId:t,allowInstall:o?.allowInstall,allowSubflows:o?.allowSubflows,maxDepth:o?.maxDepth});try{let l=await fetch("/api/flow/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:e,modelId:t,allowInstall:o?.allowInstall===!0,allowSubflows:o?.allowSubflows!==!1,..."number"==typeof o?.maxDepth?{maxDepth:o.maxDepth}:{}})}),a=await l.json().catch(()=>null);if(!l.ok)return{success:!1,error:a?.error||"Failed to generate flow"};let s=Array.isArray(a.flows)&&a.flows.length>0?a.flows:[{flow:a.flow,validation:a.validation}];return r.debug("generateFlow: Draft generated",{flowId:a.flow?.id,flowCount:s.length,attempts:a.attempts,errorCount:a.validation?.errorCount,installedServers:a.installedServers?.length??0}),{success:!0,flow:a.flow,validation:a.validation,flows:s,rootFlowId:a.rootFlowId??a.flow?.id,attempts:a.attempts,installedServers:a.installedServers??[]}}catch(e){return r.warn("generateFlow: Failed to generate flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to generate flow"}}}async improveFlow(e,t,o,l){r.debug("improveFlow: Entering method",{flowId:e?.id,modelId:o,allowInstall:l?.allowInstall});try{let a=await fetch("/api/flow/improve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flow:e,relatedFlows:l?.relatedFlows,description:t,modelId:o,allowInstall:l?.allowInstall===!0})}),s=await a.json().catch(()=>null);if(!a.ok)return{success:!1,error:s?.error||"Failed to improve flow"};return r.debug("improveFlow: Draft revised",{flowId:s.flow?.id,attempts:s.attempts,errorCount:s.validation?.errorCount,installedServers:s.installedServers?.length??0}),{success:!0,flow:s.flow,validation:s.validation,flows:Array.isArray(s.flows)&&s.flows.length>0?s.flows:[{flow:s.flow,validation:s.validation}],rootFlowId:s.rootFlowId??s.flow?.id,attempts:s.attempts,installedServers:s.installedServers??[]}}catch(e){return r.warn("improveFlow: Failed to improve flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to improve flow"}}}async convertProcessToSubflow(e,t,o,l){try{let r=await fetch(`/api/flow/${encodeURIComponent(e.id)}/convert-process-to-subflow`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentFlow:e,childFlow:t,processNodeId:o,expectedUpdatedAt:l})}),a=await r.json().catch(()=>null);if(!r.ok)return{success:!1,error:a?.error||"Failed to convert Process to Subflow."};let s=a.parentFlow,n=a.childFlow;if(this.flowsCache){let e=this.flowsCache.findIndex(e=>e.id===s.id);e>=0?this.flowsCache[e]=s:this.flowsCache.push(s),this.flowsCache.some(e=>e.id===n.id)||this.flowsCache.push(n)}return{success:!0,parentFlow:s,childFlow:n}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Failed to convert Process to Subflow."}}}async updateFlow(e){r.debug("updateFlow: Entering method",{flowId:e.id,flowName:e.name,nodeCount:e.nodes.length,edgeCount:e.edges.length});try{let t=await fetch(`/api/flow/${encodeURIComponent(e.id)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();return{success:!1,error:e.error||"Failed to update flow"}}let o=await t.json();if(this.flowsCache){let t=this.flowsCache.findIndex(t=>t.id===e.id);t>=0?this.flowsCache[t]=o:this.flowsCache.push(o)}return r.debug("updateFlow: Flow updated successfully",{flowId:e.id}),{success:!0}}catch(e){return r.warn("updateFlow: Failed to update flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to update flow"}}}async deleteFlow(e){r.debug("deleteFlow: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>null);return{success:!1,error:"string"==typeof e?.error&&e.error?e.error:"Failed to delete flow"}}return this.flowsCache&&(this.flowsCache=this.flowsCache.filter(t=>t.id!==e)),r.debug("deleteFlow: Flow deleted successfully",{flowId:e}),{success:!0}}catch(e){return r.warn("deleteFlow: Failed to delete flow:",e),{success:!1,error:e instanceof Error?e.message:"Failed to delete flow"}}}async listFlowVersions(e){r.debug("listFlowVersions: Entering method",{flowId:e});try{let t=await fetch(`/api/flow/${encodeURIComponent(e)}/versions`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to list flow versions")}let o=await t.json();return Array.isArray(o.versions)?o.versions:[]}catch(t){return r.warn(`listFlowVersions: Failed for flow ${e}:`,t),[]}}async getFlowVersion(e,t){r.debug("getFlowVersion: Entering method",{flowId:e,versionId:t});try{let o=await fetch(`/api/flow/${encodeURIComponent(e)}/versions/${encodeURIComponent(t)}`);if(!o.ok){if(404===o.status)return null;let e=await o.json().catch(()=>null);throw Error(e?.error||"Failed to get flow version")}return await o.json()}catch(o){return r.warn(`getFlowVersion: Failed for ${e}/${t}:`,o),null}}createNode(e,t){return r.debug("createNode: Entering method",{type:e,position:t}),{id:(0,l.A)(),type:e,position:t,data:{label:`${"mcp"===e?"MCP":e.charAt(0).toUpperCase()+e.slice(1)} Node`,type:e,properties:"process"===e?{inputMode:"full-history"}:"static"===e?{entries:[]}:"subflow"===e?{resultPresentation:"separate",sessionScope:"per-key"}:{}}}}createStartNode(){return{id:(0,l.A)(),type:"start",position:{x:250,y:150},data:{label:"Start Node",type:"start",properties:{promptTemplate:""}}}}createNewFlow(e="NewFlow"){r.debug("createNewFlow: Entering method",{name:e});let t=Date.now();return{id:(0,l.A)(),name:e,createdAt:t,updatedAt:t,nodes:[this.createStartNode()],edges:[]}}createHistoryEntry(e,t){return r.debug("createHistoryEntry: Entering method"),{nodes:[...e],edges:[...t]}}generateSampleFlow(e="Sample Flow"){return r.debug("generateSampleFlow: Entering method",{name:e}),{id:(0,l.A)(),name:e,nodes:[{id:"1",type:"start",position:{x:250,y:50},data:{label:"Start Node",type:"start",properties:{prompt:"Enter your query here",systemMessage:"You are a helpful assistant",temperature:0}}},{id:"2",type:"process",position:{x:250,y:200},data:{label:"Process Node",type:"process",properties:{operation:"transform",enabled:!0}}},{id:"3",type:"finish",position:{x:250,y:350},data:{label:"Finish Node",type:"finish",properties:{format:"json",template:'{ "result": {{data}} }'}}},{id:"4",type:"mcp",position:{x:450,y:200},data:{label:"MCP Node",type:"mcp",properties:{channels:2,mode:"parallel"}}}],edges:[{id:"e1-2",source:"1",target:"2",type:"custom"},{id:"e2-3",source:"2",target:"3",type:"custom"}]}}constructor(){this.flowsCache=null}}let s=new a},94111:(e,t,o)=>{o.d(t,{L:()=>l,Z:()=>r});let l={light:{start:"#7E889E",process:"#6355E8",finish:"#15885A",mcp:"#129DB8",subflow:"#C67A13",resource:"#18AFA3",signal:"#9A78FF",trigger:"#EF5D8E",static:"#8A6BD1"},dark:{start:"#B7C0D2",process:"#8B7CFF",finish:"#57D59B",mcp:"#31D2ED",subflow:"#F6BC66",resource:"#63D8CE",signal:"#C4B2FF",trigger:"#FF9ABD",static:"#BFA8F0"}},r={resource:"#63D8CE",signal:"#C4B2FF",trigger:"#FF9ABD",static:"#BFA8F0"}},95863:(e,t,o)=>{o.d(t,{b:()=>w});let l=/credential|token|authorization|secret|password|api[-_ ]?key|environment|(^|[_-])env($|[_-])/i,r=(e,t,o,l)=>e?e.t(t,l):o,a=(e,t,o,l)=>e?e.tp(t,o):l,s={start:[{key:"promptTemplate",label:"Prompt template"}],process:[{key:"promptTemplate",label:"Prompt template"},{key:"boundModel",label:"Bound model"},{key:"modelName",label:"Model name"},{key:"inputMode",label:"Input mode",defaultValue:"full-history"},{key:"isolatedPrompt",label:"Isolated prompt",defaultValue:!1},{key:"allowCallerPrompt",label:"Allow caller prompt",defaultValue:!0},{key:"outputMode",label:"Output mode",defaultValue:"full-conversation"},{key:"excludeModelPrompt",label:"Exclude model prompt",defaultValue:!1},{key:"excludeStartNodePrompt",label:"Exclude start prompt",defaultValue:!1},{key:"excludeSystemPrompt",label:"Exclude system prompt",defaultValue:!1},{key:"enableTodoTool",label:"Enable todo tool",defaultValue:!1},{key:"captureVariable",label:"Capture variable"},{key:"captureResource",label:"Capture resource"},{key:"captureKv",label:"Capture key-value reference"},{key:"inputSchema",label:"Input schema"},{key:"outputSchema",label:"Output schema"},{key:"handoffTools",label:"Handoff tools"},{key:"mcpNodes",label:"Attached MCP nodes"}],finish:[{key:"successMessage",label:"Success message"},{key:"conditional",label:"Conditional completion",defaultValue:!1},{key:"condition",label:"Completion condition"}],mcp:[{key:"boundServer",label:"Bound server"},{key:"enabledTools",label:"Enabled tools"},{key:"toolTimeout",label:"Tool timeout"},{key:"roots",label:"Roots"},{key:"nameIsCustom",label:"Custom name",defaultValue:!1}],subflow:[{key:"subflowId",label:"Bound subflow"},{key:"parallelSubflowIds",label:"Parallel subflows"},{key:"parallelSubflowIdsVar",label:"Parallel subflow variable"},{key:"spawnBriefs",label:"Spawn briefs"},{key:"promptTemplate",label:"Prompt template"},{key:"inputMode",label:"Input mode",defaultValue:"full-history"},{key:"allowCallerPrompt",label:"Allow caller prompt",defaultValue:!0},{key:"allowCallerFanout",label:"Allow caller fan-out",defaultValue:!1},{key:"mapOverList",label:"Map over list",defaultValue:!1},{key:"itemSplit",label:"Item split",defaultValue:"json-array"},{key:"sequential",label:"Sequential",defaultValue:!1},{key:"concurrencyLimit",label:"Concurrency limit",defaultValue:4},{key:"errorStrategy",label:"Error strategy",defaultValue:"collect-all"},{key:"joinSeparator",label:"Join separator"},{key:"outputMode",label:"Output mode",defaultValue:"steps"},{key:"saveConversation",label:"Save conversation",defaultValue:!0}],resource:[{key:"scope",label:"Scope",defaultValue:"run"},{key:"boundServer",label:"Bound server"},{key:"uri",label:"Resource URI"},{key:"runName",label:"Run resource name"}],signal:[{key:"topic",label:"Topic"},{key:"payloadTemplate",label:"Payload template"}],static:[{key:"entries",label:"Entries"},{key:"injectOnce",label:"Inject once",defaultValue:!1}],trigger:[{key:"executionId",label:"Execution ID"},{key:"name",label:"Name"},{key:"enabled",label:"Enabled",defaultValue:!0},{key:"trigger",label:"Trigger configuration"},{key:"overlapStrategy",label:"Overlap strategy",defaultValue:"skip"},{key:"prompt",label:"Initial prompt"}]},n=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),i=e=>e.replace(/\s+/g," ").trim(),d=(e,t)=>{if(e.length<=t)return e;let o=e.slice(0,Math.max(0,t-1)),l=o.lastIndexOf(" "),r=l>Math.floor(.6*t)?o.slice(0,l):o;return`${r.trimEnd()}…`},p=e=>{let t="string"==typeof e?e:void 0;if(void 0!==t)return i(t)||void 0},c=e=>Array.isArray(e)?e.filter(e=>"string"==typeof e).map(i).filter(Boolean):[],u=(e,t,o)=>{if(!Object.prototype.hasOwnProperty.call(e,t))return`${o} (default)`;let l=e[t];return"string"==typeof l?i(l)||"empty":null===l?"null":String(l)},f=e=>{if("string"!=typeof e)return;if(!e.trim())return"empty";let t=e.split(/\r?\n/).map(i).filter(Boolean).slice(0,3).map(e=>d(e,90));return t.length?t.join("\n"):"empty"},h=(e,t=0)=>{if("string"==typeof e)return d(e,500);if(null===e||"number"==typeof e||"boolean"==typeof e)return e;if(void 0===e)return"[absent]";if("bigint"==typeof e)return e.toString();if("object"!=typeof e)return String(e);if(t>=3)return"[depth limit]";if(Array.isArray(e)){let o=e.slice(0,12).map(e=>h(e,t+1));return e.length>12&&o.push(`[${e.length-12} more items]`),o}let o=Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).slice(0,20),r={};for(let[e,a]of o)r[e]=l.test(e)?"[redacted]":h(a,t+1);let a=Object.keys(e).length;return a>20&&(r["…"]=`[${a-20} more fields]`),r},m=e=>{let t=h(e);return"string"==typeof t?t:JSON.stringify(t,null,2)},y=(e,t,o,l)=>{if(!Object.prototype.hasOwnProperty.call(o,e))return void 0!==l?{key:e,label:t,state:"default",value:`[default: ${m(l)}]`}:{key:e,label:t,state:"absent",value:"[absent]"};let r=o[e],a=""===r||Array.isArray(r)&&0===r.length;return{key:e,label:t,state:a?"empty":"configured",value:a?""===r?"[empty string]":"[empty array]":m(r)}},w=(e,t,o,l)=>{let i,h,m,w=e||{},g=n(w.properties)?w.properties:{};"signal"===t&&"string"==typeof g.topic&&(g={...g,topic:g.topic.trim()});let b="signal"===t?r(o,"flows.nodeInfo.signal","Signal"):r(o,"flows.nodeInfo.noLabel","No Label"),k=p(w.label)||b,x="signal"===t&&p(g.topic)||k,v=[],F=p(w.description);if(F&&v.push({key:"description",label:r(o,"flows.nodeInfo.description","Description"),value:d(F,180)}),"process"===t){let e;j=g,v.push({key:"modes",label:r(o,"flows.nodeInfo.modes","Modes"),value:`${u(j,"inputMode","full-history")} → ${u(j,"outputMode","full-conversation")}`}),void 0!==(e=f(j.promptTemplate))&&v.push({key:"prompt",label:r(o,"flows.nodeInfo.prompt","Prompt"),value:e,multiline:!0})}else if("subflow"===t)((e,t,o,l)=>{let s=p(t.subflowId),n=c(t.parallelSubflowIds),i=p(t.parallelSubflowIdsVar),d=c(t.spawnBriefs),f=r(o,"flows.nodeInfo.notBound","Not bound");s?f=l?.get(s)||s:n.length?f=a(o,"flows.nodeInfo.parallelFlow",n.length,`${n.length} parallel flow${1===n.length?"":"s"}`):i&&(f=r(o,"flows.nodeInfo.flowsFrom",`Flows from ${i}`,{variable:i})),e.push({key:"target",label:r(o,"flows.nodeInfo.target","Target"),value:f}),e.push({key:"modes",label:r(o,"flows.nodeInfo.modes","Modes"),value:`${u(t,"inputMode","full-history")} → ${u(t,"outputMode","steps")}`});let h="number"==typeof t.concurrencyLimit?Math.max(1,Math.floor(t.concurrencyLimit)):4,m=[r(o,"flows.nodeInfo.maxChildren",`max ${h} simultaneous children`,{count:h})];if(!s&&(n.length>0||i)&&m.push(!0===t.sequential?r(o,"flows.nodeInfo.sequentialFanout","sequential fan-out"):r(o,"flows.nodeInfo.parallelFanout","parallel fan-out")),!0===t.mapOverList){let e=u(t,"itemSplit","json-array");m.push(r(o,"flows.nodeInfo.mapList",`map list (${e})`,{mode:e}))}d.length&&m.push(a(o,"flows.nodeInfo.spawnBrief",d.length,`${d.length} spawn brief${1===d.length?"":"s"}`)),e.push({key:"execution",label:r(o,"flows.nodeInfo.execution","Execution"),value:m.join(" \xb7 ")})})(v,g,o,l);else if("mcp"===t){var j,I=g;v.push({key:"server",label:r(o,"flows.nodeInfo.server","Server"),value:p(I.boundServer)||r(o,"flows.nodeInfo.notBound","Not bound")});let e=c(I.enabledTools);if(e.length){let t=e.slice(0,3),l=e.length-t.length;v.push({key:"tools",label:r(o,"flows.nodeInfo.tools","Tools"),value:`${o?o.formatList(t):t.join(", ")}${l>0?` ${r(o,"flows.nodeInfo.more",`+${l} more`,{count:l})}`:""} (${e.length})`})}else v.push({key:"tools",label:r(o,"flows.nodeInfo.tools","Tools"),value:r(o,"flows.nodeInfo.noneEnabled","None enabled")})}else((e,t,o,l)=>{if("start"===t){let t=f(o.promptTemplate);void 0!==t&&e.push({key:"prompt",label:r(l,"flows.nodeInfo.prompt","Prompt"),value:t,multiline:!0})}else if("resource"===t){let t=u(o,"scope","run");e.push({key:"scope",label:r(l,"flows.nodeInfo.scope","Scope"),value:t});let a=p(o.uri)||p(o.runName);a&&e.push({key:"resource",label:r(l,"flows.nodeInfo.resource","Resource"),value:d(a,100)})}else if("signal"===t){let t=f(o.payloadTemplate);void 0!==t&&e.push({key:"payload",label:r(l,"flows.nodeInfo.payload","Payload"),value:t,multiline:!0})}else if("static"===t){let t=Array.isArray(o.entries)?o.entries:[];e.push({key:"entries",label:r(l,"flows.nodeInfo.entries","Entries"),value:String(t.length)});let a=t.find(e=>n(e));if(a){let t=f("toolCall"===a.kind?a.toolName:a.content);void 0!==t&&e.push({key:"first",label:r(l,"flows.nodeInfo.first","First entry"),value:t,multiline:!0})}}else if("trigger"===t){let t=n(o.trigger)?o.trigger:{};e.push({key:"trigger",label:r(l,"flows.nodeInfo.trigger","Trigger"),value:p(t.type)||r(l,"flows.nodeInfo.notConfigured","Not configured")}),e.push({key:"enabled",label:r(l,"flows.nodeInfo.status","Status"),value:!1===o.enabled?r(l,"flows.nodeInfo.disabled","Disabled"):r(l,"flows.nodeInfo.enabled","Enabled")})}})(v,t,g,o);let C={type:"string"==typeof w.type&&w.type?w.type:t,label:x};Object.prototype.hasOwnProperty.call(w,"description")&&(C.description=w.description);let S=[y("type",o?"type":"Type",C),y("label",o?"label":"Label",C),y("description",o?"description":"Description",C)].map(e=>({...e,key:`metadata.${e.key}`}));for(let e of s[t])S.push(y(e.key,o?e.key:e.label,g,e.defaultValue));return{label:x,summary:v,technicalDetails:S,technicalText:(i=S.filter(e=>e.key.startsWith("metadata.")),h=S.filter(e=>!e.key.startsWith("metadata.")),m=e=>`${e.label}: ${e.value}`,[r(o,"flows.nodeInfo.nodeMetadata","Node metadata"),...i.map(m),"",r(o,"flows.nodeInfo.supportedProperties","Supported properties"),...h.map(m)].join("\n"))}}},97436:(e,t,o)=>{o.d(t,{G:()=>l});let l=(0,o(12115).createContext)(new Map)}}]);
|