@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,1137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
|
|
3
|
+
import { d as useAiWorkflowTemplates } from "./flow-builder-DIvLOhz0.js";
|
|
4
|
+
import { a as buildRefinementPrompt, c as phaseOf, i as buildAnsweredPrompt, l as StewardBuilderPanel, n as AI_STUDIO_EXAMPLES, o as draftCreateInput, r as AI_STUDIO_REFINEMENTS, s as draftSteps, t as StewardRunImportPanel, u as DraftCanvas } from "./StewardRunImportPanel-Kva2DO0u.js";
|
|
5
|
+
import { l as useBotmanorStewardsEnabled } from "./feature-flags-B2qetXKd.js";
|
|
6
|
+
import { n as getFluidGridsClient } from "./client-holder-C0M5Cfwl.js";
|
|
7
|
+
import { s as throwIfResultError } from "./errors-ClKb5sEt.js";
|
|
8
|
+
import { a as notifyFluidGridsAiCreditsUpdated, t as AiCreditBalanceSlot } from "./aiCreditsBridge-BuE92tKo.js";
|
|
9
|
+
import { r as useCreateWorkflow } from "./useWorkflows-Cvg-Z_IE.js";
|
|
10
|
+
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
11
|
+
import { n as BILLING_PLANS_PATH } from "./quota-DeA_CJ2e.js";
|
|
12
|
+
import { i as CreateWorkflowRefusalDialog } from "./useWorkflowCodeExport-pqxyLHD1.js";
|
|
13
|
+
import { n as builderPathOf, r as classifyCreateRefusal } from "./create-workflow-first-Azg3JUdX.js";
|
|
14
|
+
import { i as AI_DRAFT_MAX_PROMPT_LENGTH } from "./use-browser-available-hj8wc3Kb.js";
|
|
15
|
+
import { s as useFluidGridsPermission, t as FLUIDGRIDS_PERMISSIONS } from "./constants-DlRnHBfQ.js";
|
|
16
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
|
+
import { useNavigate } from "react-router";
|
|
18
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { CheckCircle2, Lightbulb, MessageCircleQuestion, Pencil, RefreshCw, Sparkles, Square, TriangleAlert } from "lucide-react";
|
|
20
|
+
import { toast } from "sonner";
|
|
21
|
+
import { Badge, Button, Card, CardContent, CardHeader, EmptyState, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SpinnerIcon, Tabs, TabsList, TabsTrigger, Textarea } from "@burdenoff/fe-libs/ui";
|
|
22
|
+
import { v4 } from "uuid";
|
|
23
|
+
|
|
24
|
+
// src/generated/documents/wspace/CancelWorkflowGenerationDocument.ts
|
|
25
|
+
const CancelWorkflowGenerationDocument = {
|
|
26
|
+
"kind": "Document",
|
|
27
|
+
"definitions": [{
|
|
28
|
+
"kind": "OperationDefinition",
|
|
29
|
+
"operation": "mutation",
|
|
30
|
+
"name": {
|
|
31
|
+
"kind": "Name",
|
|
32
|
+
"value": "CancelWorkflowGeneration"
|
|
33
|
+
},
|
|
34
|
+
"variableDefinitions": [{
|
|
35
|
+
"kind": "VariableDefinition",
|
|
36
|
+
"variable": {
|
|
37
|
+
"kind": "Variable",
|
|
38
|
+
"name": {
|
|
39
|
+
"kind": "Name",
|
|
40
|
+
"value": "id"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"type": {
|
|
44
|
+
"kind": "NonNullType",
|
|
45
|
+
"type": {
|
|
46
|
+
"kind": "NamedType",
|
|
47
|
+
"name": {
|
|
48
|
+
"kind": "Name",
|
|
49
|
+
"value": "ID"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"directives": []
|
|
54
|
+
}],
|
|
55
|
+
"directives": [],
|
|
56
|
+
"selectionSet": {
|
|
57
|
+
"kind": "SelectionSet",
|
|
58
|
+
"selections": [{
|
|
59
|
+
"kind": "Field",
|
|
60
|
+
"name": {
|
|
61
|
+
"kind": "Name",
|
|
62
|
+
"value": "cancelWorkflowGeneration"
|
|
63
|
+
},
|
|
64
|
+
"arguments": [{
|
|
65
|
+
"kind": "Argument",
|
|
66
|
+
"name": {
|
|
67
|
+
"kind": "Name",
|
|
68
|
+
"value": "id"
|
|
69
|
+
},
|
|
70
|
+
"value": {
|
|
71
|
+
"kind": "Variable",
|
|
72
|
+
"name": {
|
|
73
|
+
"kind": "Name",
|
|
74
|
+
"value": "id"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}],
|
|
78
|
+
"directives": [],
|
|
79
|
+
"selectionSet": {
|
|
80
|
+
"kind": "SelectionSet",
|
|
81
|
+
"selections": [
|
|
82
|
+
{
|
|
83
|
+
"kind": "Field",
|
|
84
|
+
"name": {
|
|
85
|
+
"kind": "Name",
|
|
86
|
+
"value": "id"
|
|
87
|
+
},
|
|
88
|
+
"arguments": [],
|
|
89
|
+
"directives": []
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "Field",
|
|
93
|
+
"name": {
|
|
94
|
+
"kind": "Name",
|
|
95
|
+
"value": "status"
|
|
96
|
+
},
|
|
97
|
+
"arguments": [],
|
|
98
|
+
"directives": []
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"kind": "Field",
|
|
102
|
+
"name": {
|
|
103
|
+
"kind": "Name",
|
|
104
|
+
"value": "message"
|
|
105
|
+
},
|
|
106
|
+
"arguments": [],
|
|
107
|
+
"directives": []
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}]
|
|
112
|
+
}
|
|
113
|
+
}]
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/generated/documents/wspace/GenerateWorkflowFromPromptDocument.ts
|
|
117
|
+
const GenerateWorkflowFromPromptDocument = {
|
|
118
|
+
"kind": "Document",
|
|
119
|
+
"definitions": [{
|
|
120
|
+
"kind": "OperationDefinition",
|
|
121
|
+
"operation": "mutation",
|
|
122
|
+
"name": {
|
|
123
|
+
"kind": "Name",
|
|
124
|
+
"value": "GenerateWorkflowFromPrompt"
|
|
125
|
+
},
|
|
126
|
+
"variableDefinitions": [{
|
|
127
|
+
"kind": "VariableDefinition",
|
|
128
|
+
"variable": {
|
|
129
|
+
"kind": "Variable",
|
|
130
|
+
"name": {
|
|
131
|
+
"kind": "Name",
|
|
132
|
+
"value": "input"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"type": {
|
|
136
|
+
"kind": "NonNullType",
|
|
137
|
+
"type": {
|
|
138
|
+
"kind": "NamedType",
|
|
139
|
+
"name": {
|
|
140
|
+
"kind": "Name",
|
|
141
|
+
"value": "GenerateWorkflowFromPromptInput"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"directives": []
|
|
146
|
+
}],
|
|
147
|
+
"directives": [],
|
|
148
|
+
"selectionSet": {
|
|
149
|
+
"kind": "SelectionSet",
|
|
150
|
+
"selections": [{
|
|
151
|
+
"kind": "Field",
|
|
152
|
+
"name": {
|
|
153
|
+
"kind": "Name",
|
|
154
|
+
"value": "generateWorkflowFromPrompt"
|
|
155
|
+
},
|
|
156
|
+
"arguments": [{
|
|
157
|
+
"kind": "Argument",
|
|
158
|
+
"name": {
|
|
159
|
+
"kind": "Name",
|
|
160
|
+
"value": "input"
|
|
161
|
+
},
|
|
162
|
+
"value": {
|
|
163
|
+
"kind": "Variable",
|
|
164
|
+
"name": {
|
|
165
|
+
"kind": "Name",
|
|
166
|
+
"value": "input"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}],
|
|
170
|
+
"directives": [],
|
|
171
|
+
"selectionSet": {
|
|
172
|
+
"kind": "SelectionSet",
|
|
173
|
+
"selections": [
|
|
174
|
+
{
|
|
175
|
+
"kind": "Field",
|
|
176
|
+
"name": {
|
|
177
|
+
"kind": "Name",
|
|
178
|
+
"value": "id"
|
|
179
|
+
},
|
|
180
|
+
"arguments": [],
|
|
181
|
+
"directives": []
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"kind": "Field",
|
|
185
|
+
"name": {
|
|
186
|
+
"kind": "Name",
|
|
187
|
+
"value": "status"
|
|
188
|
+
},
|
|
189
|
+
"arguments": [],
|
|
190
|
+
"directives": []
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"kind": "Field",
|
|
194
|
+
"name": {
|
|
195
|
+
"kind": "Name",
|
|
196
|
+
"value": "message"
|
|
197
|
+
},
|
|
198
|
+
"arguments": [],
|
|
199
|
+
"directives": []
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"kind": "Field",
|
|
203
|
+
"name": {
|
|
204
|
+
"kind": "Name",
|
|
205
|
+
"value": "createdAt"
|
|
206
|
+
},
|
|
207
|
+
"arguments": [],
|
|
208
|
+
"directives": []
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
}]
|
|
213
|
+
}
|
|
214
|
+
}]
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// src/generated/documents/wspace/WorkflowGenerationDocument.ts
|
|
218
|
+
const WorkflowGenerationDocument = {
|
|
219
|
+
"kind": "Document",
|
|
220
|
+
"definitions": [{
|
|
221
|
+
"kind": "OperationDefinition",
|
|
222
|
+
"operation": "query",
|
|
223
|
+
"name": {
|
|
224
|
+
"kind": "Name",
|
|
225
|
+
"value": "WorkflowGeneration"
|
|
226
|
+
},
|
|
227
|
+
"variableDefinitions": [{
|
|
228
|
+
"kind": "VariableDefinition",
|
|
229
|
+
"variable": {
|
|
230
|
+
"kind": "Variable",
|
|
231
|
+
"name": {
|
|
232
|
+
"kind": "Name",
|
|
233
|
+
"value": "id"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"type": {
|
|
237
|
+
"kind": "NonNullType",
|
|
238
|
+
"type": {
|
|
239
|
+
"kind": "NamedType",
|
|
240
|
+
"name": {
|
|
241
|
+
"kind": "Name",
|
|
242
|
+
"value": "ID"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"directives": []
|
|
247
|
+
}],
|
|
248
|
+
"directives": [],
|
|
249
|
+
"selectionSet": {
|
|
250
|
+
"kind": "SelectionSet",
|
|
251
|
+
"selections": [{
|
|
252
|
+
"kind": "Field",
|
|
253
|
+
"name": {
|
|
254
|
+
"kind": "Name",
|
|
255
|
+
"value": "workflowGeneration"
|
|
256
|
+
},
|
|
257
|
+
"arguments": [{
|
|
258
|
+
"kind": "Argument",
|
|
259
|
+
"name": {
|
|
260
|
+
"kind": "Name",
|
|
261
|
+
"value": "id"
|
|
262
|
+
},
|
|
263
|
+
"value": {
|
|
264
|
+
"kind": "Variable",
|
|
265
|
+
"name": {
|
|
266
|
+
"kind": "Name",
|
|
267
|
+
"value": "id"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}],
|
|
271
|
+
"directives": [],
|
|
272
|
+
"selectionSet": {
|
|
273
|
+
"kind": "SelectionSet",
|
|
274
|
+
"selections": [
|
|
275
|
+
{
|
|
276
|
+
"kind": "Field",
|
|
277
|
+
"name": {
|
|
278
|
+
"kind": "Name",
|
|
279
|
+
"value": "id"
|
|
280
|
+
},
|
|
281
|
+
"arguments": [],
|
|
282
|
+
"directives": []
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"kind": "Field",
|
|
286
|
+
"name": {
|
|
287
|
+
"kind": "Name",
|
|
288
|
+
"value": "prompt"
|
|
289
|
+
},
|
|
290
|
+
"arguments": [],
|
|
291
|
+
"directives": []
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"kind": "Field",
|
|
295
|
+
"name": {
|
|
296
|
+
"kind": "Name",
|
|
297
|
+
"value": "status"
|
|
298
|
+
},
|
|
299
|
+
"arguments": [],
|
|
300
|
+
"directives": []
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"kind": "Field",
|
|
304
|
+
"name": {
|
|
305
|
+
"kind": "Name",
|
|
306
|
+
"value": "message"
|
|
307
|
+
},
|
|
308
|
+
"arguments": [],
|
|
309
|
+
"directives": []
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"kind": "Field",
|
|
313
|
+
"name": {
|
|
314
|
+
"kind": "Name",
|
|
315
|
+
"value": "modelUsed"
|
|
316
|
+
},
|
|
317
|
+
"arguments": [],
|
|
318
|
+
"directives": []
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"kind": "Field",
|
|
322
|
+
"name": {
|
|
323
|
+
"kind": "Name",
|
|
324
|
+
"value": "template"
|
|
325
|
+
},
|
|
326
|
+
"arguments": [],
|
|
327
|
+
"directives": []
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"kind": "Field",
|
|
331
|
+
"name": {
|
|
332
|
+
"kind": "Name",
|
|
333
|
+
"value": "attempts"
|
|
334
|
+
},
|
|
335
|
+
"arguments": [],
|
|
336
|
+
"directives": []
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"kind": "Field",
|
|
340
|
+
"name": {
|
|
341
|
+
"kind": "Name",
|
|
342
|
+
"value": "draft"
|
|
343
|
+
},
|
|
344
|
+
"arguments": [],
|
|
345
|
+
"directives": [],
|
|
346
|
+
"selectionSet": {
|
|
347
|
+
"kind": "SelectionSet",
|
|
348
|
+
"selections": [
|
|
349
|
+
{
|
|
350
|
+
"kind": "Field",
|
|
351
|
+
"name": {
|
|
352
|
+
"kind": "Name",
|
|
353
|
+
"value": "name"
|
|
354
|
+
},
|
|
355
|
+
"arguments": [],
|
|
356
|
+
"directives": []
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"kind": "Field",
|
|
360
|
+
"name": {
|
|
361
|
+
"kind": "Name",
|
|
362
|
+
"value": "description"
|
|
363
|
+
},
|
|
364
|
+
"arguments": [],
|
|
365
|
+
"directives": []
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"kind": "Field",
|
|
369
|
+
"name": {
|
|
370
|
+
"kind": "Name",
|
|
371
|
+
"value": "explanation"
|
|
372
|
+
},
|
|
373
|
+
"arguments": [],
|
|
374
|
+
"directives": []
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"kind": "Field",
|
|
378
|
+
"name": {
|
|
379
|
+
"kind": "Name",
|
|
380
|
+
"value": "questions"
|
|
381
|
+
},
|
|
382
|
+
"arguments": [],
|
|
383
|
+
"directives": []
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"kind": "Field",
|
|
387
|
+
"name": {
|
|
388
|
+
"kind": "Name",
|
|
389
|
+
"value": "definitionJson"
|
|
390
|
+
},
|
|
391
|
+
"arguments": [],
|
|
392
|
+
"directives": []
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"kind": "Field",
|
|
396
|
+
"name": {
|
|
397
|
+
"kind": "Name",
|
|
398
|
+
"value": "nodeCount"
|
|
399
|
+
},
|
|
400
|
+
"arguments": [],
|
|
401
|
+
"directives": []
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"kind": "Field",
|
|
405
|
+
"name": {
|
|
406
|
+
"kind": "Name",
|
|
407
|
+
"value": "edgeCount"
|
|
408
|
+
},
|
|
409
|
+
"arguments": [],
|
|
410
|
+
"directives": []
|
|
411
|
+
}
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"kind": "Field",
|
|
417
|
+
"name": {
|
|
418
|
+
"kind": "Name",
|
|
419
|
+
"value": "validation"
|
|
420
|
+
},
|
|
421
|
+
"arguments": [],
|
|
422
|
+
"directives": [],
|
|
423
|
+
"selectionSet": {
|
|
424
|
+
"kind": "SelectionSet",
|
|
425
|
+
"selections": [
|
|
426
|
+
{
|
|
427
|
+
"kind": "Field",
|
|
428
|
+
"name": {
|
|
429
|
+
"kind": "Name",
|
|
430
|
+
"value": "valid"
|
|
431
|
+
},
|
|
432
|
+
"arguments": [],
|
|
433
|
+
"directives": []
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"kind": "Field",
|
|
437
|
+
"name": {
|
|
438
|
+
"kind": "Name",
|
|
439
|
+
"value": "errors"
|
|
440
|
+
},
|
|
441
|
+
"arguments": [],
|
|
442
|
+
"directives": []
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"kind": "Field",
|
|
446
|
+
"name": {
|
|
447
|
+
"kind": "Name",
|
|
448
|
+
"value": "warnings"
|
|
449
|
+
},
|
|
450
|
+
"arguments": [],
|
|
451
|
+
"directives": []
|
|
452
|
+
}
|
|
453
|
+
]
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"kind": "Field",
|
|
458
|
+
"name": {
|
|
459
|
+
"kind": "Name",
|
|
460
|
+
"value": "createdAt"
|
|
461
|
+
},
|
|
462
|
+
"arguments": [],
|
|
463
|
+
"directives": []
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"kind": "Field",
|
|
467
|
+
"name": {
|
|
468
|
+
"kind": "Name",
|
|
469
|
+
"value": "updatedAt"
|
|
470
|
+
},
|
|
471
|
+
"arguments": [],
|
|
472
|
+
"directives": []
|
|
473
|
+
}
|
|
474
|
+
]
|
|
475
|
+
}
|
|
476
|
+
}]
|
|
477
|
+
}
|
|
478
|
+
}]
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// src/hooks/useWorkflowGeneration.ts
|
|
482
|
+
/**
|
|
483
|
+
* useWorkflowGeneration — drives one natural-language workflow generation for
|
|
484
|
+
* AI Studio (BOFF-4089): start it with `generateWorkflowFromPrompt`, poll
|
|
485
|
+
* `workflowGeneration(id)` while it is PROCESSING, and cancel it.
|
|
486
|
+
*
|
|
487
|
+
* A generation never saves anything. Its draft is shown for review and saved
|
|
488
|
+
* as a new DRAFT workflow only when the user chooses "Edit in builder".
|
|
489
|
+
*/
|
|
490
|
+
/** How often a PROCESSING generation is polled. */
|
|
491
|
+
const GENERATION_POLL_INTERVAL_MS = 3e3;
|
|
492
|
+
/** Stop polling after this long; the server closes a stuck generation after 20 minutes. */
|
|
493
|
+
const GENERATION_MAX_WAIT_MS = 36e4;
|
|
494
|
+
function messageOf(error) {
|
|
495
|
+
return error instanceof Error ? error.message : String(error);
|
|
496
|
+
}
|
|
497
|
+
function useWorkflowGeneration() {
|
|
498
|
+
const [generation, setGeneration] = useState(null);
|
|
499
|
+
const [isWorking, setIsWorking] = useState(false);
|
|
500
|
+
const [error, setError] = useState(null);
|
|
501
|
+
const [timedOut, setTimedOut] = useState(false);
|
|
502
|
+
const runRef = useRef(0);
|
|
503
|
+
const timerRef = useRef(null);
|
|
504
|
+
const idRef = useRef(null);
|
|
505
|
+
const clearTimer = useCallback(() => {
|
|
506
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
507
|
+
timerRef.current = null;
|
|
508
|
+
}, []);
|
|
509
|
+
useEffect(() => () => {
|
|
510
|
+
runRef.current++;
|
|
511
|
+
clearTimer();
|
|
512
|
+
}, [clearTimer]);
|
|
513
|
+
const reset = useCallback(() => {
|
|
514
|
+
runRef.current++;
|
|
515
|
+
clearTimer();
|
|
516
|
+
idRef.current = null;
|
|
517
|
+
setGeneration(null);
|
|
518
|
+
setIsWorking(false);
|
|
519
|
+
setError(null);
|
|
520
|
+
setTimedOut(false);
|
|
521
|
+
}, [clearTimer]);
|
|
522
|
+
const poll = useCallback(async (run, id, startedAt) => {
|
|
523
|
+
if (run !== runRef.current) return;
|
|
524
|
+
try {
|
|
525
|
+
const result = throwIfResultError(await getFluidGridsClient().query({
|
|
526
|
+
query: WorkflowGenerationDocument,
|
|
527
|
+
variables: { id },
|
|
528
|
+
fetchPolicy: "network-only"
|
|
529
|
+
}));
|
|
530
|
+
if (run !== runRef.current) return;
|
|
531
|
+
const next = result.data?.workflowGeneration ?? null;
|
|
532
|
+
if (next) setGeneration(next);
|
|
533
|
+
if (next && String(next.status) === "PROCESSING") {
|
|
534
|
+
if (Date.now() - startedAt < 36e4) {
|
|
535
|
+
timerRef.current = setTimeout(() => void poll(run, id, startedAt), GENERATION_POLL_INTERVAL_MS);
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
setTimedOut(true);
|
|
539
|
+
} else notifyFluidGridsAiCreditsUpdated();
|
|
540
|
+
setIsWorking(false);
|
|
541
|
+
} catch (pollError) {
|
|
542
|
+
if (run !== runRef.current) return;
|
|
543
|
+
setError(messageOf(pollError));
|
|
544
|
+
setIsWorking(false);
|
|
545
|
+
}
|
|
546
|
+
}, []);
|
|
547
|
+
return {
|
|
548
|
+
generation,
|
|
549
|
+
isWorking,
|
|
550
|
+
error,
|
|
551
|
+
timedOut,
|
|
552
|
+
start: useCallback(async (input) => {
|
|
553
|
+
const run = ++runRef.current;
|
|
554
|
+
clearTimer();
|
|
555
|
+
setGeneration(null);
|
|
556
|
+
setError(null);
|
|
557
|
+
setTimedOut(false);
|
|
558
|
+
setIsWorking(true);
|
|
559
|
+
try {
|
|
560
|
+
const result = throwIfResultError(await getFluidGridsClient().mutate({
|
|
561
|
+
mutation: GenerateWorkflowFromPromptDocument,
|
|
562
|
+
variables: { input: {
|
|
563
|
+
prompt: input.prompt,
|
|
564
|
+
...input.template ? { template: input.template } : {},
|
|
565
|
+
...input.baseDefinitionJson ? { baseDefinitionJson: input.baseDefinitionJson } : {}
|
|
566
|
+
} }
|
|
567
|
+
}));
|
|
568
|
+
if (run !== runRef.current) return;
|
|
569
|
+
const id = result.data?.generateWorkflowFromPrompt.id;
|
|
570
|
+
if (!id) throw new Error("The generation did not start");
|
|
571
|
+
idRef.current = id;
|
|
572
|
+
await poll(run, id, Date.now());
|
|
573
|
+
} catch (startError) {
|
|
574
|
+
if (run !== runRef.current) return;
|
|
575
|
+
setError(messageOf(startError));
|
|
576
|
+
setIsWorking(false);
|
|
577
|
+
}
|
|
578
|
+
}, [clearTimer, poll]),
|
|
579
|
+
cancel: useCallback(async () => {
|
|
580
|
+
const id = idRef.current;
|
|
581
|
+
const run = ++runRef.current;
|
|
582
|
+
clearTimer();
|
|
583
|
+
if (!id) {
|
|
584
|
+
setIsWorking(false);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
try {
|
|
588
|
+
const result = throwIfResultError(await getFluidGridsClient().mutate({
|
|
589
|
+
mutation: CancelWorkflowGenerationDocument,
|
|
590
|
+
variables: { id }
|
|
591
|
+
}));
|
|
592
|
+
if (run !== runRef.current) return;
|
|
593
|
+
const cancelled = result.data?.cancelWorkflowGeneration;
|
|
594
|
+
if (cancelled) setGeneration((current) => current ? {
|
|
595
|
+
...current,
|
|
596
|
+
status: cancelled.status,
|
|
597
|
+
message: cancelled.message
|
|
598
|
+
} : current);
|
|
599
|
+
} catch (cancelError) {
|
|
600
|
+
if (run !== runRef.current) return;
|
|
601
|
+
setError(messageOf(cancelError));
|
|
602
|
+
} finally {
|
|
603
|
+
if (run === runRef.current) setIsWorking(false);
|
|
604
|
+
}
|
|
605
|
+
}, [clearTimer]),
|
|
606
|
+
reset
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/modules/ai-studio/pages/AiStudioPage.tsx
|
|
611
|
+
/**
|
|
612
|
+
* AI Studio (BOFF-4089) — describe an automation in plain English and review
|
|
613
|
+
* the workflow draft the model builds for it, before anything is saved.
|
|
614
|
+
*
|
|
615
|
+
* - Left: the request, optional starting pattern, starter examples, the
|
|
616
|
+
* AI-credit balance, one-click refinements of the current draft and the
|
|
617
|
+
* model's clarifying questions (answer them and regenerate).
|
|
618
|
+
* - Right: the draft on the real builder canvas in read-only mode, its
|
|
619
|
+
* explanation, the settings still to fill in, and the two ways forward:
|
|
620
|
+
* "Edit in builder" saves the draft as a new DRAFT workflow (never
|
|
621
|
+
* activated) and opens it; "Regenerate" asks again from scratch.
|
|
622
|
+
*
|
|
623
|
+
* Generation runs on workflow-svc (`generateWorkflowFromPrompt`, polled via
|
|
624
|
+
* `workflowGeneration`); this page only drives and renders it.
|
|
625
|
+
*/
|
|
626
|
+
var AiStudioPage_exports = /* @__PURE__ */ __exportAll({
|
|
627
|
+
AiStudioPage: () => AiStudioPage,
|
|
628
|
+
WorkflowAiStudio: () => WorkflowAiStudio
|
|
629
|
+
});
|
|
630
|
+
const NO_TEMPLATE = "__none__";
|
|
631
|
+
function WorkflowAiStudio() {
|
|
632
|
+
const tr = useTr();
|
|
633
|
+
const navigate = useNavigate();
|
|
634
|
+
const generation = useWorkflowGeneration();
|
|
635
|
+
const templates = useAiWorkflowTemplates(true);
|
|
636
|
+
const { createWorkflow } = useCreateWorkflow();
|
|
637
|
+
const { allowed: canGenerate } = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.AI_WORKFLOW_CREATE);
|
|
638
|
+
const { allowed: canCreate } = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.WORKFLOW_CREATE);
|
|
639
|
+
const [prompt, setPrompt] = useState("");
|
|
640
|
+
const [template, setTemplate] = useState(NO_TEMPLATE);
|
|
641
|
+
const [answers, setAnswers] = useState({});
|
|
642
|
+
const [saving, setSaving] = useState(false);
|
|
643
|
+
const [refusal, setRefusal] = useState(null);
|
|
644
|
+
const requestRef = useRef(null);
|
|
645
|
+
const current = generation.generation;
|
|
646
|
+
const status = current ? String(current.status) : void 0;
|
|
647
|
+
const phase = phaseOf(status, generation.isWorking);
|
|
648
|
+
const draft = phase === "ready" ? current?.draft ?? null : null;
|
|
649
|
+
const questions = draft?.questions ?? [];
|
|
650
|
+
const warnings = current?.validation?.warnings ?? [];
|
|
651
|
+
const errors = current?.validation?.errors ?? [];
|
|
652
|
+
const steps = useMemo(() => draft ? draftSteps(draft.definitionJson) : [], [draft]);
|
|
653
|
+
const trimmed = prompt.trim();
|
|
654
|
+
const working = phase === "generating";
|
|
655
|
+
const answeredPrompt = requestRef.current ? buildAnsweredPrompt(requestRef.current.prompt, questions, answers) : null;
|
|
656
|
+
const run = useCallback((input) => {
|
|
657
|
+
setAnswers({});
|
|
658
|
+
generation.start(input);
|
|
659
|
+
}, [generation]);
|
|
660
|
+
const handleGenerate = useCallback(() => {
|
|
661
|
+
if (!trimmed) return;
|
|
662
|
+
const request = {
|
|
663
|
+
prompt: trimmed,
|
|
664
|
+
...template !== NO_TEMPLATE ? { template } : {}
|
|
665
|
+
};
|
|
666
|
+
requestRef.current = request;
|
|
667
|
+
run(request);
|
|
668
|
+
}, [
|
|
669
|
+
run,
|
|
670
|
+
template,
|
|
671
|
+
trimmed
|
|
672
|
+
]);
|
|
673
|
+
const handleRegenerate = useCallback(() => {
|
|
674
|
+
if (!requestRef.current) return;
|
|
675
|
+
run(requestRef.current);
|
|
676
|
+
}, [run]);
|
|
677
|
+
const handleRefine = useCallback((instruction) => {
|
|
678
|
+
if (!draft || !requestRef.current) return;
|
|
679
|
+
const refined = buildRefinementPrompt(requestRef.current.prompt, instruction);
|
|
680
|
+
requestRef.current = {
|
|
681
|
+
...requestRef.current,
|
|
682
|
+
prompt: refined
|
|
683
|
+
};
|
|
684
|
+
setPrompt(refined);
|
|
685
|
+
run({
|
|
686
|
+
prompt: refined,
|
|
687
|
+
baseDefinitionJson: draft.definitionJson
|
|
688
|
+
});
|
|
689
|
+
}, [draft, run]);
|
|
690
|
+
const handleAnswer = useCallback(() => {
|
|
691
|
+
if (!draft || !requestRef.current || !answeredPrompt) return;
|
|
692
|
+
requestRef.current = {
|
|
693
|
+
...requestRef.current,
|
|
694
|
+
prompt: answeredPrompt
|
|
695
|
+
};
|
|
696
|
+
setPrompt(answeredPrompt);
|
|
697
|
+
run({
|
|
698
|
+
prompt: answeredPrompt,
|
|
699
|
+
baseDefinitionJson: draft.definitionJson
|
|
700
|
+
});
|
|
701
|
+
}, [
|
|
702
|
+
answeredPrompt,
|
|
703
|
+
draft,
|
|
704
|
+
run
|
|
705
|
+
]);
|
|
706
|
+
const handleEditInBuilder = useCallback(async () => {
|
|
707
|
+
if (!draft) return;
|
|
708
|
+
setSaving(true);
|
|
709
|
+
let reported = null;
|
|
710
|
+
try {
|
|
711
|
+
const created = await createWorkflow(draftCreateInput({
|
|
712
|
+
name: draft.name,
|
|
713
|
+
description: draft.description,
|
|
714
|
+
definitionJson: draft.definitionJson
|
|
715
|
+
}, v4()), { onError: (error) => {
|
|
716
|
+
reported = error;
|
|
717
|
+
} });
|
|
718
|
+
if (!created?.workflowKey || !created.version) {
|
|
719
|
+
setRefusal(classifyCreateRefusal(reported));
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
toast.success(tr("fluidgrids.aiStudio.savedToast", "Draft saved as a new workflow"), { description: tr("fluidgrids.aiStudio.savedToastDescription", "Nothing is live yet. Fill in the settings, run a test, then activate it.") });
|
|
723
|
+
navigate(builderPathOf(created, ".."));
|
|
724
|
+
} finally {
|
|
725
|
+
setSaving(false);
|
|
726
|
+
}
|
|
727
|
+
}, [
|
|
728
|
+
createWorkflow,
|
|
729
|
+
draft,
|
|
730
|
+
navigate,
|
|
731
|
+
tr
|
|
732
|
+
]);
|
|
733
|
+
const showExamples = phase === "idle" && !requestRef.current;
|
|
734
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
735
|
+
className: "min-h-full bg-surface-canvas p-4 sm:p-6",
|
|
736
|
+
"data-testid": "ai-studio-page",
|
|
737
|
+
children: [
|
|
738
|
+
/* @__PURE__ */ jsxs("header", {
|
|
739
|
+
className: "mb-6 flex flex-col gap-1",
|
|
740
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
741
|
+
className: "flex items-center gap-3",
|
|
742
|
+
children: [
|
|
743
|
+
/* @__PURE__ */ jsx(Sparkles, {
|
|
744
|
+
className: "size-6 text-action-primary-bg",
|
|
745
|
+
"aria-hidden": true
|
|
746
|
+
}),
|
|
747
|
+
/* @__PURE__ */ jsx("h1", {
|
|
748
|
+
className: "text-2xl font-semibold text-text-primary sm:text-3xl",
|
|
749
|
+
children: tr("fluidgrids.aiStudio.title", "AI Studio")
|
|
750
|
+
}),
|
|
751
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
752
|
+
variant: "outline",
|
|
753
|
+
children: tr("fluidgrids.aiStudio.beta", "Beta")
|
|
754
|
+
})
|
|
755
|
+
]
|
|
756
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
757
|
+
className: "text-sm text-text-secondary",
|
|
758
|
+
children: tr("fluidgrids.aiStudio.subtitle", "Describe your automation in plain English. AI builds a draft workflow you review before anything is saved.")
|
|
759
|
+
})]
|
|
760
|
+
}),
|
|
761
|
+
/* @__PURE__ */ jsxs("div", {
|
|
762
|
+
className: "grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]",
|
|
763
|
+
children: [/* @__PURE__ */ jsxs(Card, {
|
|
764
|
+
className: "h-fit",
|
|
765
|
+
children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
766
|
+
className: "pb-2",
|
|
767
|
+
children: /* @__PURE__ */ jsx("h2", {
|
|
768
|
+
className: "text-base font-semibold text-text-primary",
|
|
769
|
+
children: tr("fluidgrids.aiStudio.describeTitle", "Describe your automation")
|
|
770
|
+
})
|
|
771
|
+
}), /* @__PURE__ */ jsxs(CardContent, {
|
|
772
|
+
className: "flex flex-col gap-4",
|
|
773
|
+
children: [
|
|
774
|
+
/* @__PURE__ */ jsxs("div", {
|
|
775
|
+
className: "flex flex-col gap-1.5",
|
|
776
|
+
children: [
|
|
777
|
+
/* @__PURE__ */ jsx(Label, {
|
|
778
|
+
htmlFor: "ai-studio-prompt",
|
|
779
|
+
className: "sr-only",
|
|
780
|
+
children: tr("fluidgrids.aiStudio.promptLabel", "What should the workflow do?")
|
|
781
|
+
}),
|
|
782
|
+
/* @__PURE__ */ jsx(Textarea, {
|
|
783
|
+
id: "ai-studio-prompt",
|
|
784
|
+
"data-testid": "ai-studio-prompt",
|
|
785
|
+
rows: 6,
|
|
786
|
+
maxLength: AI_DRAFT_MAX_PROMPT_LENGTH,
|
|
787
|
+
value: prompt,
|
|
788
|
+
disabled: working,
|
|
789
|
+
placeholder: tr("fluidgrids.aiStudio.promptPlaceholder", "When a new Stripe payment succeeds, add the customer to HubSpot and post a summary to Slack #sales."),
|
|
790
|
+
onChange: (event) => setPrompt(event.target.value)
|
|
791
|
+
}),
|
|
792
|
+
/* @__PURE__ */ jsxs("span", {
|
|
793
|
+
className: "self-end text-xs text-text-secondary",
|
|
794
|
+
children: [
|
|
795
|
+
prompt.length,
|
|
796
|
+
"/",
|
|
797
|
+
AI_DRAFT_MAX_PROMPT_LENGTH
|
|
798
|
+
]
|
|
799
|
+
})
|
|
800
|
+
]
|
|
801
|
+
}),
|
|
802
|
+
templates.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
803
|
+
className: "flex flex-col gap-1.5",
|
|
804
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
805
|
+
htmlFor: "ai-studio-template",
|
|
806
|
+
children: tr("fluidgrids.aiStudio.templateLabel", "Starting pattern (optional)")
|
|
807
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
808
|
+
value: template,
|
|
809
|
+
onValueChange: setTemplate,
|
|
810
|
+
disabled: working,
|
|
811
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
812
|
+
id: "ai-studio-template",
|
|
813
|
+
"data-testid": "ai-studio-template",
|
|
814
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
815
|
+
}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
816
|
+
value: NO_TEMPLATE,
|
|
817
|
+
children: tr("fluidgrids.aiStudio.noTemplate", "No pattern")
|
|
818
|
+
}), templates.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
819
|
+
value: option.id,
|
|
820
|
+
children: option.name
|
|
821
|
+
}, option.id))] })]
|
|
822
|
+
})]
|
|
823
|
+
}),
|
|
824
|
+
/* @__PURE__ */ jsx(AiCreditBalanceSlot, { testId: "ai-studio-credit-balance" }),
|
|
825
|
+
/* @__PURE__ */ jsxs("div", {
|
|
826
|
+
className: "flex flex-wrap gap-2",
|
|
827
|
+
children: [/* @__PURE__ */ jsxs(Button, {
|
|
828
|
+
"data-testid": "ai-studio-generate",
|
|
829
|
+
onClick: handleGenerate,
|
|
830
|
+
disabled: !trimmed || working || !canGenerate,
|
|
831
|
+
title: canGenerate ? void 0 : tr("fluidgrids.aiStudio.noPermission", "Your role cannot generate workflows with AI"),
|
|
832
|
+
className: "flex grow gap-2",
|
|
833
|
+
children: [working ? /* @__PURE__ */ jsx(SpinnerIcon, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }), working ? tr("fluidgrids.aiStudio.generating", "Generating…") : tr("fluidgrids.aiStudio.generate", "Generate workflow")]
|
|
834
|
+
}), working && /* @__PURE__ */ jsxs(Button, {
|
|
835
|
+
variant: "outline",
|
|
836
|
+
"data-testid": "ai-studio-cancel",
|
|
837
|
+
onClick: () => void generation.cancel(),
|
|
838
|
+
className: "flex gap-2",
|
|
839
|
+
children: [/* @__PURE__ */ jsx(Square, { className: "size-4" }), tr("fluidgrids.aiStudio.stop", "Stop")]
|
|
840
|
+
})]
|
|
841
|
+
}),
|
|
842
|
+
showExamples && /* @__PURE__ */ jsxs("section", {
|
|
843
|
+
className: "flex flex-col gap-2",
|
|
844
|
+
"data-testid": "ai-studio-examples",
|
|
845
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
846
|
+
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
847
|
+
children: [/* @__PURE__ */ jsx(Lightbulb, {
|
|
848
|
+
className: "size-4",
|
|
849
|
+
"aria-hidden": true
|
|
850
|
+
}), tr("fluidgrids.aiStudio.examplesTitle", "Try an example")]
|
|
851
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
852
|
+
className: "flex flex-wrap gap-2",
|
|
853
|
+
children: AI_STUDIO_EXAMPLES.map((example) => /* @__PURE__ */ jsx(Button, {
|
|
854
|
+
variant: "outline",
|
|
855
|
+
size: "sm",
|
|
856
|
+
"data-testid": `ai-studio-example-${example.id}`,
|
|
857
|
+
onClick: () => setPrompt(tr(example.promptKey, example.prompt)),
|
|
858
|
+
children: tr(example.labelKey, example.label)
|
|
859
|
+
}, example.id))
|
|
860
|
+
})]
|
|
861
|
+
}),
|
|
862
|
+
draft && /* @__PURE__ */ jsxs("section", {
|
|
863
|
+
className: "flex flex-col gap-2",
|
|
864
|
+
"data-testid": "ai-studio-suggestions",
|
|
865
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
866
|
+
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
867
|
+
children: [/* @__PURE__ */ jsx(Lightbulb, {
|
|
868
|
+
className: "size-4",
|
|
869
|
+
"aria-hidden": true
|
|
870
|
+
}), tr("fluidgrids.aiStudio.suggestionsTitle", "Suggestions")]
|
|
871
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
872
|
+
className: "flex flex-wrap gap-2",
|
|
873
|
+
children: AI_STUDIO_REFINEMENTS.map((refinement) => /* @__PURE__ */ jsx(Button, {
|
|
874
|
+
variant: "outline",
|
|
875
|
+
size: "sm",
|
|
876
|
+
disabled: !canGenerate,
|
|
877
|
+
"data-testid": `ai-studio-refine-${refinement.id}`,
|
|
878
|
+
onClick: () => handleRefine(refinement.instruction),
|
|
879
|
+
children: tr(refinement.labelKey, refinement.label)
|
|
880
|
+
}, refinement.id))
|
|
881
|
+
})]
|
|
882
|
+
}),
|
|
883
|
+
questions.length > 0 && /* @__PURE__ */ jsxs("section", {
|
|
884
|
+
className: "flex flex-col gap-3",
|
|
885
|
+
"data-testid": "ai-studio-questions",
|
|
886
|
+
children: [
|
|
887
|
+
/* @__PURE__ */ jsxs("h3", {
|
|
888
|
+
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
889
|
+
children: [/* @__PURE__ */ jsx(MessageCircleQuestion, {
|
|
890
|
+
className: "size-4",
|
|
891
|
+
"aria-hidden": true
|
|
892
|
+
}), tr("fluidgrids.aiStudio.questionsTitle", "AI clarifying questions")]
|
|
893
|
+
}),
|
|
894
|
+
/* @__PURE__ */ jsx("p", {
|
|
895
|
+
className: "text-xs text-text-secondary",
|
|
896
|
+
children: tr("fluidgrids.aiStudio.questionsHint", "The draft uses sensible defaults. Answer any of these to refine it.")
|
|
897
|
+
}),
|
|
898
|
+
/* @__PURE__ */ jsx("ol", {
|
|
899
|
+
className: "flex flex-col gap-3",
|
|
900
|
+
children: questions.map((question, index) => /* @__PURE__ */ jsxs("li", {
|
|
901
|
+
className: "flex flex-col gap-1.5",
|
|
902
|
+
children: [/* @__PURE__ */ jsxs(Label, {
|
|
903
|
+
htmlFor: `ai-studio-answer-${index}`,
|
|
904
|
+
className: "flex gap-2 font-normal text-text-primary",
|
|
905
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
906
|
+
className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-xs text-action-primary-text",
|
|
907
|
+
children: index + 1
|
|
908
|
+
}), /* @__PURE__ */ jsx("span", { children: question })]
|
|
909
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
910
|
+
id: `ai-studio-answer-${index}`,
|
|
911
|
+
"data-testid": `ai-studio-answer-${index}`,
|
|
912
|
+
value: answers[index] ?? "",
|
|
913
|
+
placeholder: tr("fluidgrids.aiStudio.answerPlaceholder", "Your answer (optional)"),
|
|
914
|
+
onChange: (event) => setAnswers((previous) => ({
|
|
915
|
+
...previous,
|
|
916
|
+
[index]: event.target.value
|
|
917
|
+
}))
|
|
918
|
+
})]
|
|
919
|
+
}, question))
|
|
920
|
+
}),
|
|
921
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
922
|
+
variant: "secondary",
|
|
923
|
+
"data-testid": "ai-studio-answer-submit",
|
|
924
|
+
disabled: !answeredPrompt || !canGenerate,
|
|
925
|
+
onClick: handleAnswer,
|
|
926
|
+
className: "flex gap-2 self-start",
|
|
927
|
+
children: [/* @__PURE__ */ jsx(RefreshCw, { className: "size-4" }), tr("fluidgrids.aiStudio.answerSubmit", "Update the draft with my answers")]
|
|
928
|
+
})
|
|
929
|
+
]
|
|
930
|
+
})
|
|
931
|
+
]
|
|
932
|
+
})]
|
|
933
|
+
}), /* @__PURE__ */ jsxs(Card, {
|
|
934
|
+
className: "flex min-w-0 flex-col",
|
|
935
|
+
"data-testid": "ai-studio-draft",
|
|
936
|
+
children: [/* @__PURE__ */ jsxs(CardHeader, {
|
|
937
|
+
className: "flex flex-row flex-wrap items-center justify-between gap-2 pb-2",
|
|
938
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
939
|
+
className: "flex min-w-0 items-center gap-2",
|
|
940
|
+
children: [/* @__PURE__ */ jsx(Badge, {
|
|
941
|
+
variant: "secondary",
|
|
942
|
+
children: tr("fluidgrids.aiStudio.draftBadge", "Draft")
|
|
943
|
+
}), /* @__PURE__ */ jsx("h2", {
|
|
944
|
+
className: "truncate text-base font-semibold text-text-primary",
|
|
945
|
+
"data-testid": "ai-studio-draft-name",
|
|
946
|
+
children: draft?.name ?? (working ? tr("fluidgrids.aiStudio.draftGenerating", "Your workflow is being generated") : tr("fluidgrids.aiStudio.draftEmpty", "No draft yet"))
|
|
947
|
+
})]
|
|
948
|
+
}), draft && /* @__PURE__ */ jsx(Badge, {
|
|
949
|
+
variant: "outline",
|
|
950
|
+
"data-testid": "ai-studio-step-count",
|
|
951
|
+
children: tr("fluidgrids.aiStudio.stepCount", "{{count}} steps", { count: draft.nodeCount })
|
|
952
|
+
})]
|
|
953
|
+
}), /* @__PURE__ */ jsxs(CardContent, {
|
|
954
|
+
className: "flex flex-col gap-4",
|
|
955
|
+
children: [
|
|
956
|
+
/* @__PURE__ */ jsx("div", {
|
|
957
|
+
className: "relative h-[360px] w-full overflow-hidden rounded-lg border border-border-default sm:h-[440px]",
|
|
958
|
+
children: draft && current ? /* @__PURE__ */ jsx(DraftCanvas, {
|
|
959
|
+
generationId: current.id,
|
|
960
|
+
name: draft.name,
|
|
961
|
+
definitionJson: draft.definitionJson
|
|
962
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
963
|
+
className: "flex h-full flex-col items-center justify-center gap-3 p-6 text-center text-sm text-text-secondary",
|
|
964
|
+
"data-testid": `ai-studio-state-${phase}`,
|
|
965
|
+
children: working ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SpinnerIcon, { className: "size-6 animate-spin" }), /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.aiStudio.generatingHint", "Picking nodes, connecting them and checking the result. This usually takes under a minute.") })] }) : phase === "failed" ? /* @__PURE__ */ jsx("div", {
|
|
966
|
+
role: "alert",
|
|
967
|
+
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
968
|
+
kind: "error",
|
|
969
|
+
size: "panel",
|
|
970
|
+
icon: /* @__PURE__ */ jsx(TriangleAlert, {
|
|
971
|
+
className: "size-6 text-status-error-text",
|
|
972
|
+
"aria-hidden": "true"
|
|
973
|
+
}),
|
|
974
|
+
title: current?.message ?? tr("fluidgrids.aiStudio.failed", "The draft could not be generated."),
|
|
975
|
+
action: errors.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
976
|
+
className: "max-w-md list-disc text-left text-xs text-text-secondary",
|
|
977
|
+
children: errors.slice(0, 5).map((entry) => /* @__PURE__ */ jsx("li", { children: entry }, entry))
|
|
978
|
+
}) : void 0
|
|
979
|
+
})
|
|
980
|
+
}) : phase === "cancelled" ? /* @__PURE__ */ jsx(EmptyState, {
|
|
981
|
+
kind: "first-use",
|
|
982
|
+
illustration: "assistant",
|
|
983
|
+
size: "panel",
|
|
984
|
+
icon: null,
|
|
985
|
+
title: tr("fluidgrids.aiStudio.cancelled", "Generation stopped. Change the request or generate again.")
|
|
986
|
+
}) : /* @__PURE__ */ jsx(EmptyState, {
|
|
987
|
+
kind: "first-use",
|
|
988
|
+
illustration: "assistant",
|
|
989
|
+
size: "panel",
|
|
990
|
+
icon: /* @__PURE__ */ jsx(Sparkles, {
|
|
991
|
+
className: "size-6",
|
|
992
|
+
"aria-hidden": "true"
|
|
993
|
+
}),
|
|
994
|
+
title: tr("fluidgrids.aiStudio.emptyHint", "Your draft appears here: a trigger and the steps that follow, ready to review.")
|
|
995
|
+
})
|
|
996
|
+
})
|
|
997
|
+
}),
|
|
998
|
+
(generation.error || generation.timedOut) && /* @__PURE__ */ jsx("div", {
|
|
999
|
+
role: "alert",
|
|
1000
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle p-3 text-sm text-status-error-text",
|
|
1001
|
+
"data-testid": "ai-studio-error",
|
|
1002
|
+
children: generation.timedOut ? tr("fluidgrids.aiStudio.timedOut", "The draft is taking longer than expected. Try again in a moment.") : generation.error
|
|
1003
|
+
}),
|
|
1004
|
+
draft && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1005
|
+
draft.explanation && /* @__PURE__ */ jsx("p", {
|
|
1006
|
+
className: "text-sm text-text-secondary",
|
|
1007
|
+
"data-testid": "ai-studio-explanation",
|
|
1008
|
+
children: draft.explanation
|
|
1009
|
+
}),
|
|
1010
|
+
steps.length > 0 && /* @__PURE__ */ jsx("ol", {
|
|
1011
|
+
className: "flex flex-col gap-1 text-sm",
|
|
1012
|
+
"data-testid": "ai-studio-steps",
|
|
1013
|
+
children: steps.map((step, index) => /* @__PURE__ */ jsxs("li", {
|
|
1014
|
+
className: "flex items-center gap-2 text-text-primary",
|
|
1015
|
+
children: [
|
|
1016
|
+
/* @__PURE__ */ jsx(CheckCircle2, {
|
|
1017
|
+
className: "size-4 shrink-0 text-status-success-text",
|
|
1018
|
+
"aria-hidden": true
|
|
1019
|
+
}),
|
|
1020
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1021
|
+
className: "text-text-secondary",
|
|
1022
|
+
children: [index + 1, "."]
|
|
1023
|
+
}),
|
|
1024
|
+
/* @__PURE__ */ jsx("span", {
|
|
1025
|
+
className: "truncate",
|
|
1026
|
+
children: step.label
|
|
1027
|
+
})
|
|
1028
|
+
]
|
|
1029
|
+
}, step.id))
|
|
1030
|
+
}),
|
|
1031
|
+
warnings.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
1032
|
+
className: "rounded-md border border-status-warning-border bg-status-warning-bg-subtle p-3 text-sm text-status-warning-text",
|
|
1033
|
+
"data-testid": "ai-studio-warnings",
|
|
1034
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1035
|
+
className: "font-medium",
|
|
1036
|
+
children: tr("fluidgrids.aiStudio.warningsTitle", "Fill in before activating")
|
|
1037
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
1038
|
+
className: "mt-1 list-disc pl-5 text-xs",
|
|
1039
|
+
children: warnings.map((warning) => /* @__PURE__ */ jsx("li", { children: warning }, warning))
|
|
1040
|
+
})]
|
|
1041
|
+
})
|
|
1042
|
+
] }),
|
|
1043
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1044
|
+
className: "flex flex-wrap items-center gap-2",
|
|
1045
|
+
children: [
|
|
1046
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
1047
|
+
"data-testid": "ai-studio-edit-in-builder",
|
|
1048
|
+
disabled: !draft || saving || working || !canCreate,
|
|
1049
|
+
onClick: () => void handleEditInBuilder(),
|
|
1050
|
+
className: "flex gap-2",
|
|
1051
|
+
children: [saving ? /* @__PURE__ */ jsx(SpinnerIcon, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(Pencil, { className: "size-4" }), tr("fluidgrids.aiStudio.editInBuilder", "Edit in builder")]
|
|
1052
|
+
}),
|
|
1053
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
1054
|
+
variant: "outline",
|
|
1055
|
+
"data-testid": "ai-studio-regenerate",
|
|
1056
|
+
disabled: !requestRef.current || working || !canGenerate,
|
|
1057
|
+
onClick: handleRegenerate,
|
|
1058
|
+
className: "flex gap-2",
|
|
1059
|
+
children: [/* @__PURE__ */ jsx(RefreshCw, { className: "size-4" }), tr("fluidgrids.aiStudio.regenerate", "Regenerate")]
|
|
1060
|
+
}),
|
|
1061
|
+
/* @__PURE__ */ jsx("span", {
|
|
1062
|
+
className: "text-xs text-text-secondary sm:ml-auto",
|
|
1063
|
+
children: tr("fluidgrids.aiStudio.betaNote", "AI Studio is in beta. Outputs may vary.")
|
|
1064
|
+
})
|
|
1065
|
+
]
|
|
1066
|
+
})
|
|
1067
|
+
]
|
|
1068
|
+
})]
|
|
1069
|
+
})]
|
|
1070
|
+
}),
|
|
1071
|
+
/* @__PURE__ */ jsx(CreateWorkflowRefusalDialog, {
|
|
1072
|
+
surface: "builder-create",
|
|
1073
|
+
refusal,
|
|
1074
|
+
onClose: () => setRefusal(null),
|
|
1075
|
+
onUpgrade: () => navigate(BILLING_PLANS_PATH)
|
|
1076
|
+
})
|
|
1077
|
+
]
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
const AI_STUDIO_MODES = [
|
|
1081
|
+
"workflow",
|
|
1082
|
+
"steward",
|
|
1083
|
+
"run"
|
|
1084
|
+
];
|
|
1085
|
+
function isAiStudioMode(value) {
|
|
1086
|
+
return AI_STUDIO_MODES.some((mode) => mode === value);
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* AI Studio. With BotManor Stewards on for the workspace (BOFF-16146) it
|
|
1090
|
+
* offers two more modes next to the workflow draft: describe a Steward, and
|
|
1091
|
+
* turn a Steward run into a workflow. With the flag off it is the workflow
|
|
1092
|
+
* draft page alone, as before.
|
|
1093
|
+
*/
|
|
1094
|
+
function AiStudioPage() {
|
|
1095
|
+
const tr = useTr();
|
|
1096
|
+
const stewards = useBotmanorStewardsEnabled();
|
|
1097
|
+
const [mode, setMode] = useState("workflow");
|
|
1098
|
+
if (!stewards) return /* @__PURE__ */ jsx(WorkflowAiStudio, {});
|
|
1099
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1100
|
+
className: "min-h-full bg-surface-canvas",
|
|
1101
|
+
"data-testid": "ai-studio-modes",
|
|
1102
|
+
children: [
|
|
1103
|
+
/* @__PURE__ */ jsx(Tabs, {
|
|
1104
|
+
value: mode,
|
|
1105
|
+
onValueChange: (value) => {
|
|
1106
|
+
if (isAiStudioMode(value)) setMode(value);
|
|
1107
|
+
},
|
|
1108
|
+
className: "px-4 pt-4 sm:px-6",
|
|
1109
|
+
children: /* @__PURE__ */ jsxs(TabsList, {
|
|
1110
|
+
"aria-label": tr("fluidgrids.aiStudio.modes.label", "AI Studio mode"),
|
|
1111
|
+
children: [
|
|
1112
|
+
/* @__PURE__ */ jsx(TabsTrigger, {
|
|
1113
|
+
value: "workflow",
|
|
1114
|
+
"data-testid": "ai-studio-mode-workflow",
|
|
1115
|
+
children: tr("fluidgrids.aiStudio.modes.workflow", "Workflow")
|
|
1116
|
+
}),
|
|
1117
|
+
/* @__PURE__ */ jsx(TabsTrigger, {
|
|
1118
|
+
value: "steward",
|
|
1119
|
+
"data-testid": "ai-studio-mode-steward",
|
|
1120
|
+
children: tr("fluidgrids.aiStudio.modes.steward", "Steward")
|
|
1121
|
+
}),
|
|
1122
|
+
/* @__PURE__ */ jsx(TabsTrigger, {
|
|
1123
|
+
value: "run",
|
|
1124
|
+
"data-testid": "ai-studio-mode-run",
|
|
1125
|
+
children: tr("fluidgrids.aiStudio.modes.run", "From a Steward run")
|
|
1126
|
+
})
|
|
1127
|
+
]
|
|
1128
|
+
})
|
|
1129
|
+
}),
|
|
1130
|
+
mode === "workflow" && /* @__PURE__ */ jsx(WorkflowAiStudio, {}),
|
|
1131
|
+
mode === "steward" && /* @__PURE__ */ jsx(StewardBuilderPanel, {}),
|
|
1132
|
+
mode === "run" && /* @__PURE__ */ jsx(StewardRunImportPanel, {})
|
|
1133
|
+
]
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
export { CancelWorkflowGenerationDocument as a, GenerateWorkflowFromPromptDocument as i, AiStudioPage_exports as n, WorkflowGenerationDocument as r, AiStudioPage as t };
|