@burdenoff/fluidgrids-fe-sdk 2026.1028.14 → 2026.1028.16

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.
Files changed (42) hide show
  1. package/dist/{ExecutionDetailPage-DBUUJRDA.js → ExecutionDetailPage-ZXR6SFSB.js} +10 -10
  2. package/dist/{ExecutionsListPage-LMDCPI3D.js → ExecutionsListPage-XNUSAOBZ.js} +7 -7
  3. package/dist/{WorkflowBuilder-SY4UJ6C2.js → WorkflowBuilder-V2F4SDF7.js} +11 -12
  4. package/dist/{WorkflowsList-GJF2HTSA.js → WorkflowsList-ABCAYCPF.js} +8 -9
  5. package/dist/{chunk-5BY2LZH3.js → chunk-3E5XIBL5.js} +1 -1
  6. package/dist/{chunk-6EOFGYLJ.js → chunk-3U32Y757.js} +4 -4
  7. package/dist/{chunk-6T5EBO7G.js → chunk-5GD6OXYW.js} +1 -1
  8. package/dist/{chunk-7PBOU7JC.js → chunk-7PP6CRXS.js} +14 -3
  9. package/dist/{chunk-2PC6JUR6.js → chunk-ANAAGEQ5.js} +1 -1
  10. package/dist/{chunk-IAOLBKO3.js → chunk-CQGQV3KM.js} +3 -3
  11. package/dist/{chunk-5KUVIH7Y.js → chunk-FT5UYSAF.js} +3 -3
  12. package/dist/{chunk-7UHXZOZ3.js → chunk-GM4SIYSW.js} +4 -4
  13. package/dist/{chunk-5PSRTFKK.js → chunk-ILNMMFKE.js} +2 -2
  14. package/dist/{chunk-7OJDILWM.js → chunk-LB62TAF7.js} +1 -1
  15. package/dist/{chunk-TWRWHIMY.js → chunk-LCNCS3NU.js} +1 -1
  16. package/dist/{chunk-TEMQVTTJ.js → chunk-NPVUALXY.js} +1 -2
  17. package/dist/{chunk-KWWVBB43.js → chunk-OFZH5IQE.js} +5 -6
  18. package/dist/{chunk-DV7N3UXU.js → chunk-PYFFO7WF.js} +675 -69
  19. package/dist/{chunk-5GTYHWI5.js → chunk-QYT3S636.js} +489 -14
  20. package/dist/{chunk-U5BSQBUC.js → chunk-S5TVQIFY.js} +2 -2
  21. package/dist/{chunk-MXIFE266.js → chunk-TZE55VJT.js} +1144 -55
  22. package/dist/{chunk-BMX4T263.js → chunk-U3GDS3EB.js} +2 -2
  23. package/dist/{chunk-DOPSPCO3.js → chunk-U6KI4AKI.js} +102 -1
  24. package/dist/{chunk-37HLOFQ3.js → chunk-XGKFKKLD.js} +2 -2
  25. package/dist/{chunk-7UTDL7HD.js → chunk-XNOGE3PI.js} +5 -6
  26. package/dist/{chunk-H2YOX3DI.js → chunk-Y42WI45F.js} +3 -3
  27. package/dist/chunk-YJWFHQW6.js +1761 -0
  28. package/dist/{chunk-HKNZ7MVM.js → chunk-YSFEMXZQ.js} +1 -1
  29. package/dist/{chunk-QLBQDRQZ.js → chunk-YYAUPQET.js} +2 -2
  30. package/dist/executions.js +12 -12
  31. package/dist/history.js +4 -4
  32. package/dist/index.d.ts +1096 -11
  33. package/dist/index.js +35 -36
  34. package/dist/nodes.js +2 -2
  35. package/dist/observability.js +6 -7
  36. package/dist/settings.js +6 -7
  37. package/dist/templates.js +10 -11
  38. package/dist/workflow-builder.js +12 -13
  39. package/dist/workflows-list.js +8 -9
  40. package/package.json +2 -1
  41. package/dist/chunk-77NA7TPJ.js +0 -38
  42. package/dist/chunk-S3GSHZAT.js +0 -600
@@ -2,7 +2,7 @@ import { cn as cn$1 } from './chunk-JL7CASN5.js';
2
2
  import { getGlobalStoreClient, createGlobalStoreClient, setGlobalStoreClient, resetGlobalStoreClient } from './chunk-PXIFUMLA.js';
3
3
  import { getFluidGridsConfig, validateTrustedOrigin, resetFluidGridsExecutionState, setFluidGridsConfig, resetFluidGridsConfig } from './chunk-CY6KX4RG.js';
4
4
  import { GetMyNodeInstallationsDocument } from './chunk-JUUYPCFY.js';
5
- import { fetchAllNodeEndpointConfigs, NodeManifestDocument, UpdateWorkflowDefinitionDocument, CreateWorkflowDefinitionDocument, CreateWorkflowVersionDocument, ExecuteStepDocument, TriggerWorkflowDocument, RunFromNodeDocument, ExecutionDetailDocument, WorkflowDefinitionDocument, WorkflowRunDocument } from './chunk-7PBOU7JC.js';
5
+ import { fetchAllNodeEndpointConfigs, NodeManifestDocument, UpdateWorkflowDefinitionDocument, CreateWorkflowDefinitionDocument, CreateWorkflowVersionDocument, ExecuteStepDocument, TriggerWorkflowDocument, RunFromNodeDocument, ExecutionDetailDocument, WorkflowDefinitionDocument, WorkflowRunDocument } from './chunk-7PP6CRXS.js';
6
6
  import { useTr, ENGLISH_FALLBACK_TRANSLATOR, FluidGridsTranslationProvider } from './chunk-UULVIT25.js';
7
7
  import { waitForFluidGridsClient, getFluidGridsClient, getFluidGridsClientSafe, createFluidGridsClient, setFluidGridsClient, resetFluidGridsClient } from './chunk-NTWG3CJX.js';
8
8
  import { CombinedGraphQLErrors, ServerError } from '@apollo/client/errors';
@@ -13,6 +13,7 @@ import { create } from 'zustand';
13
13
  import { produce } from 'immer';
14
14
  import * as React2 from 'react';
15
15
  import { forwardRef, useState, useImperativeHandle, useRef, useEffect, useMemo, createContext, memo, useCallback, useSyncExternalStore, useContext, cloneElement } from 'react';
16
+ import { useOptionalFeatureFlags } from '@burdenoff/fe-libs/shared/feature-flags';
16
17
  import { Textarea, Input, Button, Card, Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator } from '@burdenoff/fe-libs/ui';
17
18
  import { cn } from '@burdenoff/fe-libs/utils';
18
19
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -1217,6 +1218,275 @@ if (typeof window !== "undefined" && import.meta.env?.DEV) {
1217
1218
  window.__fgFlowStore = useFlowStore;
1218
1219
  }
1219
1220
 
1221
+ // src/feature-flags/durable-nodes.ts
1222
+ var DURABLE_FUNCTION_NODE_TYPES = /* @__PURE__ */ new Set([
1223
+ "internal:code-workflow",
1224
+ "internal:wait-for-signal"
1225
+ ]);
1226
+ function isDurableFunctionNodeType(nodeType) {
1227
+ return !!nodeType && DURABLE_FUNCTION_NODE_TYPES.has(nodeType);
1228
+ }
1229
+ function isNodeTypeHiddenFromPalette(nodeType, durableFunctionsEnabled = false) {
1230
+ return !durableFunctionsEnabled && isDurableFunctionNodeType(nodeType);
1231
+ }
1232
+ function filterPaletteNodes(nodes, durableFunctionsEnabled = false) {
1233
+ if (durableFunctionsEnabled) return nodes;
1234
+ if (!nodes.some((node) => isDurableFunctionNodeType(node.type))) return nodes;
1235
+ return nodes.filter((node) => !isDurableFunctionNodeType(node.type));
1236
+ }
1237
+ var FLUIDGRIDS_FLAGS = {
1238
+ /**
1239
+ * Operational kill switch for log stream destinations (webhook, syslog,
1240
+ * Sentry). Defaults on; an admin turning it off hides the Log streaming
1241
+ * settings and the backend rejects destination writes with FEATURE_DISABLED.
1242
+ */
1243
+ logStreams: "fluidgrids.log-streams",
1244
+ /**
1245
+ * Code-first workflows (BOFF-9902): the builder's Code view, Export as
1246
+ * TypeScript / Python and TypeScript import. A rollout gate, not a kill
1247
+ * switch, so it defaults OFF: the controls stay hidden until tenant-svc
1248
+ * evaluates the flag on for the workspace, including when the shell mounts
1249
+ * no FeatureFlagProvider or the evaluation is still loading.
1250
+ */
1251
+ codeFirst: "fluidgrids.code-first",
1252
+ /**
1253
+ * Durable functions (BOFF-9905): the Code Workflow and Wait for Signal
1254
+ * nodes, run history, signals and the source editor. A rollout gate like
1255
+ * `codeFirst`, so it defaults OFF and fails closed. The durable nodes are
1256
+ * shown in the palette only while both this flag and `codeFirst` are on.
1257
+ */
1258
+ durableFunctions: "fluidgrids.durable-functions"
1259
+ };
1260
+ var FLUIDGRIDS_FLAG_DEFAULTS = {
1261
+ [FLUIDGRIDS_FLAGS.logStreams]: true,
1262
+ [FLUIDGRIDS_FLAGS.codeFirst]: false,
1263
+ [FLUIDGRIDS_FLAGS.durableFunctions]: false
1264
+ };
1265
+ var settledEvaluations = /* @__PURE__ */ new WeakMap();
1266
+ function evaluationsUsable(context) {
1267
+ const { evaluations } = context;
1268
+ if (!evaluations) return !context.isLoading;
1269
+ const workspace = context.workspaceId ?? null;
1270
+ const settledFor = settledEvaluations.get(evaluations);
1271
+ if (context.isLoading)
1272
+ return settledFor !== void 0 && settledFor === workspace;
1273
+ if (settledFor === void 0) {
1274
+ settledEvaluations.set(evaluations, workspace);
1275
+ return true;
1276
+ }
1277
+ return settledFor === workspace;
1278
+ }
1279
+ function resolveFluidGridsFlag(context, flag) {
1280
+ const fallback = FLUIDGRIDS_FLAG_DEFAULTS[flag];
1281
+ if (!context) return fallback;
1282
+ if (fallback) {
1283
+ if (context.isLoading) return fallback;
1284
+ const evaluation2 = context.getEvaluation(flag);
1285
+ return evaluation2 ? Boolean(evaluation2.value) : fallback;
1286
+ }
1287
+ if (context.error || !evaluationsUsable(context)) return false;
1288
+ const evaluation = context.getEvaluation(flag);
1289
+ return !!evaluation && !evaluation.errorCode && evaluation.value === true;
1290
+ }
1291
+ function useFluidGridsFlag(flag) {
1292
+ const context = useOptionalFeatureFlags();
1293
+ return useMemo(() => resolveFluidGridsFlag(context, flag), [context, flag]);
1294
+ }
1295
+ function useDurableFunctionNodesEnabled() {
1296
+ const context = useOptionalFeatureFlags();
1297
+ return useMemo(
1298
+ () => resolveFluidGridsFlag(context, FLUIDGRIDS_FLAGS.codeFirst) && resolveFluidGridsFlag(context, FLUIDGRIDS_FLAGS.durableFunctions),
1299
+ [context]
1300
+ );
1301
+ }
1302
+
1303
+ // src/modules/executions/utils/signal-targets.ts
1304
+ function isRecord3(value) {
1305
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1306
+ }
1307
+ function str(value) {
1308
+ return typeof value === "string" && value.trim() ? value : void 0;
1309
+ }
1310
+ function durableInterfaceOf(definitionJson, workflowFn) {
1311
+ if (!isRecord3(definitionJson)) return void 0;
1312
+ const code = definitionJson.code;
1313
+ if (isRecord3(code) && isRecord3(code.exports) && workflowFn) {
1314
+ const workflows = code.exports.workflows;
1315
+ if (isRecord3(workflows)) {
1316
+ const entry = workflows[workflowFn];
1317
+ if (isRecord3(entry) && isRecord3(entry.interface)) return entry.interface;
1318
+ }
1319
+ }
1320
+ return isRecord3(definitionJson.interface) ? definitionJson.interface : void 0;
1321
+ }
1322
+ function declaredSignals(iface) {
1323
+ if (!iface) return { targets: [], openNames: false };
1324
+ const signals = isRecord3(iface.signals) ? iface.signals : {};
1325
+ const targets = Object.keys(signals).sort().map((name) => {
1326
+ const entry = signals[name];
1327
+ const payload = isRecord3(entry) && isRecord3(entry.payload) ? entry.payload : void 0;
1328
+ return payload ? { name, payloadSchema: payload } : { name };
1329
+ });
1330
+ const open = isRecord3(iface.open) && iface.open.signals === true;
1331
+ return { targets, openNames: open };
1332
+ }
1333
+ function nodeStateArgs(node) {
1334
+ if (!isRecord3(node)) return void 0;
1335
+ const root = isRecord3(node.args) ? node.args : void 0;
1336
+ if (root && isRecord3(root.state)) return root.state;
1337
+ const data = isRecord3(node.data) ? node.data : void 0;
1338
+ const mirror = data && isRecord3(data.args) ? data.args : void 0;
1339
+ return mirror && isRecord3(mirror.state) ? mirror.state : void 0;
1340
+ }
1341
+ function definitionNodes(definitionJson) {
1342
+ if (!isRecord3(definitionJson) || !isRecord3(definitionJson.data)) return [];
1343
+ const nodes = definitionJson.data.nodes;
1344
+ return Array.isArray(nodes) ? nodes : [];
1345
+ }
1346
+ function parkedSignalTargets(nodeStates, definitionJson) {
1347
+ const nodes = definitionNodes(definitionJson);
1348
+ const result = [];
1349
+ const seen = /* @__PURE__ */ new Set();
1350
+ for (const state of nodeStates) {
1351
+ if (state.status !== "WAITING" || !isRecord3(state.output)) continue;
1352
+ if (state.output._waiting !== "signal") continue;
1353
+ const name = str(state.output._signalName);
1354
+ if (!name || seen.has(`${state.nodeId}:${name}`)) continue;
1355
+ seen.add(`${state.nodeId}:${name}`);
1356
+ const node = nodes.find(
1357
+ (candidate) => isRecord3(candidate) && candidate.id === state.nodeId
1358
+ );
1359
+ const args = nodeStateArgs(node);
1360
+ const schema = args && isRecord3(args.payloadSchema) ? args.payloadSchema : void 0;
1361
+ result.push(
1362
+ schema ? { name, payloadSchema: schema, nodeId: state.nodeId } : { name, nodeId: state.nodeId }
1363
+ );
1364
+ }
1365
+ return result;
1366
+ }
1367
+ function runSignalTargets(run) {
1368
+ const open = run.status === "RUNNING" || run.status === "WAITING" || run.status === "PENDING";
1369
+ if (!open) return { targets: [], openNames: false };
1370
+ const definition = run.workflow?.definitionJson;
1371
+ if (run.executionKind === "DURABLE_FN") {
1372
+ return declaredSignals(durableInterfaceOf(definition, run.workflowFn));
1373
+ }
1374
+ return {
1375
+ targets: parkedSignalTargets(run.nodeStates ?? [], definition),
1376
+ openNames: false
1377
+ };
1378
+ }
1379
+ function canSignalRun(targets) {
1380
+ return targets.targets.length > 0 || targets.openNames;
1381
+ }
1382
+ function fieldOf(name, schema, required) {
1383
+ if (!isRecord3(schema)) return null;
1384
+ const title = str(schema.title) ?? name;
1385
+ const description = str(schema.description);
1386
+ if (Array.isArray(schema.enum)) {
1387
+ const choices = schema.enum.filter(
1388
+ (value) => typeof value === "string"
1389
+ );
1390
+ if (choices.length !== schema.enum.length || !choices.length) return null;
1391
+ return { name, kind: "enum", title, required, choices, description };
1392
+ }
1393
+ const type = schema.type;
1394
+ if (type === "string" || type === "number" || type === "integer" || type === "boolean") {
1395
+ return { name, kind: type, title, required, description };
1396
+ }
1397
+ return null;
1398
+ }
1399
+ function formFieldsOf(schema) {
1400
+ if (!schema || schema.type !== "object" || !isRecord3(schema.properties))
1401
+ return null;
1402
+ const required = new Set(
1403
+ Array.isArray(schema.required) ? schema.required.filter(
1404
+ (value) => typeof value === "string"
1405
+ ) : []
1406
+ );
1407
+ const fields = [];
1408
+ for (const [name, property] of Object.entries(schema.properties)) {
1409
+ const field = fieldOf(name, property, required.has(name));
1410
+ if (!field) return null;
1411
+ fields.push(field);
1412
+ }
1413
+ return fields.length ? fields : null;
1414
+ }
1415
+ var FIELD_PREFIX = "payload.";
1416
+ function signalPayloadCard(schema) {
1417
+ const fields = formFieldsOf(schema);
1418
+ if (!fields) return null;
1419
+ const body = fields.flatMap((field) => {
1420
+ const id = `${FIELD_PREFIX}${field.name}`;
1421
+ const label = field.required ? `${field.title} *` : field.title;
1422
+ const common = { id, label, isRequired: field.required };
1423
+ const input = field.kind === "boolean" ? {
1424
+ ...common,
1425
+ type: "Input.Toggle",
1426
+ title: field.title,
1427
+ valueOn: "true",
1428
+ valueOff: "false"
1429
+ } : field.kind === "enum" ? {
1430
+ ...common,
1431
+ type: "Input.ChoiceSet",
1432
+ style: "compact",
1433
+ choices: (field.choices ?? []).map((choice) => ({
1434
+ title: choice,
1435
+ value: choice
1436
+ }))
1437
+ } : field.kind === "number" || field.kind === "integer" ? { ...common, type: "Input.Number" } : { ...common, type: "Input.Text" };
1438
+ return field.description ? [
1439
+ input,
1440
+ {
1441
+ type: "TextBlock",
1442
+ text: field.description,
1443
+ isSubtle: true,
1444
+ size: "Small",
1445
+ wrap: true,
1446
+ spacing: "None"
1447
+ }
1448
+ ] : [input];
1449
+ });
1450
+ return {
1451
+ type: "AdaptiveCard",
1452
+ version: "1.5",
1453
+ body
1454
+ };
1455
+ }
1456
+ function payloadFromCardValues(schema, values) {
1457
+ const fields = formFieldsOf(schema) ?? [];
1458
+ const payload = {};
1459
+ for (const field of fields) {
1460
+ const raw = values[`${FIELD_PREFIX}${field.name}`];
1461
+ if (raw === void 0 || raw === null || raw === "") {
1462
+ if (field.kind === "boolean") payload[field.name] = false;
1463
+ continue;
1464
+ }
1465
+ if (field.kind === "boolean") {
1466
+ payload[field.name] = raw === true || raw === "true";
1467
+ } else if (field.kind === "number" || field.kind === "integer") {
1468
+ const value = typeof raw === "number" ? raw : Number(raw);
1469
+ if (!Number.isFinite(value) || field.kind === "integer" && !Number.isInteger(value)) {
1470
+ return { error: `${field.title}: enter a valid number` };
1471
+ }
1472
+ payload[field.name] = value;
1473
+ } else {
1474
+ payload[field.name] = String(raw);
1475
+ }
1476
+ }
1477
+ return { payload };
1478
+ }
1479
+ function parseRawSignalPayload(text) {
1480
+ if (!text.trim()) return { payload: null };
1481
+ try {
1482
+ return { payload: JSON.parse(text) };
1483
+ } catch (err) {
1484
+ return {
1485
+ error: err instanceof Error ? err.message : "The payload is not JSON"
1486
+ };
1487
+ }
1488
+ }
1489
+
1220
1490
  // src/modules/ui-blocks/registry.ts
1221
1491
  var registry = /* @__PURE__ */ new Map();
1222
1492
  function registerCustomBlock(name, component) {
@@ -1233,7 +1503,7 @@ function listCustomBlocks() {
1233
1503
  }
1234
1504
 
1235
1505
  // src/modules/ui-blocks/parse.ts
1236
- function isRecord3(value) {
1506
+ function isRecord4(value) {
1237
1507
  return typeof value === "object" && value !== null && !Array.isArray(value);
1238
1508
  }
1239
1509
  function humanizeFieldName(name) {
@@ -1244,7 +1514,7 @@ function synthesizeCardFromInputFields(inputFields) {
1244
1514
  if (names.length === 0) return null;
1245
1515
  const body = [];
1246
1516
  for (const name of names) {
1247
- const field = isRecord3(inputFields[name]) ? inputFields[name] : {};
1517
+ const field = isRecord4(inputFields[name]) ? inputFields[name] : {};
1248
1518
  const description = typeof field.description === "string" ? field.description : void 0;
1249
1519
  const required = field.required === true;
1250
1520
  const secret = field.secret === true;
@@ -1275,9 +1545,9 @@ function synthesizeCardFromInputFields(inputFields) {
1275
1545
  }
1276
1546
  function secretFieldNames(inputFields) {
1277
1547
  const names = /* @__PURE__ */ new Set();
1278
- if (!isRecord3(inputFields)) return names;
1548
+ if (!isRecord4(inputFields)) return names;
1279
1549
  for (const [name, field] of Object.entries(inputFields)) {
1280
- if (isRecord3(field) && field.secret === true) names.add(name);
1550
+ if (isRecord4(field) && field.secret === true) names.add(name);
1281
1551
  }
1282
1552
  return names;
1283
1553
  }
@@ -1290,7 +1560,7 @@ function maskSecretInputs(card, secrets) {
1290
1560
  if (secrets.size === 0) return card;
1291
1561
  const visit = (value) => {
1292
1562
  if (Array.isArray(value)) return value.map(visit);
1293
- if (!isRecord3(value)) return value;
1563
+ if (!isRecord4(value)) return value;
1294
1564
  const copy = {};
1295
1565
  for (const [key, nested] of Object.entries(value))
1296
1566
  copy[key] = visit(nested);
@@ -1304,7 +1574,7 @@ function maskSecretInputs(card, secrets) {
1304
1574
  return visit(card);
1305
1575
  }
1306
1576
  function validateUiSpec(raw) {
1307
- if (!isRecord3(raw)) return "ui is not an object";
1577
+ if (!isRecord4(raw)) return "ui is not an object";
1308
1578
  if (raw.version !== 1)
1309
1579
  return `unsupported ui.version: ${String(raw.version)}`;
1310
1580
  if (!Array.isArray(raw.blocks) || raw.blocks.length === 0) {
@@ -1313,7 +1583,7 @@ function validateUiSpec(raw) {
1313
1583
  const seenIds = /* @__PURE__ */ new Set();
1314
1584
  const blocks = [];
1315
1585
  for (const [index, rawBlock] of raw.blocks.entries()) {
1316
- if (!isRecord3(rawBlock)) return `ui.blocks[${index}] is not an object`;
1586
+ if (!isRecord4(rawBlock)) return `ui.blocks[${index}] is not an object`;
1317
1587
  const id = rawBlock.id;
1318
1588
  if (typeof id !== "string" || id.length === 0) {
1319
1589
  return `ui.blocks[${index}] is missing a non-empty string id`;
@@ -1321,7 +1591,7 @@ function validateUiSpec(raw) {
1321
1591
  if (seenIds.has(id)) return `ui.blocks has duplicate id "${id}"`;
1322
1592
  seenIds.add(id);
1323
1593
  if (rawBlock.type === "adaptive_card") {
1324
- if (!isRecord3(rawBlock.card)) {
1594
+ if (!isRecord4(rawBlock.card)) {
1325
1595
  return `ui.blocks[${index}] ("${id}") has no card object`;
1326
1596
  }
1327
1597
  blocks.push({ id, type: "adaptive_card", card: rawBlock.card });
@@ -1333,7 +1603,7 @@ function validateUiSpec(raw) {
1333
1603
  id,
1334
1604
  type: "custom",
1335
1605
  component: rawBlock.component,
1336
- props: isRecord3(rawBlock.props) ? rawBlock.props : void 0
1606
+ props: isRecord4(rawBlock.props) ? rawBlock.props : void 0
1337
1607
  });
1338
1608
  } else {
1339
1609
  return `ui.blocks[${index}] ("${id}") has unknown type "${String(rawBlock.type)}"`;
@@ -1360,7 +1630,7 @@ function resolveUiSpec(operation) {
1360
1630
  `ui-blocks: invalid ui declaration on operation "${operation.name ?? "?"}" (${result}); falling back to adaptive_card`
1361
1631
  );
1362
1632
  }
1363
- if (isRecord3(operation.adaptive_card)) {
1633
+ if (isRecord4(operation.adaptive_card)) {
1364
1634
  return {
1365
1635
  spec: {
1366
1636
  version: 1,
@@ -1375,7 +1645,7 @@ function resolveUiSpec(operation) {
1375
1645
  synthesized: true
1376
1646
  };
1377
1647
  }
1378
- if (isRecord3(operation.input_fields)) {
1648
+ if (isRecord4(operation.input_fields)) {
1379
1649
  const card = synthesizeCardFromInputFields(operation.input_fields);
1380
1650
  if (card) {
1381
1651
  return {
@@ -1390,17 +1660,17 @@ function resolveUiSpec(operation) {
1390
1660
  return null;
1391
1661
  }
1392
1662
  function isSubmitAction(action) {
1393
- return isRecord3(action) && action.type === "Action.Submit";
1663
+ return isRecord4(action) && action.type === "Action.Submit";
1394
1664
  }
1395
1665
  function stripFromActions(actions) {
1396
1666
  return actions.filter((action) => !isSubmitAction(action)).map(
1397
- (action) => isRecord3(action) && isRecord3(action.card) ? { ...action, card: stripSubmitActions(action.card) } : action
1667
+ (action) => isRecord4(action) && isRecord4(action.card) ? { ...action, card: stripSubmitActions(action.card) } : action
1398
1668
  );
1399
1669
  }
1400
1670
  function stripFromElements(elements) {
1401
1671
  const result = [];
1402
1672
  for (const element of elements) {
1403
- if (!isRecord3(element)) {
1673
+ if (!isRecord4(element)) {
1404
1674
  result.push(element);
1405
1675
  continue;
1406
1676
  }
@@ -1415,7 +1685,7 @@ function stripFromElements(elements) {
1415
1685
  }
1416
1686
  if (Array.isArray(el.columns)) {
1417
1687
  el.columns = el.columns.map(
1418
- (column) => isRecord3(column) && Array.isArray(column.items) ? { ...column, items: stripFromElements(column.items) } : column
1688
+ (column) => isRecord4(column) && Array.isArray(column.items) ? { ...column, items: stripFromElements(column.items) } : column
1419
1689
  );
1420
1690
  }
1421
1691
  result.push(el);
@@ -1436,20 +1706,20 @@ function stripSubmitActions(card) {
1436
1706
  // src/builder/components/lib/expression-preview.ts
1437
1707
  var PURE_EXPRESSION_REGEX = /^\{\{(.*)\}\}$/s;
1438
1708
  var PURE_LEGACY_REGEX = /^\$\{(.*)\}$/s;
1439
- function containsExpressionSyntax(str) {
1440
- return typeof str === "string" && str.includes("{{");
1709
+ function containsExpressionSyntax(str3) {
1710
+ return typeof str3 === "string" && str3.includes("{{");
1441
1711
  }
1442
- function findEmbeddedExpressions(str) {
1712
+ function findEmbeddedExpressions(str3) {
1443
1713
  const matches2 = [];
1444
1714
  let searchFrom = 0;
1445
- while (searchFrom < str.length) {
1446
- const start = str.indexOf("{{", searchFrom);
1715
+ while (searchFrom < str3.length) {
1716
+ const start = str3.indexOf("{{", searchFrom);
1447
1717
  if (start === -1) break;
1448
- const end = str.indexOf("}}", start + 2);
1718
+ const end = str3.indexOf("}}", start + 2);
1449
1719
  if (end === -1) break;
1450
1720
  matches2.push({
1451
- full: str.slice(start, end + 2),
1452
- expression: str.slice(start + 2, end).trim()
1721
+ full: str3.slice(start, end + 2),
1722
+ expression: str3.slice(start + 2, end).trim()
1453
1723
  });
1454
1724
  searchFrom = end + 2;
1455
1725
  }
@@ -1539,9 +1809,9 @@ function stringifyForInterpolation(value) {
1539
1809
  if (typeof value === "object") return JSON.stringify(value);
1540
1810
  return String(value);
1541
1811
  }
1542
- function previewNewSyntax(str, scope) {
1812
+ function previewNewSyntax(str3, scope) {
1543
1813
  const sandbox = buildExpressionSandbox(scope);
1544
- const pure = PURE_EXPRESSION_REGEX.exec(str);
1814
+ const pure = PURE_EXPRESSION_REGEX.exec(str3);
1545
1815
  try {
1546
1816
  if (pure) {
1547
1817
  const expression = pure[1]?.trim();
@@ -1550,8 +1820,8 @@ function previewNewSyntax(str, scope) {
1550
1820
  }
1551
1821
  return { isTemplate: true, value: evaluateBare(expression, sandbox) };
1552
1822
  }
1553
- let result = str;
1554
- for (const match of findEmbeddedExpressions(str)) {
1823
+ let result = str3;
1824
+ for (const match of findEmbeddedExpressions(str3)) {
1555
1825
  if (!match.expression) continue;
1556
1826
  const value = evaluateBare(match.expression, sandbox);
1557
1827
  result = result.replace(match.full, stringifyForInterpolation(value));
@@ -1564,7 +1834,7 @@ function previewNewSyntax(str, scope) {
1564
1834
  };
1565
1835
  }
1566
1836
  }
1567
- function previewLegacySyntax(str, scope) {
1837
+ function previewLegacySyntax(str3, scope) {
1568
1838
  const sandbox = {
1569
1839
  ...SAFE_GLOBALS,
1570
1840
  output: scope.input,
@@ -1581,19 +1851,19 @@ function previewLegacySyntax(str, scope) {
1581
1851
  version: scope.version ?? "1.0.0"
1582
1852
  }
1583
1853
  };
1584
- const pure = PURE_LEGACY_REGEX.exec(str);
1854
+ const pure = PURE_LEGACY_REGEX.exec(str3);
1585
1855
  try {
1586
1856
  if (pure) {
1587
1857
  const expression = pure[1]?.trim();
1588
1858
  if (!expression) return { isTemplate: true, error: "Empty expression" };
1589
1859
  return { isTemplate: true, value: evaluateBare(expression, sandbox) };
1590
1860
  }
1591
- if (!str.includes("${")) {
1861
+ if (!str3.includes("${")) {
1592
1862
  return { isTemplate: false };
1593
1863
  }
1594
- let result = str;
1864
+ let result = str3;
1595
1865
  const templateRegex = /\$\{([^}]+)\}/g;
1596
- for (const match of str.matchAll(templateRegex)) {
1866
+ for (const match of str3.matchAll(templateRegex)) {
1597
1867
  const expression = match[1]?.trim();
1598
1868
  if (!expression) continue;
1599
1869
  const value = evaluateBare(expression, sandbox);
@@ -1607,14 +1877,14 @@ function previewLegacySyntax(str, scope) {
1607
1877
  };
1608
1878
  }
1609
1879
  }
1610
- function evaluateExpressionPreview(str, scope) {
1611
- if (typeof str !== "string" || str.trim() === "") {
1880
+ function evaluateExpressionPreview(str3, scope) {
1881
+ if (typeof str3 !== "string" || str3.trim() === "") {
1612
1882
  return { isTemplate: false };
1613
1883
  }
1614
- if (containsExpressionSyntax(str)) {
1615
- return previewNewSyntax(str, scope);
1884
+ if (containsExpressionSyntax(str3)) {
1885
+ return previewNewSyntax(str3, scope);
1616
1886
  }
1617
- return previewLegacySyntax(str, scope);
1887
+ return previewLegacySyntax(str3, scope);
1618
1888
  }
1619
1889
  var EXPRESSION_BUILTINS = [
1620
1890
  { insert: "$json", label: "$json", description: "Current item's data" },
@@ -3368,6 +3638,8 @@ var FLUIDGRIDS_PERMISSIONS = {
3368
3638
  WORKFLOW_RUN_LIST: "workflow-run:list",
3369
3639
  WORKFLOW_RUN_READ: "workflow-run:read",
3370
3640
  WORKFLOW_RUN_EXECUTE: "workflow-run:execute",
3641
+ /** Terminating a durable-function run (terminateWorkflowRun, BOFF-9905). */
3642
+ WORKFLOW_RUN_DELETE: "workflow-run:delete",
3371
3643
  // Node resources
3372
3644
  NODE_LIST: "node:list",
3373
3645
  NODE_READ: "node:read",
@@ -5069,14 +5341,21 @@ function isDynamicSpec(spec) {
5069
5341
  return !!spec && !Array.isArray(spec) && typeof spec.fromStateRecord === "string";
5070
5342
  }
5071
5343
  var DEFAULT_HANDLES = [{ id: "source", label: "" }];
5072
- function resolveOutputHandles(data) {
5344
+ var BUILTIN_OUTPUT_HANDLES = {
5345
+ "internal:wait-for-signal": [
5346
+ { id: "received", label: "Received", tone: "success" },
5347
+ { id: "timedOut", label: "Timed out", tone: "warning" }
5348
+ ]
5349
+ };
5350
+ function resolveOutputHandles(data, nodeType) {
5073
5351
  const nodeData = data?.nodeData;
5074
5352
  const operationsBlob = Array.isArray(nodeData?.operations) ? void 0 : nodeData?.operations;
5075
5353
  const operationList = Array.isArray(nodeData?.operations) ? nodeData.operations : operationsBlob?.operations ?? [];
5076
5354
  const operationName = typeof data?.operation_name === "string" ? data.operation_name : void 0;
5077
5355
  const operationSpec = operationName ? operationList.find((op) => op?.name === operationName)?.outputHandles : void 0;
5078
5356
  const spec = operationSpec ?? nodeData?.outputHandles ?? operationsBlob?.outputHandles;
5079
- if (!spec) return DEFAULT_HANDLES;
5357
+ if (!spec)
5358
+ return nodeType && BUILTIN_OUTPUT_HANDLES[nodeType] || DEFAULT_HANDLES;
5080
5359
  if (isDynamicSpec(spec)) {
5081
5360
  const args = data?.args;
5082
5361
  const record2 = args?.state?.[spec.fromStateRecord] ?? data?.[spec.fromStateRecord] ?? {};
@@ -5442,6 +5721,323 @@ function LogicNodeCard({
5442
5721
  );
5443
5722
  }
5444
5723
 
5724
+ // src/builder/components/ndv/code-editor-diagnostics.ts
5725
+ function editorSeverity(value) {
5726
+ const lower = value.toLowerCase();
5727
+ if (lower.startsWith("warn")) return "warning";
5728
+ if (lower === "info" || lower === "hint" || lower === "suggestion")
5729
+ return "info";
5730
+ return "error";
5731
+ }
5732
+ function lineStarts(text) {
5733
+ const starts = [0];
5734
+ for (let i = 0; i < text.length; i += 1) {
5735
+ if (text.charCodeAt(i) === 10) starts.push(i + 1);
5736
+ }
5737
+ return starts;
5738
+ }
5739
+ function toCodeMirrorDiagnostics(text, diagnostics) {
5740
+ const starts = lineStarts(text);
5741
+ return diagnostics.map((diagnostic) => {
5742
+ const lineIndex = Math.min(
5743
+ Math.max((diagnostic.line ?? 1) - 1, 0),
5744
+ starts.length - 1
5745
+ );
5746
+ const lineStart = starts[lineIndex];
5747
+ const lineEnd = lineIndex + 1 < starts.length ? starts[lineIndex + 1] - 1 : text.length;
5748
+ let from = lineStart;
5749
+ let to = lineEnd;
5750
+ if (diagnostic.column && diagnostic.column > 0) {
5751
+ from = Math.min(lineStart + diagnostic.column - 1, lineEnd);
5752
+ to = from;
5753
+ while (to < lineEnd && /[\w$]/.test(text.charAt(to))) to += 1;
5754
+ if (to === from) to = Math.min(from + 1, lineEnd);
5755
+ }
5756
+ const message = diagnostic.code ? `${diagnostic.code}: ${diagnostic.message}` : diagnostic.message;
5757
+ return { from, to, severity: diagnostic.severity, message };
5758
+ });
5759
+ }
5760
+
5761
+ // src/builder/components/code-workflow/code-workflow-state.ts
5762
+ var CODE_WORKFLOW_NODE_TYPE = "internal:code-workflow";
5763
+ var WAIT_FOR_SIGNAL_NODE_TYPE = "internal:wait-for-signal";
5764
+ function isRecord5(value) {
5765
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5766
+ }
5767
+ function str2(value) {
5768
+ return typeof value === "string" && value.trim() ? value : void 0;
5769
+ }
5770
+ function readCodeWorkflowState(state) {
5771
+ const s = isRecord5(state) ? state : {};
5772
+ const waitForCompletion = s.waitForCompletion !== false;
5773
+ const policy = s.parentClosePolicy;
5774
+ return {
5775
+ workflowFn: str2(s.workflowFn),
5776
+ taskQueue: str2(s.taskQueue) ?? "managed",
5777
+ waitForCompletion,
5778
+ parentClosePolicy: policy === "TERMINATE" || policy === "ABANDON" || policy === "REQUEST_CANCEL" ? policy : waitForCompletion ? "TERMINATE" : "ABANDON",
5779
+ timeout: typeof s.timeout === "number" && s.timeout > 0 ? s.timeout : 0
5780
+ };
5781
+ }
5782
+ function readSignalName(state) {
5783
+ return isRecord5(state) ? str2(state.signalName) : void 0;
5784
+ }
5785
+ function typeLabel(schema) {
5786
+ if (!isRecord5(schema)) return "any";
5787
+ if (Array.isArray(schema.enum)) return schema.enum.map(String).join(" | ");
5788
+ if (Array.isArray(schema.type)) return schema.type.map(String).join(" | ");
5789
+ if (schema.type === "array") return `${typeLabel(schema.items)}[]`;
5790
+ return typeof schema.type === "string" ? schema.type : "any";
5791
+ }
5792
+ function interfaceFields(schema) {
5793
+ if (!isRecord5(schema) || !isRecord5(schema.properties)) return [];
5794
+ const required = new Set(
5795
+ Array.isArray(schema.required) ? schema.required.map(String) : []
5796
+ );
5797
+ return Object.entries(schema.properties).map(([name, property]) => ({
5798
+ name,
5799
+ type: typeLabel(property),
5800
+ required: required.has(name),
5801
+ description: isRecord5(property) ? str2(property.description) : void 0
5802
+ }));
5803
+ }
5804
+ function interfaceHandlers(iface) {
5805
+ const of = (key) => isRecord5(iface) && isRecord5(iface[key]) ? Object.keys(iface[key]).sort() : [];
5806
+ return {
5807
+ signals: of("signals"),
5808
+ queries: of("queries"),
5809
+ updates: of("updates")
5810
+ };
5811
+ }
5812
+ function childRunIdOf(nodeStates, nodeId) {
5813
+ const states = nodeStates.filter((state) => state.nodeId === nodeId);
5814
+ for (let i = states.length - 1; i >= 0; i -= 1) {
5815
+ const state = states[i];
5816
+ const fromColumn = str2(state.childRunId);
5817
+ if (fromColumn) return fromColumn;
5818
+ if (isRecord5(state.output)) {
5819
+ const fromOutput = str2(state.output._childRunId);
5820
+ if (fromOutput) return fromOutput;
5821
+ }
5822
+ }
5823
+ return void 0;
5824
+ }
5825
+ function sourceLanguageOf(path) {
5826
+ if (/\.(ts|tsx|mts|cts)$/.test(path)) return "typescript";
5827
+ if (/\.py$/.test(path)) return "python";
5828
+ if (/\.json$/.test(path)) return "json";
5829
+ return "text";
5830
+ }
5831
+ function isEditableSourcePath(path) {
5832
+ if (path.startsWith(".fluidgrids/")) return false;
5833
+ const language = sourceLanguageOf(path);
5834
+ return language === "typescript" || language === "json";
5835
+ }
5836
+ function projectLanguage(files) {
5837
+ return files.some(
5838
+ (file) => file.path.startsWith("workflows/") && file.path.endsWith(".py")
5839
+ ) ? "python" : "typescript";
5840
+ }
5841
+ function changedSourceFiles(loaded, current) {
5842
+ return loaded.filter((file) => {
5843
+ const now = current[file.path];
5844
+ return now !== void 0 && now !== file.content;
5845
+ }).map((file) => ({ path: file.path, content: current[file.path] })).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
5846
+ }
5847
+ function defaultSourcePath(files, entry) {
5848
+ if (entry && files.some((file) => file.path === entry)) return entry;
5849
+ return files.find(
5850
+ (file) => file.path.startsWith("workflows/") && isEditableSourcePath(file.path)
5851
+ )?.path ?? files[0]?.path;
5852
+ }
5853
+ function diagnosticsByPath(diagnostics) {
5854
+ const result = /* @__PURE__ */ new Map();
5855
+ for (const diagnostic of diagnostics) {
5856
+ const path = diagnostic.path?.replace(/^\.\//, "") ?? "";
5857
+ const list = result.get(path) ?? [];
5858
+ list.push({
5859
+ line: diagnostic.line,
5860
+ column: diagnostic.column,
5861
+ severity: editorSeverity(diagnostic.severity),
5862
+ code: diagnostic.code,
5863
+ message: diagnostic.message
5864
+ });
5865
+ result.set(path, list);
5866
+ }
5867
+ return result;
5868
+ }
5869
+ var definitions = /* @__PURE__ */ new Map();
5870
+ function loadDefinitionJson(workflowKey, version) {
5871
+ const cacheKey = `${workflowKey}\0${version}`;
5872
+ const cached = definitions.get(cacheKey);
5873
+ if (cached) return cached;
5874
+ const client = getFluidGridsClientSafe();
5875
+ if (!client) return Promise.resolve(void 0);
5876
+ const pending = client.query({
5877
+ query: WorkflowDefinitionDocument,
5878
+ variables: { workflowKey, version },
5879
+ fetchPolicy: "cache-first"
5880
+ }).then((result) => {
5881
+ throwIfResultError(result);
5882
+ return result.data?.workflowDefinition?.definitionJson;
5883
+ }).catch((err) => {
5884
+ definitions.delete(cacheKey);
5885
+ throw err;
5886
+ });
5887
+ definitions.set(cacheKey, pending);
5888
+ return pending;
5889
+ }
5890
+ function clearCodeWorkflowDefinitionCache() {
5891
+ definitions.clear();
5892
+ }
5893
+ function useCodeWorkflowInterface(workflowFn, enabled) {
5894
+ const workflowKey = useFlowStore((s) => s.workflow.workflowKey);
5895
+ const version = useFlowStore((s) => s.workflow.version);
5896
+ const [read, setRead] = useState({ iface: void 0, loading: false, error: null });
5897
+ const [attempt, setAttempt] = useState(0);
5898
+ const retry = useCallback(() => setAttempt((n) => n + 1), []);
5899
+ useEffect(() => {
5900
+ if (!enabled || !workflowKey || !version) {
5901
+ setRead({ iface: void 0, loading: false, error: null });
5902
+ return;
5903
+ }
5904
+ let cancelled = false;
5905
+ setRead({ iface: void 0, loading: true, error: null });
5906
+ loadDefinitionJson(workflowKey, version).then((definitionJson) => {
5907
+ if (!cancelled)
5908
+ setRead({
5909
+ iface: durableInterfaceOf(definitionJson, workflowFn),
5910
+ loading: false,
5911
+ error: null
5912
+ });
5913
+ }).catch((err) => {
5914
+ if (!cancelled)
5915
+ setRead({
5916
+ iface: void 0,
5917
+ loading: false,
5918
+ error: describeOperationError(err)
5919
+ });
5920
+ });
5921
+ return () => {
5922
+ cancelled = true;
5923
+ };
5924
+ }, [enabled, workflowKey, version, workflowFn, attempt]);
5925
+ return { ...read, retry };
5926
+ }
5927
+ var MAX_FIELDS = 4;
5928
+ function FieldList({ label, names }) {
5929
+ if (!names.length) return null;
5930
+ const shown = names.slice(0, MAX_FIELDS);
5931
+ const more = names.length - shown.length;
5932
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-baseline gap-1.5", children: [
5933
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
5934
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 truncate font-mono text-[11px] text-foreground/80", children: [
5935
+ shown.join(", "),
5936
+ more > 0 ? ` +${more}` : ""
5937
+ ] })
5938
+ ] });
5939
+ }
5940
+ function CodeWorkflowCardBody({
5941
+ state,
5942
+ iface,
5943
+ interfaceStatus = "ready"
5944
+ }) {
5945
+ const tr = useTr();
5946
+ const inputs = interfaceFields(iface?.input).map((field) => field.name);
5947
+ const outputs = interfaceFields(iface?.output).map((field) => field.name);
5948
+ const { signals } = interfaceHandlers(iface);
5949
+ return /* @__PURE__ */ jsxs(
5950
+ "div",
5951
+ {
5952
+ className: "space-y-1.5 rounded-b-xl border-t border-border/60 px-3 pb-3 pt-2.5",
5953
+ "data-testid": "code-workflow-card-body",
5954
+ children: [
5955
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
5956
+ /* @__PURE__ */ jsx(
5957
+ Icon,
5958
+ {
5959
+ icon: "mdi:function-variant",
5960
+ className: "size-3.5 text-muted-foreground"
5961
+ }
5962
+ ),
5963
+ /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-xs font-medium text-foreground", children: state.workflowFn ?? tr(
5964
+ "fluidgrids.builder.codeWorkflow.card.noFunction",
5965
+ "No function selected"
5966
+ ) })
5967
+ ] }),
5968
+ interfaceStatus === "loading" && /* @__PURE__ */ jsx(
5969
+ "div",
5970
+ {
5971
+ className: "h-3 w-2/3 animate-pulse rounded bg-muted",
5972
+ role: "status",
5973
+ "aria-label": tr(
5974
+ "fluidgrids.builder.codeWorkflow.card.interfaceLoading",
5975
+ "Loading the function's interface"
5976
+ ),
5977
+ "data-testid": "code-workflow-card-interface-loading"
5978
+ }
5979
+ ),
5980
+ interfaceStatus === "error" && /* @__PURE__ */ jsx(
5981
+ "p",
5982
+ {
5983
+ className: "text-[10px] text-muted-foreground",
5984
+ "data-testid": "code-workflow-card-interface-error",
5985
+ children: tr(
5986
+ "fluidgrids.builder.codeWorkflow.card.interfaceError",
5987
+ "Could not load the function's interface"
5988
+ )
5989
+ }
5990
+ ),
5991
+ /* @__PURE__ */ jsx(
5992
+ FieldList,
5993
+ {
5994
+ label: tr("fluidgrids.builder.codeWorkflow.card.inputs", "In"),
5995
+ names: inputs
5996
+ }
5997
+ ),
5998
+ /* @__PURE__ */ jsx(
5999
+ FieldList,
6000
+ {
6001
+ label: tr("fluidgrids.builder.codeWorkflow.card.outputs", "Out"),
6002
+ names: outputs
6003
+ }
6004
+ ),
6005
+ /* @__PURE__ */ jsx(
6006
+ FieldList,
6007
+ {
6008
+ label: tr("fluidgrids.builder.codeWorkflow.card.signals", "Signals"),
6009
+ names: signals
6010
+ }
6011
+ ),
6012
+ /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground", children: state.waitForCompletion ? tr(
6013
+ "fluidgrids.builder.codeWorkflow.card.waits",
6014
+ "Waits for the function \xB7 {{queue}}",
6015
+ { queue: state.taskQueue }
6016
+ ) : tr(
6017
+ "fluidgrids.builder.codeWorkflow.card.fireAndForget",
6018
+ "Starts the function and continues \xB7 {{queue}}",
6019
+ { queue: state.taskQueue }
6020
+ ) })
6021
+ ]
6022
+ }
6023
+ );
6024
+ }
6025
+ function CodeWorkflowCardSection({
6026
+ args,
6027
+ durableEnabled
6028
+ }) {
6029
+ const state = readCodeWorkflowState(args);
6030
+ const read = useCodeWorkflowInterface(state.workflowFn, durableEnabled);
6031
+ return /* @__PURE__ */ jsx(
6032
+ CodeWorkflowCardBody,
6033
+ {
6034
+ state,
6035
+ iface: read.iface,
6036
+ interfaceStatus: read.loading ? "loading" : read.error ? "error" : "ready"
6037
+ }
6038
+ );
6039
+ }
6040
+
5445
6041
  // src/builder/lib/sticky-notes.ts
5446
6042
  function isStickyNode(node) {
5447
6043
  return node?.type === STICKY_NOTE_TYPE;
@@ -5475,11 +6071,11 @@ function notifyWorkflowSaved(workflowKey) {
5475
6071
  }
5476
6072
 
5477
6073
  // src/builder/lib/display-options.ts
5478
- function isRecord4(value) {
6074
+ function isRecord6(value) {
5479
6075
  return typeof value === "object" && value !== null && !Array.isArray(value);
5480
6076
  }
5481
6077
  function readRuleSet(value) {
5482
- if (!isRecord4(value)) return void 0;
6078
+ if (!isRecord6(value)) return void 0;
5483
6079
  const rules = {};
5484
6080
  for (const [key, allowed] of Object.entries(value)) {
5485
6081
  if (Array.isArray(allowed)) rules[key] = allowed;
@@ -5488,8 +6084,8 @@ function readRuleSet(value) {
5488
6084
  return Object.keys(rules).length > 0 ? rules : void 0;
5489
6085
  }
5490
6086
  function readDisplayOptions(spec) {
5491
- const raw = isRecord4(spec) ? spec.displayOptions : void 0;
5492
- if (!isRecord4(raw)) return void 0;
6087
+ const raw = isRecord6(spec) ? spec.displayOptions : void 0;
6088
+ if (!isRecord6(raw)) return void 0;
5493
6089
  const show = readRuleSet(raw.show);
5494
6090
  const hide = readRuleSet(raw.hide);
5495
6091
  if (!show && !hide) return void 0;
@@ -5502,7 +6098,7 @@ function matches(current, allowed) {
5502
6098
  );
5503
6099
  }
5504
6100
  function isParamVisible(spec, values, defaults = {}) {
5505
- const options = isRecord4(spec) ? readDisplayOptions(spec) ?? (isRecord4(spec.show) || isRecord4(spec.hide) ? readDisplayOptions({ displayOptions: spec }) : void 0) : void 0;
6101
+ const options = isRecord6(spec) ? readDisplayOptions(spec) ?? (isRecord6(spec.show) || isRecord6(spec.hide) ? readDisplayOptions({ displayOptions: spec }) : void 0) : void 0;
5506
6102
  if (!options) return true;
5507
6103
  const valueOf = (key) => values[key] === void 0 ? defaults[key] : values[key];
5508
6104
  if (options.show) {
@@ -5522,7 +6118,7 @@ function isParamVisible(spec, values, defaults = {}) {
5522
6118
  function defaultsOf(fields) {
5523
6119
  const defaults = {};
5524
6120
  for (const [name, spec] of Object.entries(fields)) {
5525
- if (isRecord4(spec) && spec.default !== void 0)
6121
+ if (isRecord6(spec) && spec.default !== void 0)
5526
6122
  defaults[name] = spec.default;
5527
6123
  }
5528
6124
  return defaults;
@@ -5533,17 +6129,17 @@ function dropHiddenParameters(state, fields, mappedFields = /* @__PURE__ */ new
5533
6129
  let next;
5534
6130
  const ensure = () => next ??= { ...state };
5535
6131
  for (const [name, spec] of Object.entries(fields)) {
5536
- if (!isRecord4(spec)) continue;
6132
+ if (!isRecord6(spec)) continue;
5537
6133
  if (!mappedFields.has(name) && Object.hasOwn(state, name) && !isParamVisible(spec, state, defaults)) {
5538
6134
  delete ensure()[name];
5539
6135
  continue;
5540
6136
  }
5541
- const rowFields = isRecord4(spec.fields) ? spec.fields : void 0;
6137
+ const rowFields = isRecord6(spec.fields) ? spec.fields : void 0;
5542
6138
  const rows = state[name];
5543
6139
  if (rowFields && Array.isArray(rows)) {
5544
6140
  let changed = false;
5545
6141
  const cleaned = rows.map((row) => {
5546
- if (!isRecord4(row)) return row;
6142
+ if (!isRecord6(row)) return row;
5547
6143
  const cleanedRow = dropHiddenParameters(row, rowFields);
5548
6144
  if (cleanedRow !== row) changed = true;
5549
6145
  return cleanedRow;
@@ -5555,7 +6151,7 @@ function dropHiddenParameters(state, fields, mappedFields = /* @__PURE__ */ new
5555
6151
  }
5556
6152
 
5557
6153
  // src/builder/lib/field-schema.ts
5558
- function isRecord5(value) {
6154
+ function isRecord7(value) {
5559
6155
  return typeof value === "object" && value !== null && !Array.isArray(value);
5560
6156
  }
5561
6157
  function isIdentifier(key) {
@@ -5574,11 +6170,11 @@ function pathToExpression(path) {
5574
6170
  function mergeFieldSpecs(common, variant) {
5575
6171
  const base = typeof common === "string" ? { type: common } : common;
5576
6172
  const branch = typeof variant === "string" ? { type: variant } : variant;
5577
- if (!isRecord5(base) || !isRecord5(branch)) return branch;
6173
+ if (!isRecord7(base) || !isRecord7(branch)) return branch;
5578
6174
  const merged = { ...base, ...branch };
5579
6175
  const commonProperties = base.properties;
5580
6176
  const branchProperties = branch.properties;
5581
- if (isRecord5(commonProperties) && isRecord5(branchProperties)) {
6177
+ if (isRecord7(commonProperties) && isRecord7(branchProperties)) {
5582
6178
  merged.properties = Object.fromEntries(
5583
6179
  Object.entries({ ...commonProperties, ...branchProperties }).map(
5584
6180
  ([key, value]) => [
@@ -5597,14 +6193,14 @@ function fieldFromSpec(key, path, spec) {
5597
6193
  if (typeof spec === "string") {
5598
6194
  return { key, path, type: spec };
5599
6195
  }
5600
- if (isRecord5(spec)) {
6196
+ if (isRecord7(spec)) {
5601
6197
  const declaredType2 = typeof spec.type === "string" ? spec.type : void 0;
5602
6198
  const description = typeof spec.description === "string" ? spec.description : void 0;
5603
6199
  const required = spec.required === true;
5604
6200
  const alternatives = ["oneOf", "anyOf"].flatMap((keyword) => {
5605
6201
  const variants = spec[keyword];
5606
6202
  return Array.isArray(variants) ? variants.flatMap(
5607
- (variant, index) => isRecord5(variant) || typeof variant === "string" ? [{ keyword, index, variant }] : []
6203
+ (variant, index) => isRecord7(variant) || typeof variant === "string" ? [{ keyword, index, variant }] : []
5608
6204
  ) : [];
5609
6205
  });
5610
6206
  if (alternatives.length > 0) {
@@ -5633,7 +6229,7 @@ function fieldFromSpec(key, path, spec) {
5633
6229
  type: declaredType2 ?? [...new Set(children.map((field) => field.type))].join(" | ")
5634
6230
  };
5635
6231
  }
5636
- if (isRecord5(spec.properties) && (!declaredType2 || declaredType2 === "object")) {
6232
+ if (isRecord7(spec.properties) && (!declaredType2 || declaredType2 === "object")) {
5637
6233
  const children = Object.entries(spec.properties).map(
5638
6234
  ([childKey, childSpec]) => fieldFromSpec(childKey, joinPath(path, childKey), childSpec)
5639
6235
  );
@@ -5655,7 +6251,7 @@ function fieldFromSpec(key, path, spec) {
5655
6251
  return { key, path, type: "any" };
5656
6252
  }
5657
6253
  function fieldsFromIO(io, root = "") {
5658
- if (!isRecord5(io)) return [];
6254
+ if (!isRecord7(io)) return [];
5659
6255
  return Object.entries(io).map(
5660
6256
  ([key, spec]) => fieldFromSpec(key, joinPath(root, key), spec)
5661
6257
  );
@@ -5674,7 +6270,7 @@ function fieldFromValue(key, path, value) {
5674
6270
  const children = value.length > 0 ? [fieldFromValue("0", `${path}[0]`, value[0])] : void 0;
5675
6271
  return { key, path, type: "array", children };
5676
6272
  }
5677
- if (isRecord5(value)) {
6273
+ if (isRecord7(value)) {
5678
6274
  const children = Object.entries(value).map(
5679
6275
  ([k, v]) => fieldFromValue(k, joinPath(path, k), v)
5680
6276
  );
@@ -5683,7 +6279,7 @@ function fieldFromValue(key, path, value) {
5683
6279
  return { key, path, type: typeOfValue(value) };
5684
6280
  }
5685
6281
  function fieldsFromValue(value, root = "") {
5686
- if (!isRecord5(value)) return [];
6282
+ if (!isRecord7(value)) return [];
5687
6283
  return Object.entries(value).map(
5688
6284
  ([key, v]) => fieldFromValue(key, joinPath(root, key), v)
5689
6285
  );
@@ -5699,13 +6295,13 @@ function declaredOutputFields(nodeType, op) {
5699
6295
  }
5700
6296
  function normalizeOperations(raw) {
5701
6297
  if (Array.isArray(raw)) return raw;
5702
- if (isRecord5(raw) && Array.isArray(raw.operations)) {
6298
+ if (isRecord7(raw) && Array.isArray(raw.operations)) {
5703
6299
  return raw.operations;
5704
6300
  }
5705
6301
  return [];
5706
6302
  }
5707
6303
  function resolveNodeOperation(data, fallbackOperations) {
5708
- const nodeData = isRecord5(data?.nodeData) ? data?.nodeData : void 0;
6304
+ const nodeData = isRecord7(data?.nodeData) ? data?.nodeData : void 0;
5709
6305
  let operations = normalizeOperations(nodeData?.operations);
5710
6306
  if (operations.length === 0) {
5711
6307
  operations = normalizeOperations(data?.operations);
@@ -5719,11 +6315,11 @@ function resolveNodeOperation(data, fallbackOperations) {
5719
6315
  }
5720
6316
 
5721
6317
  // src/builder/lib/parameter-values.ts
5722
- function isRecord6(value) {
6318
+ function isRecord8(value) {
5723
6319
  return typeof value === "object" && value !== null && !Array.isArray(value);
5724
6320
  }
5725
6321
  function record(value) {
5726
- return isRecord6(value) ? value : void 0;
6322
+ return isRecord8(value) ? value : void 0;
5727
6323
  }
5728
6324
  function declaredType(schema) {
5729
6325
  const type = typeof schema === "string" ? schema : record(schema)?.type;
@@ -7081,11 +7677,11 @@ function canRenderOperationPanel(selectedOperation, supportedOperations) {
7081
7677
  const operationName = resolveOperationName(selectedOperation, "");
7082
7678
  return operationName === "" || supportedOperations.includes(operationName);
7083
7679
  }
7084
- function isRecord7(value) {
7680
+ function isRecord9(value) {
7085
7681
  return typeof value === "object" && value !== null && !Array.isArray(value);
7086
7682
  }
7087
7683
  function readRecord3(value) {
7088
- return isRecord7(value) ? value : void 0;
7684
+ return isRecord9(value) ? value : void 0;
7089
7685
  }
7090
7686
  function readOperations(value) {
7091
7687
  const operations = Array.isArray(value) ? value : readRecord3(value)?.operations;
@@ -7458,6 +8054,7 @@ var getNodeMetadata = (value) => {
7458
8054
  }, [data?.isAdapterInstance, edges, id, nodeLookup]);
7459
8055
  const nodeType = value?.type;
7460
8056
  const meta = useMemo(() => getNodeDetail(nodeType), [nodeType]);
8057
+ const durableEnabled = useDurableFunctionNodesEnabled();
7461
8058
  const { setNodes } = useReactFlow();
7462
8059
  const [
7463
8060
  isExecuting,
@@ -7631,7 +8228,8 @@ var getNodeMetadata = (value) => {
7631
8228
  isTrigger ? "trigger" : isLogicNode ? "logic" : "action"
7632
8229
  );
7633
8230
  const outputHandles = resolveOutputHandles(
7634
- data
8231
+ data,
8232
+ value?.type
7635
8233
  );
7636
8234
  const inputHandles = resolveInputHandles(
7637
8235
  data
@@ -7640,12 +8238,14 @@ var getNodeMetadata = (value) => {
7640
8238
  Math.max(outputHandles.length, inputHandles.length)
7641
8239
  );
7642
8240
  const manifestKind = data?.nodeData?.kind;
7643
- const isControlFlowNode = (value?.type || "").startsWith("internal:") && (Array.isArray(manifestKind) ? manifestKind.includes("control") : isLogicNode);
8241
+ const isWaitForSignal = value?.type === WAIT_FOR_SIGNAL_NODE_TYPE;
8242
+ const isCodeWorkflow = value?.type === CODE_WORKFLOW_NODE_TYPE;
8243
+ const isControlFlowNode = isWaitForSignal || !isCodeWorkflow && (value?.type || "").startsWith("internal:") && (Array.isArray(manifestKind) ? manifestKind.includes("control") : isLogicNode);
7644
8244
  if (isControlFlowNode) {
7645
8245
  const argsState = data?.args?.state;
7646
8246
  const rules = argsState?.rules;
7647
8247
  const mode = argsState?.mode;
7648
- const logicSubtitle = Array.isArray(rules) ? `${rules.length} rule${rules.length === 1 ? "" : "s"}` : typeof mode === "string" ? mode : void 0;
8248
+ const logicSubtitle = isWaitForSignal ? readSignalName(argsState) : Array.isArray(rules) ? `${rules.length} rule${rules.length === 1 ? "" : "s"}` : typeof mode === "string" ? mode : void 0;
7649
8249
  return /* @__PURE__ */ jsxs("div", { children: [
7650
8250
  /* @__PURE__ */ jsx(
7651
8251
  LogicNodeCard,
@@ -7720,7 +8320,13 @@ var getNodeMetadata = (value) => {
7720
8320
  onCancelRename: handleCancelRename
7721
8321
  }
7722
8322
  ),
7723
- operationDisplay === "execute" && (value?.type || "").startsWith("internal:") || isTrigger && !resolveOperationName(data?.operation_name, "") ? /* @__PURE__ */ jsx("div", { className: "rounded-b-xl border-t border-border/60 px-3 pb-3 pt-2.5", children: /* @__PURE__ */ jsx("p", { className: "line-clamp-2 text-xs leading-snug text-muted-foreground", children: nodeDescription }) }) : /* @__PURE__ */ jsx(
8323
+ isCodeWorkflow ? /* @__PURE__ */ jsx(
8324
+ CodeWorkflowCardSection,
8325
+ {
8326
+ args: data?.args?.state,
8327
+ durableEnabled
8328
+ }
8329
+ ) : operationDisplay === "execute" && (value?.type || "").startsWith("internal:") || isTrigger && !resolveOperationName(data?.operation_name, "") ? /* @__PURE__ */ jsx("div", { className: "rounded-b-xl border-t border-border/60 px-3 pb-3 pt-2.5", children: /* @__PURE__ */ jsx("p", { className: "line-clamp-2 text-xs leading-snug text-muted-foreground", children: nodeDescription }) }) : /* @__PURE__ */ jsx(
7724
8330
  NodeCardBody,
7725
8331
  {
7726
8332
  operationName: operationDisplay,
@@ -8917,4 +9523,4 @@ function useNodeExecution() {
8917
9523
  };
8918
9524
  }
8919
9525
 
8920
- export { ALLOW_ALL_PERMISSIONS, AUTOSAVE_DEBOUNCE_MS, AUTOSAVE_RETRY_DELAYS_MS, AVAILABLE_NODES, BILLING_PLANS_PATH, ConnectionFormDialog, ConnectionSelector, ExpressionEditor, FLUIDGRIDS_PERMISSIONS, FluidGridsContext, FluidGridsPermissionsProvider, FluidGridsProvider, NODES, NODES_METADATA, NODE_CONFIGS, NODE_OPERATION_DRAG_DATA_FORMAT, NODE_TYPES, NODE_TYPE_DRAG_DATA_FORMAT, NodePropertyPanel, NodeTypeIcon, RUNS_QUOTA_NAME, STICKY_NOTE_TYPE, SdkPermissionButton, SdkPermissionGate, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, WORKFLOWS_QUOTA_NAME, blankWorkflowCreateInput, buildOperationSeed, buildStickyNode, canAutosave, canRenderOperationPanel, classifyCreateRefusal, createConfiguredNode, createThenOpen, declaredOutputFields, describeOperationError, editStateOf, emitNodeInstalled, emitRunFailed, emitRunLimitHit, emitRunStarted, emitTemplateUsed, emitUpgradeClicked, emitWorkflowCreated, emitWorkflowLimitHit, emitWorkflowPublished, ensureNodeConfigsLoaded, evaluatePermissionCheck, fieldsFromIO, fieldsFromValue, findQuotaRefusal, formatParameterValue, getNodeDetail, getNodeMetadata, inAppLeaveTarget, isImageIcon, isNodeConfigsInitialized, isNodeTrigger, isParamVisible, isQuotaExhaustedFailure, isTriggerOperation, leaveNeedsConfirmation, listCustomBlocks, liveInternalOperations, mergeStickyNotes, nodeAccent, nodesOf, onNodeTypesUpdate, openRunQuotaUpgradePrompt, parseParameterValue, pathToExpression, readDisplayOptions, refetchStoreNodes, registerCustomBlock, registerWorkflowNodeTypes, resolveInputHandles, resolveNodeOperation, resolveOperationName, resolveOutputHandles, resolveUiSpec, runTriggerFromMode, saveIndicatorOf, snapshotForSave, stripSubmitActions, structuredParameterType, subscribeWorkflowSaved, synchronizeOperationUpdate, throwIfResultError, useAgentDefinitionList, useAgentDefinitions, useConnection, useConnections, useConnectionsByProvider, useCreateConnection, useFlowStore, useFluidGridsAnalytics, useFluidGridsContext, useFluidGridsPermission, useInitiateOAuth, useInsertNode, useIsValidConnection, useNodeExecution, useNodeRegistryRevision, useProviders, useSaveStatusStore, useSaveWorkflow, workflowFingerprint };
9526
+ export { ALLOW_ALL_PERMISSIONS, AUTOSAVE_DEBOUNCE_MS, AUTOSAVE_RETRY_DELAYS_MS, AVAILABLE_NODES, BILLING_PLANS_PATH, CODE_WORKFLOW_NODE_TYPE, ConnectionFormDialog, ConnectionSelector, DURABLE_FUNCTION_NODE_TYPES, ExpressionEditor, FLUIDGRIDS_FLAGS, FLUIDGRIDS_FLAG_DEFAULTS, FLUIDGRIDS_PERMISSIONS, FluidGridsContext, FluidGridsPermissionsProvider, FluidGridsProvider, NODES, NODES_METADATA, NODE_CONFIGS, NODE_OPERATION_DRAG_DATA_FORMAT, NODE_TYPES, NODE_TYPE_DRAG_DATA_FORMAT, NodePropertyPanel, NodeTypeIcon, RUNS_QUOTA_NAME, STICKY_NOTE_TYPE, SdkPermissionButton, SdkPermissionGate, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, WORKFLOWS_QUOTA_NAME, blankWorkflowCreateInput, buildOperationSeed, buildStickyNode, canAutosave, canRenderOperationPanel, canSignalRun, changedSourceFiles, childRunIdOf, classifyCreateRefusal, clearCodeWorkflowDefinitionCache, components_default, createConfiguredNode, createThenOpen, declaredOutputFields, declaredSignals, defaultSourcePath, describeOperationError, diagnosticsByPath, editStateOf, emitNodeInstalled, emitRunFailed, emitRunLimitHit, emitRunStarted, emitTemplateUsed, emitUpgradeClicked, emitWorkflowCreated, emitWorkflowLimitHit, emitWorkflowPublished, ensureNodeConfigsLoaded, evaluatePermissionCheck, fieldsFromIO, fieldsFromValue, filterPaletteNodes, findQuotaRefusal, formatParameterValue, getNodeDetail, getNodeMetadata, inAppLeaveTarget, interfaceFields, interfaceHandlers, isDurableFunctionNodeType, isEditableSourcePath, isImageIcon, isNodeConfigsInitialized, isNodeTrigger, isNodeTypeHiddenFromPalette, isParamVisible, isQuotaExhaustedFailure, isTriggerOperation, leaveNeedsConfirmation, listCustomBlocks, liveInternalOperations, mergeStickyNotes, nodeAccent, nodesOf, onNodeTypesUpdate, openRunQuotaUpgradePrompt, parseParameterValue, parseRawSignalPayload, pathToExpression, payloadFromCardValues, projectLanguage, readCodeWorkflowState, readDisplayOptions, refetchStoreNodes, registerCustomBlock, registerWorkflowNodeTypes, resolveInputHandles, resolveNodeOperation, resolveOperationName, resolveOutputHandles, resolveUiSpec, runSignalTargets, runTriggerFromMode, saveIndicatorOf, signalPayloadCard, snapshotForSave, sourceLanguageOf, stripSubmitActions, structuredParameterType, subscribeWorkflowSaved, synchronizeOperationUpdate, throwIfResultError, toCodeMirrorDiagnostics, useAgentDefinitionList, useAgentDefinitions, useCodeWorkflowInterface, useConnection, useConnections, useConnectionsByProvider, useCreateConnection, useDurableFunctionNodesEnabled, useFlowStore, useFluidGridsAnalytics, useFluidGridsContext, useFluidGridsFlag, useFluidGridsPermission, useInitiateOAuth, useInsertNode, useIsValidConnection, useNodeExecution, useNodeRegistryRevision, useProviders, useSaveStatusStore, useSaveWorkflow, workflowFingerprint };