@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,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as BILLING_ADDONS_PATH } from "./quota-DeA_CJ2e.js";
|
|
3
|
+
import { gql } from "@apollo/client/core";
|
|
4
|
+
|
|
5
|
+
// src/billing/addonCatalog.ts
|
|
6
|
+
const FLUIDGRIDS_ADDONS_PRODUCT_ID = "fluidgrids";
|
|
7
|
+
const PUBLIC_ADDONS_FOR_QUOTAS_QUERY = gql`
|
|
8
|
+
query PublicAddonsForQuotas($productId: String!) {
|
|
9
|
+
publicAddons(productId: $productId) {
|
|
10
|
+
id
|
|
11
|
+
isActive
|
|
12
|
+
price
|
|
13
|
+
features {
|
|
14
|
+
quota {
|
|
15
|
+
name
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
/**
|
|
22
|
+
* The add-on page for `quotaName`: `/billing/addons/<id>` of the cheapest
|
|
23
|
+
* active add-on granting that quota, or null when none does. Where a quota
|
|
24
|
+
* has several packs (Integration Steps 1K / 5K, Sandbox Runtime 10h / 50h,
|
|
25
|
+
* AI Credits 1M / 5M), the cheapest is the smallest, so "Buy more" opens the
|
|
26
|
+
* smallest pack (BOFF-16640).
|
|
27
|
+
*/
|
|
28
|
+
function addonPathForQuota(addons, quotaName) {
|
|
29
|
+
if (!quotaName) return null;
|
|
30
|
+
let best = null;
|
|
31
|
+
for (const addon of addons) {
|
|
32
|
+
if (!addon.id || addon.isActive !== true) continue;
|
|
33
|
+
if (!(addon.features ?? []).some((feature) => feature?.quota?.name === quotaName)) continue;
|
|
34
|
+
const price = addon.price ?? Number.POSITIVE_INFINITY;
|
|
35
|
+
if (!best || price < best.price) best = {
|
|
36
|
+
id: addon.id,
|
|
37
|
+
price
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return best ? `${BILLING_ADDONS_PATH}/${encodeURIComponent(best.id)}` : null;
|
|
41
|
+
}
|
|
42
|
+
/** One read of the product's public add-on catalog; null when it fails. */
|
|
43
|
+
async function readPublicAddons(client, productId = FLUIDGRIDS_ADDONS_PRODUCT_ID) {
|
|
44
|
+
try {
|
|
45
|
+
const result = await client.query({
|
|
46
|
+
query: PUBLIC_ADDONS_FOR_QUOTAS_QUERY,
|
|
47
|
+
variables: { productId },
|
|
48
|
+
fetchPolicy: "network-only",
|
|
49
|
+
errorPolicy: "all"
|
|
50
|
+
});
|
|
51
|
+
if (result.error) return null;
|
|
52
|
+
return result.data?.publicAddons ?? null;
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { readPublicAddons as n, addonPathForQuota as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { ApolloClient } from "@apollo/client";
|
|
3
|
+
interface AddonForQuota {
|
|
4
|
+
id?: string | null;
|
|
5
|
+
isActive?: boolean | null;
|
|
6
|
+
price?: number | null;
|
|
7
|
+
features?: ReadonlyArray<{
|
|
8
|
+
quota?: {
|
|
9
|
+
name?: string | null;
|
|
10
|
+
} | null;
|
|
11
|
+
} | null> | null;
|
|
12
|
+
}
|
|
13
|
+
declare function addonPathForQuota(addons: readonly AddonForQuota[], quotaName: string | null | undefined): string | null;
|
|
14
|
+
declare function readPublicAddons(client: Pick<ApolloClient, "query">, productId?: string): Promise<AddonForQuota[] | null>;
|
|
15
|
+
export { addonPathForQuota as n, readPublicAddons as r, AddonForQuota as t };
|
package/dist/addons.d.ts
ADDED
package/dist/addons.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/modules/agent-definitions/utils/agent-form.ts
|
|
3
|
+
const MAX_GRANT_DAYS = 365;
|
|
4
|
+
const MAX_TOOL_RULES = 100;
|
|
5
|
+
const MAX_CONNECTIONS = 100;
|
|
6
|
+
var AgentFormError = class extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "AgentFormError";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function emptyAgentForm() {
|
|
13
|
+
return {
|
|
14
|
+
name: "",
|
|
15
|
+
description: "",
|
|
16
|
+
tools: [{
|
|
17
|
+
nodeType: "",
|
|
18
|
+
operations: ""
|
|
19
|
+
}],
|
|
20
|
+
connectionScope: [],
|
|
21
|
+
requireToolApproval: false,
|
|
22
|
+
status: "ACTIVE"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function agentToForm(agent) {
|
|
26
|
+
return {
|
|
27
|
+
name: agent.name,
|
|
28
|
+
description: agent.description ?? "",
|
|
29
|
+
tools: agent.toolAllowlist.length > 0 ? agent.toolAllowlist.map((rule) => ({
|
|
30
|
+
nodeType: rule.nodeType,
|
|
31
|
+
operations: rule.operations.join(", ")
|
|
32
|
+
})) : [{
|
|
33
|
+
nodeType: "",
|
|
34
|
+
operations: ""
|
|
35
|
+
}],
|
|
36
|
+
connectionScope: [...agent.connectionScope],
|
|
37
|
+
requireToolApproval: agent.requireToolApproval,
|
|
38
|
+
status: agent.status
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function splitOperations(value) {
|
|
42
|
+
return [...new Set(value.split(",").map((operation) => operation.trim()).filter(Boolean))];
|
|
43
|
+
}
|
|
44
|
+
/** Validate the form and build the mutation input. Throws AgentFormError on invalid input. */
|
|
45
|
+
function formToInput(form) {
|
|
46
|
+
const name = form.name.trim();
|
|
47
|
+
if (name.length === 0 || name.length > 200) throw new AgentFormError("Give the agent a name of 1 to 200 characters.");
|
|
48
|
+
const description = form.description.trim();
|
|
49
|
+
if (description.length > 2e3) throw new AgentFormError("The description must be at most 2000 characters.");
|
|
50
|
+
const rules = form.tools.map((row) => ({
|
|
51
|
+
nodeType: row.nodeType.trim(),
|
|
52
|
+
operations: splitOperations(row.operations)
|
|
53
|
+
})).filter((rule) => rule.nodeType.length > 0 || rule.operations.length > 0);
|
|
54
|
+
if (rules.some((rule) => rule.nodeType.length === 0)) throw new AgentFormError("Every tool rule needs a node type.");
|
|
55
|
+
if (rules.length > 100) throw new AgentFormError(`At most ${100} tool rules.`);
|
|
56
|
+
const connectionScope = [...new Set(form.connectionScope.filter(Boolean))];
|
|
57
|
+
if (connectionScope.length > 100) throw new AgentFormError(`At most ${100} connections.`);
|
|
58
|
+
return {
|
|
59
|
+
name,
|
|
60
|
+
description: description || null,
|
|
61
|
+
toolAllowlist: rules,
|
|
62
|
+
connectionScope,
|
|
63
|
+
requireToolApproval: form.requireToolApproval,
|
|
64
|
+
status: form.status
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Whole days for a grant, or an error message when out of range. */
|
|
68
|
+
function grantDays(value) {
|
|
69
|
+
const days = Number(value);
|
|
70
|
+
if (!Number.isInteger(days) || days < 1 || days > 365) throw new AgentFormError(`A grant lasts between 1 and ${365} days.`);
|
|
71
|
+
return days;
|
|
72
|
+
}
|
|
73
|
+
/** "store/slack: postMessage, listChannels" / "store/notion: any operation". */
|
|
74
|
+
function describeRule(rule) {
|
|
75
|
+
return rule.operations.length > 0 ? `${rule.nodeType}: ${rule.operations.join(", ")}` : `${rule.nodeType}: any operation`;
|
|
76
|
+
}
|
|
77
|
+
/** Whether a node type is the AI Agent node (raw types carry a `store:` prefix and an op suffix). */
|
|
78
|
+
function isAgentNodeType(nodeType) {
|
|
79
|
+
if (!nodeType) return false;
|
|
80
|
+
return nodeType === "store/ai-agent" || nodeType.includes("store/ai-agent");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { formToInput as a, emptyAgentForm as i, agentToForm as n, grantDays as o, describeRule as r, isAgentNodeType as s, AgentFormError as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { a as createUiMarkTools, c as FluidGridsAgentToolDeps, d as triggerNodesOf, i as UiMarkToolOptions, l as createFluidGridsAgentTools, n as resetAgentMarks, o as AgentCalloutOverlay, r as useAgentMarksStore, s as AgentCalloutOverlayProps, t as CanvasNote, u as pickTriggerNode } from "./index-DEMT3iAM.js";
|
|
3
|
+
export { AgentCalloutOverlay, type AgentCalloutOverlayProps, type CanvasNote, type FluidGridsAgentToolDeps, type UiMarkToolOptions, createFluidGridsAgentTools, createUiMarkTools, pickTriggerNode, resetAgentMarks, triggerNodesOf, useAgentMarksStore };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as triggerNodesOf, i as pickTriggerNode, n as AgentCalloutOverlay, r as createFluidGridsAgentTools, t as createUiMarkTools } from "./uiMarkTools-CSznnO1i.js";
|
|
3
|
+
import { n as useAgentMarksStore, t as resetAgentMarks } from "./marksStore-a9oIMMot.js";
|
|
4
|
+
|
|
5
|
+
export { AgentCalloutOverlay, createFluidGridsAgentTools, createUiMarkTools, pickTriggerNode, resetAgentMarks, triggerNodesOf, useAgentMarksStore };
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { H as selectedOperationOf, L as fixedParameterState, O as createConfiguredNode, V as paramsFromOperation, b as registryNodeData, bt as autosaveAllowedFor, c as ensureNodeTypeReady, f as getNodeConfig, i as NODE_CONFIGS, kt as isFlowComplete, m as isNodeConfigsInitialized, z as nodeTitle } from "./use-bare-node-registry-O6mKJO_n.js";
|
|
3
|
+
import { D as resolveOutputHandles, E as resolveInputHandles, U as useFlowStore } from "./node-operation-selection-CdV3KI_V.js";
|
|
4
|
+
import { s as isNodeTypeHiddenFromPalette } from "./durable-nodes-BXyYCLxT.js";
|
|
5
|
+
import { t as computeAttachPosition } from "./attach-node-helpers-HDKQOtrD.js";
|
|
6
|
+
import { u as SENSITIVE_PARAM } from "./askQuestions-Cmx7VnMm.js";
|
|
7
|
+
import { r as useSaveStatusStore } from "./save-status-store-C7nEYpfb.js";
|
|
8
|
+
import { AgentToolError, defineAgentTool } from "@burdenoff/fe-libs/shared/agent-tools";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
|
|
11
|
+
// src/builder/agentTools.ts
|
|
12
|
+
/**
|
|
13
|
+
* ★ BOFF-9787: agent tools for the workflow builder canvas — read the
|
|
14
|
+
* workflow on screen, add and wire nodes, rename, enable/disable, set a
|
|
15
|
+
* parameter.
|
|
16
|
+
*
|
|
17
|
+
* They act on the builder's own store through the same writes the canvas,
|
|
18
|
+
* the Node Store and the node panel make (`setNodes`, `onConnect`,
|
|
19
|
+
* `renameNode`, `toggleDisabled`, `fixedParameterState`), so every change is
|
|
20
|
+
* on screen at once and on the undo stack like a person's edit.
|
|
21
|
+
*
|
|
22
|
+
* ★★ The tools never press Save. What persists an edit is the builder's own
|
|
23
|
+
* rule, exactly as for the person's edits (BOFF-9724): a DRAFT with autosave
|
|
24
|
+
* on saves itself shortly after the edit; an ACTIVE or archived version is
|
|
25
|
+
* never changed in place — it changes only when the person saves, which forks
|
|
26
|
+
* a new draft. Each result says which applies (`autosaves`). Connections
|
|
27
|
+
* (credentials) are never touched: choosing what an automation may sign in as
|
|
28
|
+
* stays with the person.
|
|
29
|
+
*
|
|
30
|
+
* Registered only while an editable builder is mounted
|
|
31
|
+
* (`useBuilderAgentTools`).
|
|
32
|
+
*/
|
|
33
|
+
const MAX_NODES_LISTED = 40;
|
|
34
|
+
const MAX_EDGES_LISTED = 60;
|
|
35
|
+
const MAX_TYPES_LISTED = 15;
|
|
36
|
+
const POSITION_GAP_X = 400;
|
|
37
|
+
const nodeId = z.string().trim().min(1).max(100).describe("A node id from fg_canvas_read.");
|
|
38
|
+
function store() {
|
|
39
|
+
return useFlowStore.getState();
|
|
40
|
+
}
|
|
41
|
+
function findNode(id) {
|
|
42
|
+
const node = store().workflow.nodes.find((candidate) => candidate.id === id);
|
|
43
|
+
if (!node) throw new AgentToolError("NOT_FOUND", `No node "${id.slice(0, 40)}" on the canvas. Use fg_canvas_read.`, { retryable: true });
|
|
44
|
+
return node;
|
|
45
|
+
}
|
|
46
|
+
const defaultCatalogueReady = () => isNodeConfigsInitialized() && NODE_CONFIGS.length > 0;
|
|
47
|
+
function requireCatalogue(ready) {
|
|
48
|
+
if (!ready()) throw new AgentToolError("CONFLICT", "The node catalogue is still loading. Try again in a few seconds.", { retryable: true });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Will this edit be saved without the person pressing Save? Exactly when the
|
|
52
|
+
* builder's autosave runner would save it (`use-builder-autosave.ts`):
|
|
53
|
+
* autosave not paused after a failed save, allowed for this workflow (a
|
|
54
|
+
* STORED draft — a new or copied workflow has no database id until its first
|
|
55
|
+
* save — with the "Auto-save drafts" preference on), and a complete flow (an
|
|
56
|
+
* unconnected node holds autosave back). Never throws: it is asked after an
|
|
57
|
+
* edit was already applied.
|
|
58
|
+
*/
|
|
59
|
+
function autosaves() {
|
|
60
|
+
try {
|
|
61
|
+
const { workflow } = store();
|
|
62
|
+
return !useSaveStatusStore.getState().autosavePaused && autosaveAllowedFor(workflow) && isFlowComplete(workflow.nodes, workflow.edges);
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const SAVE_RULE = "When autosaves is true the change is saved shortly after, like the person's own edits; otherwise (a new workflow, an active version, an incomplete flow, autosave off or paused) it is kept only when the person saves.";
|
|
68
|
+
function dataOf(node) {
|
|
69
|
+
return node.data && typeof node.data === "object" ? node.data : {};
|
|
70
|
+
}
|
|
71
|
+
function operationNames(type) {
|
|
72
|
+
return (getNodeConfig(type)?.operations ?? []).filter((op) => op.name && !op.isAdapterOperation && !op.internal).map((op) => op.name);
|
|
73
|
+
}
|
|
74
|
+
/** Right of the right-most node, so a new node never lands on another. */
|
|
75
|
+
function freePosition(nodes) {
|
|
76
|
+
if (nodes.length === 0) return {
|
|
77
|
+
x: 0,
|
|
78
|
+
y: 0
|
|
79
|
+
};
|
|
80
|
+
const rightMost = nodes.reduce((best, node) => node.position.x > best.position.x ? node : best);
|
|
81
|
+
return {
|
|
82
|
+
x: rightMost.position.x + POSITION_GAP_X,
|
|
83
|
+
y: rightMost.position.y
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function createBuilderAgentTools(options = {}) {
|
|
87
|
+
const catalogueReady = options.catalogueReady ?? defaultCatalogueReady;
|
|
88
|
+
const durableFunctionsEnabled = options.durableFunctionsEnabled ?? (() => false);
|
|
89
|
+
/** Hidden from the palettes, so hidden from the assistant too. */
|
|
90
|
+
const isHidden = (type) => isNodeTypeHiddenFromPalette(type, durableFunctionsEnabled());
|
|
91
|
+
return [
|
|
92
|
+
defineAgentTool({
|
|
93
|
+
name: "fg_canvas_read",
|
|
94
|
+
title: "Read the canvas",
|
|
95
|
+
description: "Reads the workflow open in the builder: its name, version and status, every node (id, label, type, operation, disabled) and every connection. Says whether edits autosave (drafts) or wait for the person to save.",
|
|
96
|
+
input: z.strictObject({ offset: z.number().int().min(0).max(1e4).default(0).describe("Index of the first node to list, for large workflows.") }),
|
|
97
|
+
annotations: {
|
|
98
|
+
readOnly: true,
|
|
99
|
+
untrustedContent: true
|
|
100
|
+
},
|
|
101
|
+
execute: ({ offset }) => {
|
|
102
|
+
const { workflow } = store();
|
|
103
|
+
const nodes = workflow.nodes;
|
|
104
|
+
const page = nodes.slice(offset, offset + MAX_NODES_LISTED);
|
|
105
|
+
return {
|
|
106
|
+
workflow: {
|
|
107
|
+
workflowKey: workflow.workflowKey,
|
|
108
|
+
name: workflow.name,
|
|
109
|
+
version: workflow.version,
|
|
110
|
+
status: workflow.status,
|
|
111
|
+
autosaves: autosaves()
|
|
112
|
+
},
|
|
113
|
+
nodeCount: nodes.length,
|
|
114
|
+
nodes: page.map((node) => {
|
|
115
|
+
const data = dataOf(node);
|
|
116
|
+
return {
|
|
117
|
+
id: node.id,
|
|
118
|
+
label: nodeTitle(node),
|
|
119
|
+
type: node.type,
|
|
120
|
+
...typeof data.operation_name === "string" ? { operation: data.operation_name } : {},
|
|
121
|
+
...data.disabled === true ? { disabled: true } : {}
|
|
122
|
+
};
|
|
123
|
+
}),
|
|
124
|
+
...offset + page.length < nodes.length ? { nextOffset: offset + page.length } : {},
|
|
125
|
+
edges: workflow.edges.slice(0, MAX_EDGES_LISTED).map((edge) => ({
|
|
126
|
+
from: edge.source,
|
|
127
|
+
to: edge.target,
|
|
128
|
+
...edge.sourceHandle && edge.sourceHandle !== "source" ? { fromHandle: edge.sourceHandle } : {},
|
|
129
|
+
...edge.targetHandle && edge.targetHandle !== "target" ? { toHandle: edge.targetHandle } : {}
|
|
130
|
+
}))
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
defineAgentTool({
|
|
135
|
+
name: "fg_canvas_node_types",
|
|
136
|
+
title: "Find node types",
|
|
137
|
+
description: "Finds node types that can be added to the canvas (installed and built-in), by words in their name or description. Returns the type id and its operations, for fg_canvas_add_node.",
|
|
138
|
+
input: z.strictObject({ query: z.string().trim().min(1).max(80).describe("Words to look for, e.g. \"gmail\", \"http request\", \"if\".") }),
|
|
139
|
+
annotations: { readOnly: true },
|
|
140
|
+
execute: ({ query }) => {
|
|
141
|
+
requireCatalogue(catalogueReady);
|
|
142
|
+
const words = query.toLowerCase().split(/\s+/);
|
|
143
|
+
const matches = NODE_CONFIGS.filter((config) => {
|
|
144
|
+
if (isHidden(config.type)) return false;
|
|
145
|
+
const text = `${config.type} ${config.detail.title} ${config.detail.description ?? ""}`.toLowerCase();
|
|
146
|
+
return words.every((word) => text.includes(word));
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
total: matches.length,
|
|
150
|
+
types: matches.slice(0, MAX_TYPES_LISTED).map((config) => ({
|
|
151
|
+
nodeType: config.type,
|
|
152
|
+
title: config.detail.title,
|
|
153
|
+
operations: operationNames(config.type).slice(0, 12)
|
|
154
|
+
}))
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
defineAgentTool({
|
|
159
|
+
name: "fg_canvas_add_node",
|
|
160
|
+
title: "Add a node",
|
|
161
|
+
description: "Adds a node to the canvas, pinned to an operation, optionally right after an existing node and connected to it. Find nodeType with fg_canvas_node_types. " + SAVE_RULE,
|
|
162
|
+
input: z.strictObject({
|
|
163
|
+
nodeType: z.string().trim().min(1).max(120).describe("A nodeType from fg_canvas_node_types."),
|
|
164
|
+
operation: z.string().trim().min(1).max(120).optional().describe("The operation to pin. Omit for a single-operation node."),
|
|
165
|
+
afterNodeId: nodeId.optional().describe("Place the new node after this node and connect it.")
|
|
166
|
+
}),
|
|
167
|
+
execute: async ({ nodeType, operation, afterNodeId }) => {
|
|
168
|
+
requireCatalogue(catalogueReady);
|
|
169
|
+
if (isHidden(nodeType) || !getNodeConfig(nodeType)) throw new AgentToolError("NOT_FOUND", `No node type "${nodeType.slice(0, 60)}". Use fg_canvas_node_types.`, { retryable: true });
|
|
170
|
+
const operations = operationNames(nodeType);
|
|
171
|
+
if (operation && !operations.includes(operation)) throw new AgentToolError("INVALID_INPUT", `No operation "${operation.slice(0, 60)}" on ${nodeType}. Operations: ${operations.slice(0, 12).join(", ")}.`);
|
|
172
|
+
if (!operation && operations.length > 1) throw new AgentToolError("INVALID_INPUT", `Choose an operation for ${nodeType}: ${operations.slice(0, 12).join(", ")}.`);
|
|
173
|
+
if (!await ensureNodeTypeReady(nodeType)) throw new AgentToolError("FAILED", `Could not load ${nodeType.slice(0, 60)}. Try again.`);
|
|
174
|
+
const anchor = afterNodeId ? findNode(afterNodeId) : void 0;
|
|
175
|
+
const current = store().workflow.nodes;
|
|
176
|
+
const position = computeAttachPosition(anchor) ?? freePosition(current);
|
|
177
|
+
const created = createConfiguredNode(nodeType, position, operation);
|
|
178
|
+
store().actions.nodes.setNodes([...current.map((node) => node.selected ? {
|
|
179
|
+
...node,
|
|
180
|
+
selected: false
|
|
181
|
+
} : node), created]);
|
|
182
|
+
if (anchor) {
|
|
183
|
+
const sourceHandle = resolveOutputHandles(dataOf(anchor), anchor.type, registryNodeData(anchor.type))[0]?.id ?? "source";
|
|
184
|
+
const targetHandle = resolveInputHandles(dataOf(created), registryNodeData(created.type), { nodeType: created.type })[0]?.id ?? "target";
|
|
185
|
+
store().actions.edges.onConnect({
|
|
186
|
+
source: anchor.id,
|
|
187
|
+
sourceHandle,
|
|
188
|
+
target: created.id,
|
|
189
|
+
targetHandle
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
nodeId: created.id,
|
|
194
|
+
label: nodeTitle(created),
|
|
195
|
+
...typeof dataOf(created).operation_name === "string" ? { operation: dataOf(created).operation_name } : {},
|
|
196
|
+
connectedFrom: anchor?.id,
|
|
197
|
+
autosaves: autosaves()
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
defineAgentTool({
|
|
202
|
+
name: "fg_canvas_connect",
|
|
203
|
+
title: "Connect two nodes",
|
|
204
|
+
description: "Connects one node's output to another node's input. For nodes with several outputs (IF, Switch) or inputs (Merge) pass the handle ids. " + SAVE_RULE,
|
|
205
|
+
input: z.strictObject({
|
|
206
|
+
fromNodeId: nodeId.describe("The node the data comes from."),
|
|
207
|
+
toNodeId: nodeId.describe("The node the data goes to."),
|
|
208
|
+
fromHandle: z.string().trim().min(1).max(60).optional().describe("Output handle id, e.g. \"true\" or \"false\" on an IF node."),
|
|
209
|
+
toHandle: z.string().trim().min(1).max(60).optional().describe("Input handle id, e.g. \"input-2\" on a Merge node.")
|
|
210
|
+
}),
|
|
211
|
+
execute: ({ fromNodeId, toNodeId, fromHandle, toHandle }) => {
|
|
212
|
+
if (fromNodeId === toNodeId) throw new AgentToolError("INVALID_INPUT", "A node cannot connect to itself.");
|
|
213
|
+
const from = findNode(fromNodeId);
|
|
214
|
+
const to = findNode(toNodeId);
|
|
215
|
+
const outputs = resolveOutputHandles(dataOf(from), from.type, registryNodeData(from.type)).map((handle) => handle.id);
|
|
216
|
+
const inputs = resolveInputHandles(dataOf(to), registryNodeData(to.type), { nodeType: to.type }).map((handle) => handle.id);
|
|
217
|
+
const sourceHandle = fromHandle ?? outputs[0] ?? "source";
|
|
218
|
+
const targetHandle = toHandle ?? inputs[0] ?? "target";
|
|
219
|
+
if (outputs.length > 0 && !outputs.includes(sourceHandle)) throw new AgentToolError("INVALID_INPUT", `No output "${sourceHandle}". Outputs: ${outputs.join(", ")}.`);
|
|
220
|
+
if (inputs.length > 0 && !inputs.includes(targetHandle)) throw new AgentToolError("INVALID_INPUT", `No input "${targetHandle}". Inputs: ${inputs.join(", ")}.`);
|
|
221
|
+
const exists = store().workflow.edges.some((edge) => edge.source === from.id && edge.target === to.id && (edge.sourceHandle ?? "source") === sourceHandle && (edge.targetHandle ?? "target") === targetHandle);
|
|
222
|
+
if (!exists) store().actions.edges.onConnect({
|
|
223
|
+
source: from.id,
|
|
224
|
+
sourceHandle,
|
|
225
|
+
target: to.id,
|
|
226
|
+
targetHandle
|
|
227
|
+
});
|
|
228
|
+
return {
|
|
229
|
+
from: from.id,
|
|
230
|
+
to: to.id,
|
|
231
|
+
fromHandle: sourceHandle,
|
|
232
|
+
toHandle: targetHandle,
|
|
233
|
+
alreadyConnected: exists,
|
|
234
|
+
autosaves: autosaves()
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}),
|
|
238
|
+
defineAgentTool({
|
|
239
|
+
name: "fg_canvas_rename_node",
|
|
240
|
+
title: "Rename a node",
|
|
241
|
+
description: "Renames a node on the canvas. " + SAVE_RULE,
|
|
242
|
+
input: z.strictObject({
|
|
243
|
+
nodeId,
|
|
244
|
+
label: z.string().trim().min(1).max(80).describe("The new node name.")
|
|
245
|
+
}),
|
|
246
|
+
execute: ({ nodeId: id, label }) => {
|
|
247
|
+
findNode(id);
|
|
248
|
+
store().actions.nodes.renameNode(id, label);
|
|
249
|
+
return {
|
|
250
|
+
nodeId: id,
|
|
251
|
+
label: nodeTitle(findNode(id)),
|
|
252
|
+
autosaves: autosaves()
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}),
|
|
256
|
+
defineAgentTool({
|
|
257
|
+
name: "fg_canvas_toggle_node",
|
|
258
|
+
title: "Enable or disable a node",
|
|
259
|
+
description: "Disables a node (runs skip it) or enables it again. " + SAVE_RULE,
|
|
260
|
+
input: z.strictObject({
|
|
261
|
+
nodeId,
|
|
262
|
+
disabled: z.boolean().describe("true to disable the node, false to enable it.")
|
|
263
|
+
}),
|
|
264
|
+
execute: ({ nodeId: id, disabled }) => {
|
|
265
|
+
const current = dataOf(findNode(id)).disabled === true;
|
|
266
|
+
return {
|
|
267
|
+
nodeId: id,
|
|
268
|
+
disabled: current === disabled ? current : store().actions.nodes.toggleDisabled(id),
|
|
269
|
+
autosaves: autosaves()
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}),
|
|
273
|
+
defineAgentTool({
|
|
274
|
+
name: "fg_canvas_set_param",
|
|
275
|
+
title: "Set a node parameter",
|
|
276
|
+
description: "Sets one parameter of a node's operation to a fixed value, as the node panel does. Connections and secrets are not set here; the person picks those. " + SAVE_RULE,
|
|
277
|
+
input: z.strictObject({
|
|
278
|
+
nodeId,
|
|
279
|
+
field: z.string().trim().min(1).max(80).describe("The parameter name; an unknown one lists the valid names."),
|
|
280
|
+
value: z.string().max(4e3).describe("The value as text: numbers, true/false and JSON are converted to the parameter's type. Empty clears it.")
|
|
281
|
+
}),
|
|
282
|
+
execute: ({ nodeId: id, field, value }) => {
|
|
283
|
+
const node = findNode(id);
|
|
284
|
+
const operation = selectedOperationOf(dataOf(node), node.type);
|
|
285
|
+
const params = paramsFromOperation(operation);
|
|
286
|
+
const parameter = params.find((candidate) => candidate.name === field);
|
|
287
|
+
if (!parameter) throw new AgentToolError("INVALID_INPUT", params.length > 0 ? `No parameter "${field.slice(0, 40)}". Parameters: ${params.slice(0, 20).map((candidate) => candidate.name).join(", ")}.` : "This node has no parameters to set (pin an operation first).");
|
|
288
|
+
const typeText = `${parameter.type} ${parameter.name}`;
|
|
289
|
+
if (SENSITIVE_PARAM.test(typeText)) throw new AgentToolError("NEEDS_USER", "That is a credential or secret: ask the person to set it in the node panel.");
|
|
290
|
+
if (parameter.options && value && !parameter.options.includes(value)) throw new AgentToolError("INVALID_INPUT", `"${field}" must be one of: ${parameter.options.slice(0, 20).join(", ")}.`);
|
|
291
|
+
const { workflow, actions } = store();
|
|
292
|
+
actions.nodes.setNodes(workflow.nodes.map((candidate) => {
|
|
293
|
+
if (candidate.id !== id) return candidate;
|
|
294
|
+
const data = { ...dataOf(candidate) };
|
|
295
|
+
const args = { ...data.args ?? {} };
|
|
296
|
+
args.state = fixedParameterState(args.state ?? {}, params, field, value);
|
|
297
|
+
data.args = args;
|
|
298
|
+
return {
|
|
299
|
+
...candidate,
|
|
300
|
+
data
|
|
301
|
+
};
|
|
302
|
+
}));
|
|
303
|
+
return {
|
|
304
|
+
nodeId: id,
|
|
305
|
+
field,
|
|
306
|
+
cleared: value === "",
|
|
307
|
+
autosaves: autosaves()
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
];
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* One set for the module: the tools read the store at call time. It offers no
|
|
315
|
+
* durable-function nodes; the builder creates its own set with the flag
|
|
316
|
+
* getter (`flow-builder.tsx`).
|
|
317
|
+
*/
|
|
318
|
+
const BUILDER_AGENT_TOOLS = createBuilderAgentTools();
|
|
319
|
+
|
|
320
|
+
export { createBuilderAgentTools };
|