@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +564 -2
- package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
- package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
- package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
- package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
- package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
- package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
- package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
- package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
- package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
- package/dist/DateTimeField-B1qR4ruo.js +51 -0
- package/dist/Disclosure-BNKij7-v.js +45 -0
- package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
- package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
- package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
- package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
- package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
- package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
- package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
- package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
- package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
- package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
- package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
- package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
- package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
- package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
- package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
- package/dist/FluidGridsMark-CE2blT7K.js +74 -0
- package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
- package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
- package/dist/HistoryPage-BSBISXoj.js +2835 -0
- package/dist/Icon-BtQ0HXLh.js +160 -0
- package/dist/InsightsPage-D7ybj8N9.js +11245 -0
- package/dist/IsolationSetting-vy911E8b.js +1153 -0
- package/dist/LibraryParts-DOeNgR8A.js +413 -0
- package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
- package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
- package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
- package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
- package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
- package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
- package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
- package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
- package/dist/NodesPage-O7KeeKtd.js +653 -0
- package/dist/OfflineIcon-TwMKYWjA.js +207 -0
- package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
- package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
- package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
- package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
- package/dist/RunActionsMenu-DodOgIQm.js +59 -0
- package/dist/RunnerStatusPill-C1v967iq.js +24 -0
- package/dist/RunnersPage-dB0RSdY_.js +1929 -0
- package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
- package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
- package/dist/SearchBox-BGtYjvfs.js +49 -0
- package/dist/SequenceEditor-CFiHeHkR.js +497 -0
- package/dist/SettingsPage-0CQBNPZV.js +8695 -0
- package/dist/StewardPages-DAJhepen.js +47 -0
- package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
- package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
- package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
- package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
- package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
- package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
- package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
- package/dist/TemplatePreview-cx7-NOeG.js +868 -0
- package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
- package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
- package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
- package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
- package/dist/TranslationBridge-Da-TPgQm.js +68 -0
- package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
- package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
- package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
- package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
- package/dist/VariablesPage-ChfGuW22.js +2243 -0
- package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
- package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
- package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
- package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
- package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
- package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
- package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
- package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
- package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
- package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
- package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
- package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
- package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
- package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
- package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
- package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
- package/dist/WorkflowsList--hR2_8gf.js +4593 -0
- package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
- package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
- package/dist/addonCatalog-CbZS4deh.js +58 -0
- package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
- package/dist/addons.d.ts +3 -0
- package/dist/addons.js +4 -0
- package/dist/agent-form-Bfvm32j1.js +83 -0
- package/dist/agent-tools.d.ts +3 -0
- package/dist/agent-tools.js +5 -0
- package/dist/agentTools-CyL7DLOF.js +320 -0
- package/dist/ai-usage-BrxDgvdR.js +240 -0
- package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
- package/dist/api-BKq-nIOZ.js +2286 -0
- package/dist/api-Ol7I8NxE.js +8289 -0
- package/dist/apollo-type-policies.d.ts +11 -0
- package/dist/apollo-type-policies.js +64 -0
- package/dist/askAboutBridge-ByYsQams.js +106 -0
- package/dist/askQuestions-Cmx7VnMm.js +742 -0
- package/dist/assert-rules-lfYEMc99.js +318 -0
- package/dist/assistant.d.ts +94 -0
- package/dist/assistant.js +99 -0
- package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
- package/dist/badge-CXfPhoMH.js +26 -0
- package/dist/basil.generated-BK-EHbwN.js +10 -0
- package/dist/browser-steps-DMpS5TyB.js +533 -0
- package/dist/builderTimings-pvGnK1m-.js +510 -0
- package/dist/button-DG7y_FVJ.js +48 -0
- package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
- package/dist/card-Bomy_1UG.js +44 -0
- package/dist/catalogGrid-BOrfMgi-.js +41 -0
- package/dist/channel-CPyQ1NR1.js +212 -0
- package/dist/chips-CvNrYJZa.js +27 -0
- package/dist/client-holder-C0M5Cfwl.js +68 -0
- package/dist/cn-QqidFIgr.js +10 -0
- package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
- package/dist/code-editor-field-x_JrY8KR.js +113 -0
- package/dist/codec-client-DPuD6mw7.js +515 -0
- package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
- package/dist/config-DO68jw5k.js +322 -0
- package/dist/constants-DgbVc24O.d.ts +296 -0
- package/dist/constants-DlRnHBfQ.js +217 -0
- package/dist/convert-browser-action-pfecelF7.js +347 -0
- package/dist/convert-dialog-B_o22NiJ.js +382 -0
- package/dist/create-workflow-first-Azg3JUdX.js +120 -0
- package/dist/definition-canvas-Bsda-rDT.js +31 -0
- package/dist/dialog-BVd152GS.js +94 -0
- package/dist/durable-nodes-BXyYCLxT.js +91 -0
- package/dist/duration-CDb7-mT_.js +33 -0
- package/dist/edge-mapper-wEAdGVU2.js +4477 -0
- package/dist/element-library-DkSlg_VE.js +727 -0
- package/dist/entities-I_0kio3q.js +38 -0
- package/dist/error-advice-QLr5NCm7.js +65 -0
- package/dist/errors-ClKb5sEt.js +188 -0
- package/dist/executions.d.ts +3 -0
- package/dist/executions.js +5 -0
- package/dist/feature-flags-B2qetXKd.js +385 -0
- package/dist/field-label-DPZRmE_B.js +153 -0
- package/dist/firstWorkflow-C_h0KMB2.js +133 -0
- package/dist/flags.d.ts +3 -0
- package/dist/flags.js +4 -0
- package/dist/flow-builder-DIvLOhz0.js +28038 -0
- package/dist/flow-store-holder-CUN7Terz.js +52 -0
- package/dist/fluent.generated-CA_e6-4l.js +14 -0
- package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
- package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
- package/dist/global-client-BQPuFrFa.js +433 -0
- package/dist/global-operations-BG6YgxrM.js +136 -0
- package/dist/graphql-types-UTYtujY9.js +21358 -0
- package/dist/history.d.ts +3 -0
- package/dist/history.js +4 -0
- package/dist/index-AoJAa5vU.d.ts +164958 -0
- package/dist/index-DEMT3iAM.d.ts +120 -0
- package/dist/index-ROZzNGyY.d.ts +76 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +8123 -0
- package/dist/ion.generated-mbajjcAg.js +10 -0
- package/dist/label-Lzb8ZXf_.js +29 -0
- package/dist/labels-rXd9gYQz.js +1236 -0
- package/dist/liveCanvas-D5ytXDp8.js +103 -0
- package/dist/logos.generated-X6_0kjVR.js +21 -0
- package/dist/logs-panel-Cw0DkG0l.js +468 -0
- package/dist/lucide.generated-B6NVd3GT.js +29 -0
- package/dist/marksStore-a9oIMMot.js +175 -0
- package/dist/mcp-trigger-D0nRdvq5.js +307 -0
- package/dist/mdi.generated-D1BV74d6.js +292 -0
- package/dist/menus-CU3hDGYl.js +160 -0
- package/dist/mynaui.generated-DMWr5cXz.js +66 -0
- package/dist/navigation-v2.d.ts +3 -0
- package/dist/navigation-v2.js +5 -0
- package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
- package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
- package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
- package/dist/node-registry-refresh-s3okf83X.js +27 -0
- package/dist/node-role-TMbnkmeP.js +132 -0
- package/dist/node-type-icon-BZa8n4iG.js +33 -0
- package/dist/nodes.d.ts +3 -0
- package/dist/nodes.js +4 -0
- package/dist/notesKey-5EaREBGA.js +12 -0
- package/dist/observability.d.ts +3 -0
- package/dist/observability.js +5 -0
- package/dist/offset-pages-zghoClB3.js +55 -0
- package/dist/operations-BBmT9ToP.js +663 -0
- package/dist/operations-WxRJWeqO.js +3133 -0
- package/dist/output-files-Ba8bu5lv.js +196 -0
- package/dist/page-operation-DrWuhd6Y.js +129 -0
- package/dist/page-twins.d.ts +13 -0
- package/dist/page-twins.js +186 -0
- package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
- package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
- package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
- package/dist/panels-PfBBAToE.js +346 -0
- package/dist/parts-B7fBcw-B.js +346 -0
- package/dist/popover-Dms9Vz3j.js +3389 -0
- package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
- package/dist/proactive.d.ts +66 -0
- package/dist/proactive.js +237 -0
- package/dist/quick-config-panel-DFd77xho.js +451 -0
- package/dist/quota-DeA_CJ2e.js +175 -0
- package/dist/quota.d.ts +3 -0
- package/dist/quota.js +4 -0
- package/dist/read-only-context-Dt9N9SIG.js +18 -0
- package/dist/relative-time-Dxt8ZIIu.js +55 -0
- package/dist/results-CwK_yDxK.js +325 -0
- package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
- package/dist/route-data.d.ts +12 -0
- package/dist/route-data.js +69 -0
- package/dist/route-match-C-0_EnAt.d.ts +5 -0
- package/dist/route-match-DMkUICYV.js +41 -0
- package/dist/route-preload-C4DlGoCd.js +120 -0
- package/dist/run-display-UjLAoYqQ.js +81 -0
- package/dist/run-history-arGiHzGU.js +285 -0
- package/dist/run-list-links-DJn4Mf1T.js +98 -0
- package/dist/run-mode-USmM0-Uo.js +82 -0
- package/dist/run-parity-CWXqEJqM.js +144 -0
- package/dist/runsQuota-B6SyTbne.js +100 -0
- package/dist/runsQuota-DsniKiSg.d.ts +20 -0
- package/dist/safe-expression-Cw7-SCsm.js +1251 -0
- package/dist/save-status-store-C7nEYpfb.js +631 -0
- package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
- package/dist/schedule-rules-ggVKRkBH.js +358 -0
- package/dist/secrets-Re_wSiE3.js +153 -0
- package/dist/settings.d.ts +4 -0
- package/dist/settings.js +6 -0
- package/dist/shared-DAWGGMSM.js +177 -0
- package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
- package/dist/solar.generated-CGYuUQAC.js +10 -0
- package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
- package/dist/start-url-CT6Yz96K.js +24 -0
- package/dist/status-CessxGpm.js +55 -0
- package/dist/store-icon-OctYp5zP.js +155 -0
- package/dist/styles-WGmTnZ2n.js +26 -0
- package/dist/styles.css +139 -0
- package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
- package/dist/template-code-CzN6JWNV.js +191 -0
- package/dist/template-graph-DLF9dygU.js +20 -0
- package/dist/template-preview-DcIIKOOL.js +32 -0
- package/dist/template-price-CdUHZRMF.js +40 -0
- package/dist/templates.d.ts +3 -0
- package/dist/templates.js +5 -0
- package/dist/theme-provider-CntfC4_i.js +23 -0
- package/dist/transient-DgZfhDfN.js +57 -0
- package/dist/typed-calls-C5tO03wq.js +26 -0
- package/dist/ui-script-By74Guk3.js +1094 -0
- package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
- package/dist/ui-step-fix-8uM2_Hft.js +67 -0
- package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
- package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
- package/dist/ui-target-editor-D2JhB_lD.js +673 -0
- package/dist/uiMarkTools-CSznnO1i.js +1054 -0
- package/dist/upgradePrompt-BAFBKKW5.js +72 -0
- package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
- package/dist/use-browser-available-hj8wc3Kb.js +241 -0
- package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
- package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
- package/dist/use-mobile-BTqCUjzS.js +27 -0
- package/dist/use-sdk-query-C697xZVv.js +116 -0
- package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
- package/dist/useActionParam-B2tU2BlY.js +85 -0
- package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
- package/dist/useBrowserClients-3v95-gSh.js +103 -0
- package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
- package/dist/useConnections-DsgEJs05.js +439 -0
- package/dist/useDebouncedValue-BFekcv6n.js +18 -0
- package/dist/useDurableParity-8fnMZmBc.js +1787 -0
- package/dist/useEntityTags-D0spL6Ut.js +460 -0
- package/dist/useExecutions-2u5nGJJk.js +681 -0
- package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
- package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
- package/dist/useHumanRequests-zlYDp3l1.js +221 -0
- package/dist/useNavigationV2-C2WeqN7d.js +29 -0
- package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
- package/dist/useObservability-BRlQ0tOA.js +285 -0
- package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
- package/dist/useRunHistory-CXCMUPyf.js +2759 -0
- package/dist/useRunLive-D0JvVZT2.js +1060 -0
- package/dist/useRunnerList-Dbi59i1K.js +446 -0
- package/dist/useRunners-URUc5quU.js +173 -0
- package/dist/useRunsPage-DG656UCK.js +2709 -0
- package/dist/useVariables-BIelxcWr.js +463 -0
- package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
- package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
- package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
- package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
- package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
- package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
- package/dist/utils-fvBb5qOD.js +89 -0
- package/dist/webhook-deliveries-AvQujaZy.js +99 -0
- package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
- package/dist/workflow-builder.d.ts +3 -0
- package/dist/workflow-builder.js +8 -0
- package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
- package/dist/workflow-embed.d.ts +3 -0
- package/dist/workflow-embed.js +4 -0
- package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
- package/dist/workflow-host.d.ts +6 -0
- package/dist/workflow-host.js +11 -0
- package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
- package/dist/workflow-pages.d.ts +3 -0
- package/dist/workflow-pages.js +115 -0
- package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
- package/dist/workflow-preview.d.ts +65 -0
- package/dist/workflow-preview.js +4 -0
- package/dist/workflow-route.d.ts +33 -0
- package/dist/workflow-route.js +4 -0
- package/dist/workflow-save-state-D0l-DkLf.js +767 -0
- package/dist/workflow-transfer-CQnQC-ke.js +104 -0
- package/dist/workflowRouteData-BkfVOc-O.js +169 -0
- package/dist/workflows-list.d.ts +10 -0
- package/dist/workflows-list.js +5 -0
- package/package.json +320 -4
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as getFluidGridsConfig } from "./config-DO68jw5k.js";
|
|
3
|
+
import { n as getGlobalStoreClient } from "./global-client-BQPuFrFa.js";
|
|
4
|
+
import { s as throwIfResultError } from "./errors-ClKb5sEt.js";
|
|
5
|
+
import { n as getFluidGridsClient } from "./client-holder-C0M5Cfwl.js";
|
|
6
|
+
import { C as externalGatewayUrl, S as endpointUrl, f as sortServers, g as McpFormError, w as isMcpKey } from "./mcp-trigger-D0nRdvq5.js";
|
|
7
|
+
import { b as writeAutosavePreference, f as readAutosavePreference, n as AUTOSAVE_PREFERENCE_KEY, o as createSaveQueue } from "./workflow-save-state-D0l-DkLf.js";
|
|
8
|
+
import { useCallback, useEffect, useState } from "react";
|
|
9
|
+
import { create } from "zustand";
|
|
10
|
+
import { gql } from "@apollo/client";
|
|
11
|
+
import { resolveExternalGatewayUrls } from "@burdenoff/fe-libs/shared/config";
|
|
12
|
+
|
|
13
|
+
// src/components/shared/markdownRenderer.ts
|
|
14
|
+
/**
|
|
15
|
+
* The markdown renderer, loaded on first use (BOFF-11944). See LazyMarkdown.
|
|
16
|
+
*/
|
|
17
|
+
let renderer = null;
|
|
18
|
+
let pending = null;
|
|
19
|
+
/**
|
|
20
|
+
* Loads the markdown renderer once for every caller. A failed load is
|
|
21
|
+
* forgotten, so the next caller asks again.
|
|
22
|
+
*/
|
|
23
|
+
function loadMarkdown() {
|
|
24
|
+
pending ??= import("react-markdown").then((m) => {
|
|
25
|
+
renderer = m.default;
|
|
26
|
+
return m.default;
|
|
27
|
+
}, (error) => {
|
|
28
|
+
pending = null;
|
|
29
|
+
throw error;
|
|
30
|
+
});
|
|
31
|
+
return pending;
|
|
32
|
+
}
|
|
33
|
+
/** The markdown renderer once loaded (it starts the load), else null. */
|
|
34
|
+
function useMarkdownRenderer() {
|
|
35
|
+
const [Markdown, setMarkdown] = useState(() => renderer);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (Markdown) return void 0;
|
|
38
|
+
let live = true;
|
|
39
|
+
loadMarkdown().then((loaded) => {
|
|
40
|
+
if (live) setMarkdown(() => loaded);
|
|
41
|
+
}, (error) => {
|
|
42
|
+
console.error("[FluidGrids] Markdown renderer failed to load:", error);
|
|
43
|
+
});
|
|
44
|
+
return () => {
|
|
45
|
+
live = false;
|
|
46
|
+
};
|
|
47
|
+
}, [Markdown]);
|
|
48
|
+
return Markdown;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/hooks/workflow-saved-events.ts
|
|
52
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
53
|
+
function subscribeWorkflowSaved(workflowKey, listener) {
|
|
54
|
+
const subscribers = listeners.get(workflowKey) ?? /* @__PURE__ */ new Set();
|
|
55
|
+
subscribers.add(listener);
|
|
56
|
+
listeners.set(workflowKey, subscribers);
|
|
57
|
+
return () => {
|
|
58
|
+
subscribers.delete(listener);
|
|
59
|
+
if (subscribers.size === 0) listeners.delete(workflowKey);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function notifyWorkflowSaved(workflowKey) {
|
|
63
|
+
listeners.get(workflowKey)?.forEach((listener) => listener());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/modules/mcp-gateway/hooks/useMcpGateway.ts
|
|
67
|
+
/**
|
|
68
|
+
* Governed MCP gateway (BOFF-9964): data for Settings → MCP.
|
|
69
|
+
*
|
|
70
|
+
* Tools, tool set versions and the call log live in wspace-workflow-svc (workspace gateway).
|
|
71
|
+
* MCP tokens are ordinary global-auth app credentials (global gateway): an API_INTEGRATION app
|
|
72
|
+
* authorised for this workspace and an API key carrying `mcp:` scopes. Every rule is enforced by
|
|
73
|
+
* the services and the gateway; this is only the admin surface.
|
|
74
|
+
*/
|
|
75
|
+
const TOOL_FIELDS = `
|
|
76
|
+
id
|
|
77
|
+
toolName
|
|
78
|
+
kind
|
|
79
|
+
description
|
|
80
|
+
workflowKey
|
|
81
|
+
nodeType
|
|
82
|
+
nodeVersion
|
|
83
|
+
operation
|
|
84
|
+
connectionId
|
|
85
|
+
adapter
|
|
86
|
+
readOnly
|
|
87
|
+
allowWrite
|
|
88
|
+
enabled
|
|
89
|
+
updatedAt
|
|
90
|
+
`;
|
|
91
|
+
const TOOL_SET_FIELDS = `
|
|
92
|
+
id
|
|
93
|
+
version
|
|
94
|
+
status
|
|
95
|
+
note
|
|
96
|
+
publishedAt
|
|
97
|
+
tools { name kind description readOnly workflowKey nodeType operation }
|
|
98
|
+
`;
|
|
99
|
+
const CALL_FIELDS = `
|
|
100
|
+
id
|
|
101
|
+
toolSetVersion
|
|
102
|
+
toolName
|
|
103
|
+
toolKind
|
|
104
|
+
actorId
|
|
105
|
+
decision
|
|
106
|
+
decisionReason
|
|
107
|
+
policyName
|
|
108
|
+
status
|
|
109
|
+
runId
|
|
110
|
+
latencyMs
|
|
111
|
+
errorCode
|
|
112
|
+
errorMessage
|
|
113
|
+
approvalStatus
|
|
114
|
+
approvalExpiresAt
|
|
115
|
+
argsSha256
|
|
116
|
+
serverPath
|
|
117
|
+
workflowKey
|
|
118
|
+
createdAt
|
|
119
|
+
`;
|
|
120
|
+
const OVERVIEW = gql`
|
|
121
|
+
query McpGatewayOverview {
|
|
122
|
+
mcpEndpoint { path productKey workspaceId latestVersion }
|
|
123
|
+
mcpExposedTools { ${TOOL_FIELDS} }
|
|
124
|
+
mcpToolSets { ${TOOL_SET_FIELDS} }
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
127
|
+
const TRIGGER_SERVERS = gql`
|
|
128
|
+
query McpTriggerServers($workflowKey: String) {
|
|
129
|
+
mcpEndpoint { path }
|
|
130
|
+
mcpTriggerServers(workflowKey: $workflowKey) { ${`
|
|
131
|
+
id
|
|
132
|
+
workflowKey
|
|
133
|
+
workflowVersion
|
|
134
|
+
triggerNodeId
|
|
135
|
+
path
|
|
136
|
+
endpointPath
|
|
137
|
+
serverName
|
|
138
|
+
instructions
|
|
139
|
+
schemaVersion
|
|
140
|
+
tools { name description readOnly nodeType operation }
|
|
141
|
+
skipped { toolName reason }
|
|
142
|
+
callTimeoutSeconds
|
|
143
|
+
isActive
|
|
144
|
+
activatedAt
|
|
145
|
+
deactivatedAt
|
|
146
|
+
scope
|
|
147
|
+
`} }
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
const CALLS = gql`
|
|
151
|
+
query McpToolCalls($first: Int, $after: String, $filter: McpToolCallFilter) {
|
|
152
|
+
mcpToolCalls(first: $first, after: $after, filter: $filter) {
|
|
153
|
+
items { ${CALL_FIELDS} }
|
|
154
|
+
nextCursor
|
|
155
|
+
hasMore
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
const EXPOSE_WORKFLOW = gql`
|
|
160
|
+
mutation ExposeWorkflowAsMcpTool($input: ExposeWorkflowAsMcpToolInput!) {
|
|
161
|
+
exposeWorkflowAsMcpTool(input: $input) { ${TOOL_FIELDS} }
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
const EXPOSE_CONNECTOR = gql`
|
|
165
|
+
mutation ExposeConnectorOperationAsMcpTool($input: ExposeConnectorOperationAsMcpToolInput!) {
|
|
166
|
+
exposeConnectorOperationAsMcpTool(input: $input) { ${TOOL_FIELDS} }
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
const SET_ENABLED = gql`
|
|
170
|
+
mutation SetMcpToolEnabled($id: ID!, $enabled: Boolean!) {
|
|
171
|
+
setMcpToolEnabled(id: $id, enabled: $enabled) {
|
|
172
|
+
id
|
|
173
|
+
enabled
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
const REMOVE_TOOL = gql`
|
|
178
|
+
mutation RemoveMcpTool($id: ID!) {
|
|
179
|
+
removeMcpTool(id: $id)
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
182
|
+
const PUBLISH = gql`
|
|
183
|
+
mutation PublishMcpToolSet($note: String) {
|
|
184
|
+
publishMcpToolSet(note: $note) {
|
|
185
|
+
created
|
|
186
|
+
toolSet { ${TOOL_SET_FIELDS} }
|
|
187
|
+
skipped { toolName reason }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
const DEPRECATE = gql`
|
|
192
|
+
mutation DeprecateMcpToolSet($version: Int!) {
|
|
193
|
+
deprecateMcpToolSet(version: $version) {
|
|
194
|
+
id
|
|
195
|
+
status
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
`;
|
|
199
|
+
const DECIDE = gql`
|
|
200
|
+
mutation DecideMcpToolCallApproval($id: ID!, $approve: Boolean!) {
|
|
201
|
+
decideMcpToolCallApproval(id: $id, approve: $approve) {
|
|
202
|
+
id
|
|
203
|
+
approvalStatus
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
const MY_API_KEYS = gql`
|
|
208
|
+
query McpApiKeys($pagination: PaginationInput) {
|
|
209
|
+
myApiKeys(pagination: $pagination) {
|
|
210
|
+
apiKeys {
|
|
211
|
+
id
|
|
212
|
+
name
|
|
213
|
+
prefix
|
|
214
|
+
appId
|
|
215
|
+
appName
|
|
216
|
+
scopes
|
|
217
|
+
expiresAt
|
|
218
|
+
lastUsedAt
|
|
219
|
+
createdAt
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`;
|
|
224
|
+
const CREATE_APP = gql`
|
|
225
|
+
mutation CreateMcpClientApp($input: CreateAppInput!) {
|
|
226
|
+
createApp(input: $input) {
|
|
227
|
+
app {
|
|
228
|
+
id
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
`;
|
|
233
|
+
const GRANT_WORKSPACE = gql`
|
|
234
|
+
mutation GrantMcpClientWorkspace($input: GrantAppWorkspaceAccessInput!) {
|
|
235
|
+
grantAppWorkspaceAccess(input: $input) {
|
|
236
|
+
id
|
|
237
|
+
status
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
`;
|
|
241
|
+
const GENERATE_KEY = gql`
|
|
242
|
+
mutation GenerateMcpApiKey($input: GenerateAPIKeyInput!) {
|
|
243
|
+
generateAPIKey(input: $input) {
|
|
244
|
+
apiKey
|
|
245
|
+
apiSecret
|
|
246
|
+
keyId
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
`;
|
|
250
|
+
const REVOKE_KEY = gql`
|
|
251
|
+
mutation RevokeMcpApiKey($keyId: String!) {
|
|
252
|
+
revokeAPIKey(keyId: $keyId)
|
|
253
|
+
}
|
|
254
|
+
`;
|
|
255
|
+
/**
|
|
256
|
+
* The full URL an external MCP client calls for a gateway path such as `/mcp/<product>/<ws>` or
|
|
257
|
+
* `/mcp/<product>/<ws>/s/<path>`.
|
|
258
|
+
*/
|
|
259
|
+
function mcpPublicUrl(path) {
|
|
260
|
+
return endpointUrl(externalGatewayUrl(getFluidGridsConfig().apiGatewayUrl, typeof window === "undefined" ? void 0 : window.location.origin, () => resolveExternalGatewayUrls().workspaceBaseUrl), path);
|
|
261
|
+
}
|
|
262
|
+
function globalClient() {
|
|
263
|
+
const client = getGlobalStoreClient();
|
|
264
|
+
if (!client) throw new McpFormError("Token management is not available in this app.");
|
|
265
|
+
return client;
|
|
266
|
+
}
|
|
267
|
+
/** Tools, versions and the endpoint, reloaded after every change. */
|
|
268
|
+
function useMcpGateway() {
|
|
269
|
+
const [endpoint, setEndpoint] = useState(null);
|
|
270
|
+
const [tools, setTools] = useState([]);
|
|
271
|
+
const [toolSets, setToolSets] = useState([]);
|
|
272
|
+
const [loading, setLoading] = useState(true);
|
|
273
|
+
const [error, setError] = useState(null);
|
|
274
|
+
const reload = useCallback(async () => {
|
|
275
|
+
setLoading(true);
|
|
276
|
+
try {
|
|
277
|
+
const result = await getFluidGridsClient().query({
|
|
278
|
+
query: OVERVIEW,
|
|
279
|
+
fetchPolicy: "network-only"
|
|
280
|
+
});
|
|
281
|
+
throwIfResultError(result);
|
|
282
|
+
setEndpoint(result.data?.mcpEndpoint ?? null);
|
|
283
|
+
setTools(result.data?.mcpExposedTools ?? []);
|
|
284
|
+
setToolSets(result.data?.mcpToolSets ?? []);
|
|
285
|
+
setError(null);
|
|
286
|
+
} catch (err) {
|
|
287
|
+
setError(err);
|
|
288
|
+
} finally {
|
|
289
|
+
setLoading(false);
|
|
290
|
+
}
|
|
291
|
+
}, []);
|
|
292
|
+
useEffect(() => {
|
|
293
|
+
reload();
|
|
294
|
+
}, [reload]);
|
|
295
|
+
const mutateAndReload = useCallback(async (mutation, variables) => {
|
|
296
|
+
const result = await getFluidGridsClient().mutate({
|
|
297
|
+
mutation,
|
|
298
|
+
variables
|
|
299
|
+
});
|
|
300
|
+
throwIfResultError(result);
|
|
301
|
+
await reload();
|
|
302
|
+
return result.data;
|
|
303
|
+
}, [reload]);
|
|
304
|
+
return {
|
|
305
|
+
endpoint,
|
|
306
|
+
tools,
|
|
307
|
+
toolSets,
|
|
308
|
+
loading,
|
|
309
|
+
error,
|
|
310
|
+
reload,
|
|
311
|
+
exposeWorkflow: useCallback((input) => mutateAndReload(EXPOSE_WORKFLOW, { input }), [mutateAndReload]),
|
|
312
|
+
exposeConnector: useCallback((input) => mutateAndReload(EXPOSE_CONNECTOR, { input }), [mutateAndReload]),
|
|
313
|
+
setEnabled: useCallback((id, enabled) => mutateAndReload(SET_ENABLED, {
|
|
314
|
+
id,
|
|
315
|
+
enabled
|
|
316
|
+
}), [mutateAndReload]),
|
|
317
|
+
removeTool: useCallback((id) => mutateAndReload(REMOVE_TOOL, { id }), [mutateAndReload]),
|
|
318
|
+
publish: useCallback(async (note) => {
|
|
319
|
+
const data = await mutateAndReload(PUBLISH, { note: note || null });
|
|
320
|
+
if (!data?.publishMcpToolSet) throw new McpFormError("Publishing returned nothing.");
|
|
321
|
+
return data.publishMcpToolSet;
|
|
322
|
+
}, [mutateAndReload]),
|
|
323
|
+
deprecate: useCallback((version) => mutateAndReload(DEPRECATE, { version }), [mutateAndReload])
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/** The call log, newest first, with "load more" and approval decisions. */
|
|
327
|
+
function useMcpToolCalls(pageSize = 25) {
|
|
328
|
+
const [calls, setCalls] = useState([]);
|
|
329
|
+
const [cursor, setCursor] = useState(null);
|
|
330
|
+
const [hasMore, setHasMore] = useState(false);
|
|
331
|
+
const [loading, setLoading] = useState(true);
|
|
332
|
+
const [statusFilter, setStatusFilter] = useState(null);
|
|
333
|
+
const fetchPage = useCallback(async (after) => {
|
|
334
|
+
const result = await getFluidGridsClient().query({
|
|
335
|
+
query: CALLS,
|
|
336
|
+
variables: {
|
|
337
|
+
first: pageSize,
|
|
338
|
+
after,
|
|
339
|
+
filter: statusFilter ? { status: statusFilter } : null
|
|
340
|
+
},
|
|
341
|
+
fetchPolicy: "network-only"
|
|
342
|
+
});
|
|
343
|
+
throwIfResultError(result);
|
|
344
|
+
return result.data?.mcpToolCalls ?? {
|
|
345
|
+
items: [],
|
|
346
|
+
nextCursor: null,
|
|
347
|
+
hasMore: false
|
|
348
|
+
};
|
|
349
|
+
}, [pageSize, statusFilter]);
|
|
350
|
+
const reload = useCallback(async () => {
|
|
351
|
+
setLoading(true);
|
|
352
|
+
try {
|
|
353
|
+
const page = await fetchPage(null);
|
|
354
|
+
setCalls(page.items);
|
|
355
|
+
setCursor(page.nextCursor);
|
|
356
|
+
setHasMore(page.hasMore);
|
|
357
|
+
} finally {
|
|
358
|
+
setLoading(false);
|
|
359
|
+
}
|
|
360
|
+
}, [fetchPage]);
|
|
361
|
+
const loadMore = useCallback(async () => {
|
|
362
|
+
if (!cursor) return;
|
|
363
|
+
const page = await fetchPage(cursor);
|
|
364
|
+
setCalls((current) => [...current, ...page.items]);
|
|
365
|
+
setCursor(page.nextCursor);
|
|
366
|
+
setHasMore(page.hasMore);
|
|
367
|
+
}, [cursor, fetchPage]);
|
|
368
|
+
useEffect(() => {
|
|
369
|
+
reload().catch(() => void 0);
|
|
370
|
+
}, [reload]);
|
|
371
|
+
return {
|
|
372
|
+
calls,
|
|
373
|
+
hasMore,
|
|
374
|
+
loading,
|
|
375
|
+
statusFilter,
|
|
376
|
+
setStatusFilter,
|
|
377
|
+
reload,
|
|
378
|
+
loadMore,
|
|
379
|
+
decide: useCallback(async (id, approve) => {
|
|
380
|
+
const result = await getFluidGridsClient().mutate({
|
|
381
|
+
mutation: DECIDE,
|
|
382
|
+
variables: {
|
|
383
|
+
id,
|
|
384
|
+
approve
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
throwIfResultError(result);
|
|
388
|
+
await reload();
|
|
389
|
+
}, [reload])
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** MCP tokens: global-auth apps and API keys with `mcp:` scopes. */
|
|
393
|
+
function useMcpTokens() {
|
|
394
|
+
const [keys, setKeys] = useState([]);
|
|
395
|
+
const [available, setAvailable] = useState(true);
|
|
396
|
+
const [loading, setLoading] = useState(true);
|
|
397
|
+
const reload = useCallback(async () => {
|
|
398
|
+
const client = getGlobalStoreClient();
|
|
399
|
+
if (!client) {
|
|
400
|
+
setAvailable(false);
|
|
401
|
+
setLoading(false);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
setLoading(true);
|
|
405
|
+
try {
|
|
406
|
+
const result = await client.query({
|
|
407
|
+
query: MY_API_KEYS,
|
|
408
|
+
variables: { pagination: {
|
|
409
|
+
limit: 100,
|
|
410
|
+
offset: 0
|
|
411
|
+
} },
|
|
412
|
+
fetchPolicy: "network-only"
|
|
413
|
+
});
|
|
414
|
+
throwIfResultError(result);
|
|
415
|
+
setKeys((result.data?.myApiKeys.apiKeys ?? []).filter(isMcpKey));
|
|
416
|
+
} finally {
|
|
417
|
+
setLoading(false);
|
|
418
|
+
}
|
|
419
|
+
}, []);
|
|
420
|
+
useEffect(() => {
|
|
421
|
+
reload().catch(() => void 0);
|
|
422
|
+
}, [reload]);
|
|
423
|
+
return {
|
|
424
|
+
keys,
|
|
425
|
+
available,
|
|
426
|
+
loading,
|
|
427
|
+
reload,
|
|
428
|
+
create: useCallback(async (input) => {
|
|
429
|
+
const client = globalClient();
|
|
430
|
+
const { workspaceId, tenantId } = getFluidGridsConfig();
|
|
431
|
+
if (!workspaceId || !tenantId) throw new McpFormError("The workspace context is not ready yet. Try again shortly.");
|
|
432
|
+
const app = await client.mutate({
|
|
433
|
+
mutation: CREATE_APP,
|
|
434
|
+
variables: { input: {
|
|
435
|
+
name: `MCP: ${input.name}`.slice(0, 120),
|
|
436
|
+
description: "MCP client created in FluidGrids Settings → MCP",
|
|
437
|
+
type: "API_INTEGRATION",
|
|
438
|
+
scopes: input.scopes
|
|
439
|
+
} }
|
|
440
|
+
});
|
|
441
|
+
throwIfResultError(app);
|
|
442
|
+
const appId = app.data?.createApp.app.id;
|
|
443
|
+
if (!appId) throw new McpFormError("The MCP client could not be created.");
|
|
444
|
+
throwIfResultError(await client.mutate({
|
|
445
|
+
mutation: GRANT_WORKSPACE,
|
|
446
|
+
variables: { input: {
|
|
447
|
+
appId,
|
|
448
|
+
workspaceId,
|
|
449
|
+
tenantId
|
|
450
|
+
} }
|
|
451
|
+
}));
|
|
452
|
+
const key = await client.mutate({
|
|
453
|
+
mutation: GENERATE_KEY,
|
|
454
|
+
variables: { input: {
|
|
455
|
+
appId,
|
|
456
|
+
name: input.name,
|
|
457
|
+
scope: input.scopes,
|
|
458
|
+
expiresAt: input.expiresAt
|
|
459
|
+
} }
|
|
460
|
+
});
|
|
461
|
+
throwIfResultError(key);
|
|
462
|
+
if (!key.data?.generateAPIKey) throw new McpFormError("The API key could not be created.");
|
|
463
|
+
await reload();
|
|
464
|
+
return key.data.generateAPIKey;
|
|
465
|
+
}, [reload]),
|
|
466
|
+
revoke: useCallback(async (keyId) => {
|
|
467
|
+
throwIfResultError(await globalClient().mutate({
|
|
468
|
+
mutation: REVOKE_KEY,
|
|
469
|
+
variables: { keyId }
|
|
470
|
+
}));
|
|
471
|
+
await reload();
|
|
472
|
+
}, [reload])
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* MCP Server Triggers (BOFF-12237) of the workspace, or of one workflow, active first, plus the
|
|
477
|
+
* workspace endpoint path (a trigger that is not activated yet is shown at the path it will get).
|
|
478
|
+
* `refreshKey` re-reads when it changes (for example the workflow's status after an activation).
|
|
479
|
+
*/
|
|
480
|
+
function useMcpTriggerServers(workflowKey, options = {}) {
|
|
481
|
+
const { skip = false, refreshKey } = options;
|
|
482
|
+
const [servers, setServers] = useState([]);
|
|
483
|
+
const [endpointPath, setEndpointPath] = useState(null);
|
|
484
|
+
const [loading, setLoading] = useState(!skip);
|
|
485
|
+
const [error, setError] = useState(null);
|
|
486
|
+
const reload = useCallback(async () => {
|
|
487
|
+
if (skip) return;
|
|
488
|
+
setLoading(true);
|
|
489
|
+
try {
|
|
490
|
+
const result = await getFluidGridsClient().query({
|
|
491
|
+
query: TRIGGER_SERVERS,
|
|
492
|
+
variables: { workflowKey: workflowKey || null },
|
|
493
|
+
fetchPolicy: "network-only"
|
|
494
|
+
});
|
|
495
|
+
throwIfResultError(result);
|
|
496
|
+
setServers(sortServers(result.data?.mcpTriggerServers ?? []));
|
|
497
|
+
setEndpointPath(result.data?.mcpEndpoint?.path ?? null);
|
|
498
|
+
setError(null);
|
|
499
|
+
} catch (err) {
|
|
500
|
+
setError(err);
|
|
501
|
+
} finally {
|
|
502
|
+
setLoading(false);
|
|
503
|
+
}
|
|
504
|
+
}, [skip, workflowKey]);
|
|
505
|
+
useEffect(() => {
|
|
506
|
+
reload();
|
|
507
|
+
}, [reload, refreshKey]);
|
|
508
|
+
useEffect(() => {
|
|
509
|
+
if (skip || !workflowKey) return void 0;
|
|
510
|
+
return subscribeWorkflowSaved(workflowKey, () => void reload());
|
|
511
|
+
}, [
|
|
512
|
+
skip,
|
|
513
|
+
workflowKey,
|
|
514
|
+
reload
|
|
515
|
+
]);
|
|
516
|
+
return {
|
|
517
|
+
servers,
|
|
518
|
+
endpointPath,
|
|
519
|
+
loading,
|
|
520
|
+
error,
|
|
521
|
+
reload
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/builder/stores/save-status-store.ts
|
|
526
|
+
/**
|
|
527
|
+
* Save state of the open workflow, shared by everything in the editor that
|
|
528
|
+
* saves or shows whether the work is saved (BOFF-9724): the header Save
|
|
529
|
+
* button, the canvas toolbar, the property panel, Ctrl/Cmd+S and autosave.
|
|
530
|
+
*
|
|
531
|
+
* Before this each of them kept its own `isSaving`, so one could start a save
|
|
532
|
+
* while another was still running and none could tell the person whether
|
|
533
|
+
* their last edit had reached the server.
|
|
534
|
+
*/
|
|
535
|
+
function browserStorage() {
|
|
536
|
+
try {
|
|
537
|
+
return typeof window === "undefined" ? void 0 : window.localStorage;
|
|
538
|
+
} catch {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
const PRISTINE = {
|
|
543
|
+
saving: false,
|
|
544
|
+
dirty: false,
|
|
545
|
+
incomplete: false,
|
|
546
|
+
failure: null,
|
|
547
|
+
lastSavedAt: null,
|
|
548
|
+
baseline: null,
|
|
549
|
+
quotaRefusal: null,
|
|
550
|
+
leaveRequest: null,
|
|
551
|
+
autosavePaused: false,
|
|
552
|
+
conflictOpen: false
|
|
553
|
+
};
|
|
554
|
+
const useSaveStatusStore = create()((set) => ({
|
|
555
|
+
...PRISTINE,
|
|
556
|
+
autosaveEnabled: readAutosavePreference(browserStorage()),
|
|
557
|
+
actions: {
|
|
558
|
+
setBaseline: (baseline) => set((state) => ({
|
|
559
|
+
baseline,
|
|
560
|
+
dirty: false,
|
|
561
|
+
incomplete: false,
|
|
562
|
+
failure: null,
|
|
563
|
+
...state.baseline?.generation === baseline.generation ? {} : { quotaRefusal: null }
|
|
564
|
+
})),
|
|
565
|
+
setDirty: (dirty) => set({ dirty }),
|
|
566
|
+
setIncomplete: (incomplete) => set({ incomplete }),
|
|
567
|
+
beginSave: () => set({ saving: true }),
|
|
568
|
+
saveSucceeded: (baseline, at = Date.now()) => set(baseline ? {
|
|
569
|
+
saving: false,
|
|
570
|
+
baseline,
|
|
571
|
+
failure: null,
|
|
572
|
+
incomplete: false,
|
|
573
|
+
autosavePaused: false,
|
|
574
|
+
conflictOpen: false,
|
|
575
|
+
quotaRefusal: null,
|
|
576
|
+
lastSavedAt: at
|
|
577
|
+
} : { saving: false }),
|
|
578
|
+
saveFailed: (failure) => set({
|
|
579
|
+
saving: false,
|
|
580
|
+
failure,
|
|
581
|
+
conflictOpen: failure.conflict?.reason === "STALE_REVISION",
|
|
582
|
+
quotaRefusal: failure.quota ?? null
|
|
583
|
+
}),
|
|
584
|
+
clearFailure: () => set({ failure: null }),
|
|
585
|
+
setQuotaRefusal: (quotaRefusal) => set({ quotaRefusal }),
|
|
586
|
+
setAutosaveEnabled: (autosaveEnabled) => {
|
|
587
|
+
writeAutosavePreference(browserStorage(), autosaveEnabled);
|
|
588
|
+
set({ autosaveEnabled });
|
|
589
|
+
},
|
|
590
|
+
requestLeave: (leaveRequest) => set({ leaveRequest }),
|
|
591
|
+
setAutosavePaused: (autosavePaused) => set({ autosavePaused }),
|
|
592
|
+
setConflictOpen: (conflictOpen) => set({ conflictOpen }),
|
|
593
|
+
reset: () => set({ ...PRISTINE })
|
|
594
|
+
}
|
|
595
|
+
}));
|
|
596
|
+
if (typeof window !== "undefined") window.addEventListener("storage", (event) => {
|
|
597
|
+
if (event.key !== "fluidgrids.builder.autosaveDrafts") return;
|
|
598
|
+
useSaveStatusStore.setState({ autosaveEnabled: readAutosavePreference(browserStorage()) });
|
|
599
|
+
});
|
|
600
|
+
/**
|
|
601
|
+
* Report a finished save to the save state. That state belongs to the
|
|
602
|
+
* workflow open in the editor: a save of a workflow the editor has left
|
|
603
|
+
* (`open: false`) only clears the saving flag, so its failure, or its quota
|
|
604
|
+
* refusal and plan dialog, never shows as the next workflow's. Whoever
|
|
605
|
+
* started such a save tells the person how it went (the departing save's
|
|
606
|
+
* toast).
|
|
607
|
+
*/
|
|
608
|
+
function recordSaveOutcome(outcome, context) {
|
|
609
|
+
const { actions } = useSaveStatusStore.getState();
|
|
610
|
+
if (!context.open) {
|
|
611
|
+
actions.saveSucceeded(null);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (outcome.saved) {
|
|
615
|
+
actions.saveSucceeded(context.baseline);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
actions.saveFailed(outcome.failure);
|
|
619
|
+
}
|
|
620
|
+
/** The one save queue of the editor: saves never overlap. */
|
|
621
|
+
const workflowSaveQueue = createSaveQueue();
|
|
622
|
+
/** What the header says about the open workflow's save state. */
|
|
623
|
+
function saveIndicatorOf(state) {
|
|
624
|
+
if (state.saving) return "saving";
|
|
625
|
+
if (state.failure) return "failed";
|
|
626
|
+
if (state.dirty) return "unsaved";
|
|
627
|
+
if (state.lastSavedAt !== null) return "saved";
|
|
628
|
+
return "none";
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export { mcpPublicUrl as a, useMcpToolCalls as c, subscribeWorkflowSaved as d, loadMarkdown as f, workflowSaveQueue as i, useMcpTriggerServers as l, saveIndicatorOf as n, useMcpGateway as o, useMarkdownRenderer as p, useSaveStatusStore as r, useMcpTokens as s, recordSaveOutcome as t, notifyWorkflowSaved as u };
|