@flowdrop/flowdrop 2.16.0 → 2.18.0

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 (130) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +6 -1
  3. package/dist/api/enhanced-client.d.ts +3 -1
  4. package/dist/api/enhanced-client.js +4 -2
  5. package/dist/commands/executor.js +9 -0
  6. package/dist/commands/storeIntegration.svelte.js +6 -0
  7. package/dist/commands/types.d.ts +8 -0
  8. package/dist/components/App.svelte +414 -105
  9. package/dist/components/App.svelte.d.ts +31 -0
  10. package/dist/components/CanvasToolbar.svelte +40 -3
  11. package/dist/components/CanvasToolbar.svelte.d.ts +5 -1
  12. package/dist/components/ConnectPortPicker.svelte +8 -4
  13. package/dist/components/DoctorMenu.svelte +208 -126
  14. package/dist/components/FlowDropZone.svelte +7 -1
  15. package/dist/components/FlowDropZone.svelte.d.ts +5 -0
  16. package/dist/components/ImpactConfirm.svelte +554 -0
  17. package/dist/components/ImpactConfirm.svelte.d.ts +22 -0
  18. package/dist/components/Input.svelte +8 -2
  19. package/dist/components/LockBanner.svelte +76 -0
  20. package/dist/components/LockBanner.svelte.d.ts +14 -0
  21. package/dist/components/LockFence.svelte +33 -0
  22. package/dist/components/LockFence.svelte.d.ts +19 -0
  23. package/dist/components/Navbar.svelte +77 -9
  24. package/dist/components/Navbar.svelte.d.ts +10 -0
  25. package/dist/components/NodeSidebar.svelte +36 -15
  26. package/dist/components/NodeSidebar.svelte.d.ts +2 -0
  27. package/dist/components/NodeSwapPicker.svelte +4 -14
  28. package/dist/components/RunBar.svelte +50 -3
  29. package/dist/components/RunBar.svelte.d.ts +5 -0
  30. package/dist/components/RunInputsDialog.svelte +198 -0
  31. package/dist/components/RunInputsDialog.svelte.d.ts +34 -0
  32. package/dist/components/Textarea.svelte +7 -1
  33. package/dist/components/WorkflowCompareDialog.svelte +177 -0
  34. package/dist/components/WorkflowCompareDialog.svelte.d.ts +10 -0
  35. package/dist/components/WorkflowEditor.svelte +120 -15
  36. package/dist/components/WorkflowEditor.svelte.d.ts +6 -0
  37. package/dist/components/WorkflowInterfaceEditor.svelte +17 -4
  38. package/dist/components/WorkflowInterfaceEntryCard.svelte +40 -7
  39. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +2 -0
  40. package/dist/components/WorkflowPlaygroundSettings.svelte +9 -1
  41. package/dist/components/form/FieldFactory.svelte +13 -6
  42. package/dist/components/form/FormArray.svelte +0 -1
  43. package/dist/components/form/FormArrayRows.svelte +4 -4
  44. package/dist/components/form/FormCodeEditor.svelte +18 -2
  45. package/dist/components/form/FormMarkdownEditor.svelte +22 -8
  46. package/dist/components/form/FormTemplateEditor.svelte +17 -1
  47. package/dist/components/form/readOnly.d.ts +13 -0
  48. package/dist/components/form/readOnly.js +18 -0
  49. package/dist/components/nodes/CaptionNode.svelte +1 -0
  50. package/dist/components/nodes/NodeCard.svelte +2 -2
  51. package/dist/components/primitives/Checkbox.svelte +5 -1
  52. package/dist/components/primitives/Select.svelte +6 -1
  53. package/dist/components/primitives/Switch.svelte +5 -1
  54. package/dist/components/toast/DismissibleToast.svelte +25 -6
  55. package/dist/components/toast/DismissibleToast.svelte.d.ts +3 -0
  56. package/dist/config/endpoints.d.ts +7 -0
  57. package/dist/config/endpoints.js +2 -1
  58. package/dist/editor/connectCandidates.d.ts +3 -0
  59. package/dist/editor/connectCandidates.js +14 -5
  60. package/dist/editor/index.d.ts +2 -1
  61. package/dist/editor/index.js +1 -1
  62. package/dist/helpers/workflowEditorHelper.d.ts +15 -0
  63. package/dist/helpers/workflowEditorHelper.js +9 -0
  64. package/dist/index.d.ts +2 -0
  65. package/dist/messages/defaults.d.ts +145 -0
  66. package/dist/messages/defaults.js +139 -1
  67. package/dist/openapi/v1/openapi.yaml +492 -0
  68. package/dist/registry/nodeComponentRegistry.d.ts +5 -0
  69. package/dist/schemas/v1/workflow.schema.json +2 -0
  70. package/dist/services/draftStorage.d.ts +24 -10
  71. package/dist/services/draftStorage.js +60 -35
  72. package/dist/services/globalSave.d.ts +45 -10
  73. package/dist/services/globalSave.js +296 -32
  74. package/dist/services/impactGate.d.ts +38 -0
  75. package/dist/services/impactGate.js +72 -0
  76. package/dist/services/impactService.d.ts +45 -0
  77. package/dist/services/impactService.js +157 -0
  78. package/dist/services/runsService.d.ts +9 -0
  79. package/dist/services/runsService.js +13 -0
  80. package/dist/services/toastQueue.d.ts +9 -0
  81. package/dist/services/toastService.d.ts +4 -0
  82. package/dist/services/toastService.js +9 -3
  83. package/dist/services/workflowLaunchService.d.ts +6 -0
  84. package/dist/services/workflowLaunchService.js +5 -1
  85. package/dist/settings/index.d.ts +2 -2
  86. package/dist/settings/index.js +1 -1
  87. package/dist/stores/doctorStore.svelte.d.ts +24 -1
  88. package/dist/stores/doctorStore.svelte.js +105 -2
  89. package/dist/stores/historyStore.svelte.d.ts +12 -2
  90. package/dist/stores/historyStore.svelte.js +25 -2
  91. package/dist/stores/instanceContainer.svelte.d.ts +23 -0
  92. package/dist/stores/instanceContainer.svelte.js +32 -2
  93. package/dist/stores/lockStore.svelte.d.ts +39 -0
  94. package/dist/stores/lockStore.svelte.js +109 -0
  95. package/dist/stores/runController.svelte.d.ts +2 -0
  96. package/dist/stores/runController.svelte.js +27 -11
  97. package/dist/stores/saveConflictStore.svelte.d.ts +62 -0
  98. package/dist/stores/saveConflictStore.svelte.js +169 -0
  99. package/dist/stores/workflowStore.svelte.d.ts +14 -4
  100. package/dist/stores/workflowStore.svelte.js +55 -18
  101. package/dist/styles/base.css +6 -0
  102. package/dist/styles/toast.css +10 -1
  103. package/dist/svelte-app.d.ts +33 -0
  104. package/dist/svelte-app.js +178 -22
  105. package/dist/types/doctor.d.ts +3 -1
  106. package/dist/types/events.d.ts +37 -0
  107. package/dist/types/events.js +2 -0
  108. package/dist/types/impact.d.ts +77 -0
  109. package/dist/types/impact.js +7 -0
  110. package/dist/types/lock.d.ts +35 -0
  111. package/dist/types/lock.js +13 -0
  112. package/dist/types/navbar.d.ts +6 -0
  113. package/dist/types/settings.d.ts +31 -0
  114. package/dist/types/settings.js +132 -0
  115. package/dist/utils/draftRestore.d.ts +27 -0
  116. package/dist/utils/draftRestore.js +36 -0
  117. package/dist/utils/interfaceTags.js +4 -1
  118. package/dist/utils/links.d.ts +29 -0
  119. package/dist/utils/links.js +63 -0
  120. package/dist/utils/nodeSearch.d.ts +10 -0
  121. package/dist/utils/nodeSearch.js +37 -0
  122. package/dist/utils/runOffer.d.ts +21 -0
  123. package/dist/utils/runOffer.js +13 -0
  124. package/dist/utils/workflowCompare.d.ts +35 -0
  125. package/dist/utils/workflowCompare.js +84 -0
  126. package/dist/utils/workflowInterface.d.ts +26 -1
  127. package/dist/utils/workflowInterface.js +91 -11
  128. package/dist/webmcp/runtime.js +16 -3
  129. package/dist/webmcp/types.d.ts +11 -1
  130. package/package.json +3 -2
@@ -631,6 +631,12 @@ paths:
631
631
  description: |
632
632
  Update an existing workflow. All fields are optional - only provided fields will be updated.
633
633
  The updatedAt timestamp will be automatically set to the current time.
634
+
635
+ A change that would break places that use the workflow right now is
636
+ refused with 409 and error code `WORKFLOW_IN_USE_BREAKING`; `details`
637
+ lists the breaking places. Ask the impact endpoint first to learn this
638
+ before saving. A workflow that a module manages is refused with 409 and
639
+ error code `WORKFLOW_MANAGED`.
634
640
  tags:
635
641
  - Workflows
636
642
  parameters:
@@ -658,6 +664,25 @@ paths:
658
664
  $ref: '#/components/responses/BadRequest'
659
665
  '404':
660
666
  $ref: '#/components/responses/NotFound'
667
+ '409':
668
+ description: |
669
+ The update is refused. `error_code` is `WORKFLOW_IN_USE_BREAKING`
670
+ (the change breaks places in use; `details` lists them) or
671
+ `WORKFLOW_MANAGED` (a module manages this workflow).
672
+ content:
673
+ application/json:
674
+ schema:
675
+ $ref: '#/components/schemas/WorkflowRefusedResponse'
676
+ example:
677
+ success: false
678
+ error: This change cannot be saved yet. It would break 1 place that uses this workflow.
679
+ error_code: WORKFLOW_IN_USE_BREAKING
680
+ details:
681
+ - kind: parent
682
+ severity: breaks
683
+ label: Order intake
684
+ message: Calls this workflow; the interface change breaks its callers (major).
685
+ url: /admin/flowdrop/workflows/order_intake
661
686
  '422':
662
687
  $ref: '#/components/responses/ValidationError'
663
688
  '500':
@@ -864,6 +889,185 @@ paths:
864
889
  $ref: '#/components/responses/NotFound'
865
890
  '500':
866
891
  $ref: '#/components/responses/InternalServerError'
892
+ /workflows/{id}/copy:
893
+ post:
894
+ operationId: copyWorkflow
895
+ summary: Save a draft as a new workflow
896
+ description: |
897
+ Save the draft in the body as a new workflow, named after the draft with
898
+ ` (copy)` added. The workflow `id` names is left as it is. Triggers carried
899
+ over from it start switched off, so the copy does not fire next to the
900
+ original. This is the way out of a refused update. The impact check names
901
+ this endpoint in `copyUrl`.
902
+ tags:
903
+ - Workflows
904
+ parameters:
905
+ - name: id
906
+ in: path
907
+ description: UUID of the workflow the draft came from
908
+ required: true
909
+ schema:
910
+ type: string
911
+ format: uuid
912
+ requestBody:
913
+ required: true
914
+ description: The draft, in the shape of the update request.
915
+ content:
916
+ application/json:
917
+ schema:
918
+ $ref: '#/components/schemas/UpdateWorkflowRequest'
919
+ responses:
920
+ '201':
921
+ description: The copy was created
922
+ content:
923
+ application/json:
924
+ schema:
925
+ $ref: '#/components/schemas/WorkflowCopyResponse'
926
+ '400':
927
+ $ref: '#/components/responses/BadRequest'
928
+ '404':
929
+ $ref: '#/components/responses/NotFound'
930
+ '422':
931
+ $ref: '#/components/responses/ValidationError'
932
+ '500':
933
+ $ref: '#/components/responses/InternalServerError'
934
+ /workflow/{id}/impact:
935
+ post:
936
+ operationId: checkWorkflowImpact
937
+ summary: Check what saving a draft would change
938
+ description: |
939
+ Ask what saving the draft in the body over the stored workflow would do
940
+ to the workflows, profiles and triggers that use it. Nothing is saved.
941
+ The editor calls this before every save. A backend without this route
942
+ answers 404 or 405, and the editor then saves without asking.
943
+ tags:
944
+ - Workflows
945
+ parameters:
946
+ - name: id
947
+ in: path
948
+ description: Workflow UUID
949
+ required: true
950
+ schema:
951
+ type: string
952
+ format: uuid
953
+ requestBody:
954
+ required: true
955
+ description: The draft, in the shape of the update request.
956
+ content:
957
+ application/json:
958
+ schema:
959
+ $ref: '#/components/schemas/UpdateWorkflowRequest'
960
+ responses:
961
+ '200':
962
+ description: The impact of the draft
963
+ content:
964
+ application/json:
965
+ schema:
966
+ $ref: '#/components/schemas/ImpactResponse'
967
+ '400':
968
+ $ref: '#/components/responses/BadRequest'
969
+ '404':
970
+ $ref: '#/components/responses/NotFound'
971
+ '500':
972
+ $ref: '#/components/responses/InternalServerError'
973
+ /workflow/{id}/run:
974
+ post:
975
+ operationId: runWorkflow
976
+ summary: Run workflow
977
+ description: |
978
+ Start a run of the stored workflow with the given inputs. Without a body
979
+ the workflow runs with no inputs. Reading the run later needs its own
980
+ permission, so launching does not imply read access.
981
+ tags:
982
+ - Pipeline
983
+ parameters:
984
+ - name: id
985
+ in: path
986
+ description: Workflow UUID
987
+ required: true
988
+ schema:
989
+ type: string
990
+ format: uuid
991
+ requestBody:
992
+ required: false
993
+ content:
994
+ application/json:
995
+ schema:
996
+ type: object
997
+ properties:
998
+ inputs:
999
+ type: object
1000
+ description: Input values by workflow input name
1001
+ additionalProperties: true
1002
+ sessionId:
1003
+ type: string
1004
+ description: The session the run belongs to
1005
+ waitSeconds:
1006
+ type: integer
1007
+ minimum: 0
1008
+ maximum: 30
1009
+ default: 0
1010
+ description: How long to wait for the run to finish before answering
1011
+ origin:
1012
+ type: string
1013
+ description: |
1014
+ Where the launch comes from. `editor` says the run was
1015
+ started from the workflow editor, so the run page can say so.
1016
+ It is the only value today. A backend that does not know the
1017
+ field ignores it, and so does one that gets another value.
1018
+ enum:
1019
+ - editor
1020
+ responses:
1021
+ '202':
1022
+ description: The run was started
1023
+ headers:
1024
+ Location:
1025
+ description: The URL of the run
1026
+ schema:
1027
+ type: string
1028
+ content:
1029
+ application/json:
1030
+ schema:
1031
+ allOf:
1032
+ - $ref: '#/components/schemas/ApiResponse'
1033
+ - type: object
1034
+ properties:
1035
+ data:
1036
+ type: object
1037
+ properties:
1038
+ pipelineId:
1039
+ type: string
1040
+ description: The run id, to read its status with
1041
+ runId:
1042
+ type: string
1043
+ description: The same value as `pipelineId`
1044
+ status:
1045
+ type: string
1046
+ queued:
1047
+ type: boolean
1048
+ description: True when a queue worker will pick the run up
1049
+ runUrl:
1050
+ type: string
1051
+ description: The URL of the run
1052
+ run:
1053
+ type: object
1054
+ nullable: true
1055
+ additionalProperties: true
1056
+ description: The run as it stands after the optional wait
1057
+ '400':
1058
+ $ref: '#/components/responses/BadRequest'
1059
+ '404':
1060
+ $ref: '#/components/responses/NotFound'
1061
+ '409':
1062
+ description: The workflow is switched off. The run starts once it is enabled again.
1063
+ content:
1064
+ application/json:
1065
+ schema:
1066
+ $ref: '#/components/schemas/ErrorResponse'
1067
+ '422':
1068
+ $ref: '#/components/responses/ValidationError'
1069
+ '500':
1070
+ $ref: '#/components/responses/InternalServerError'
867
1071
  /executions:
868
1072
  get:
869
1073
  operationId: listExecutions
@@ -1189,6 +1393,38 @@ paths:
1189
1393
  updated:
1190
1394
  type: string
1191
1395
  format: date-time
1396
+ activity:
1397
+ nullable: true
1398
+ description: |
1399
+ What is happening to a run that has not ended,
1400
+ worked out by the backend so a client never
1401
+ compares a lease with its own clock. Null once the
1402
+ run has ended or waits on a person. A backend
1403
+ without this field leaves it out.
1404
+ type: object
1405
+ properties:
1406
+ kind:
1407
+ type: string
1408
+ description: |
1409
+ `waiting_for_worker` (nobody holds the run and a
1410
+ queue worker will pick it up), `running_here` (a
1411
+ web request holds it), `running_on_worker` (a
1412
+ queue worker holds it) or `stuck` (the holder
1413
+ went away, or nobody picked it up in time). A
1414
+ backend may add kinds.
1415
+ example: waiting_for_worker
1416
+ label:
1417
+ type: string
1418
+ description: The activity in words, for a person
1419
+ example: Waiting for a worker
1420
+ since:
1421
+ type: string
1422
+ format: date-time
1423
+ description: Since when
1424
+ heldBy:
1425
+ type: string
1426
+ nullable: true
1427
+ description: The kind of holder while one has the run, otherwise null
1192
1428
  '404':
1193
1429
  $ref: '#/components/responses/NotFound'
1194
1430
  '500':
@@ -4487,6 +4723,14 @@ components:
4487
4723
  playground:
4488
4724
  $ref: '#/components/schemas/WorkflowPlayground'
4489
4725
  description: 'Playground settings. Send only `chat`: null clears the stored settings, and omitting the key leaves them alone.'
4726
+ followRenames:
4727
+ type: boolean
4728
+ default: false
4729
+ description: |
4730
+ Set when the author agreed in the save dialog that the places using a
4731
+ renamed workflow input or output follow the new name in this same save.
4732
+ The impact check lists them in `renames`. Without it, a rename leaves
4733
+ those places on the old name.
4490
4734
  metadata:
4491
4735
  type: object
4492
4736
  properties:
@@ -4499,6 +4743,252 @@ components:
4499
4743
  author:
4500
4744
  type: string
4501
4745
  maxLength: 100
4746
+ WorkflowRefusedResponse:
4747
+ type: object
4748
+ description: |
4749
+ The answer of a workflow update the backend refuses with 409. The code
4750
+ says why; the remedy depends on it.
4751
+ required:
4752
+ - success
4753
+ - error
4754
+ - error_code
4755
+ properties:
4756
+ success:
4757
+ type: boolean
4758
+ example: false
4759
+ error:
4760
+ type: string
4761
+ description: The refusal in plain words.
4762
+ error_code:
4763
+ type: string
4764
+ description: |
4765
+ `WORKFLOW_IN_USE_BREAKING`: the change breaks places that use the
4766
+ workflow right now; `details` lists them. Save the draft as a copy, or
4767
+ change those places first.
4768
+ `WORKFLOW_MANAGED`: a module manages this workflow and updates keep it
4769
+ in step. Duplicate the workflow and change the copy, or take the
4770
+ workflow over.
4771
+ enum:
4772
+ - WORKFLOW_IN_USE_BREAKING
4773
+ - WORKFLOW_MANAGED
4774
+ details:
4775
+ type: array
4776
+ description: For `WORKFLOW_IN_USE_BREAKING`, the breaking impact items, one per place.
4777
+ items:
4778
+ $ref: '#/components/schemas/ImpactItem'
4779
+ ImpactItem:
4780
+ type: object
4781
+ description: One place that uses the workflow, and what a change does to it.
4782
+ required:
4783
+ - kind
4784
+ - severity
4785
+ - label
4786
+ - message
4787
+ properties:
4788
+ kind:
4789
+ type: string
4790
+ description: |
4791
+ What is affected, such as `profile`, `trigger`, `parent`, `runs`,
4792
+ `status` or `other`. A backend may add kinds; read an unknown one as `other`.
4793
+ example: trigger
4794
+ severity:
4795
+ type: string
4796
+ description: |
4797
+ `breaks` means something in use stops working and the save is refused.
4798
+ `changes` means it keeps working but behaves differently. `info` is
4799
+ for noting only.
4800
+ enum:
4801
+ - breaks
4802
+ - changes
4803
+ - info
4804
+ label:
4805
+ type: string
4806
+ description: The name of the affected place. A place the viewer may not open gets a generic name.
4807
+ message:
4808
+ type: string
4809
+ description: What happens to it, in plain words.
4810
+ url:
4811
+ type: string
4812
+ nullable: true
4813
+ description: Where to look at the affected place, or null when there is no page for it.
4814
+ ImpactRenamePlace:
4815
+ type: object
4816
+ description: One place that uses a renamed workflow input or output.
4817
+ required:
4818
+ - label
4819
+ properties:
4820
+ kind:
4821
+ type: string
4822
+ description: What kind of place it is, using the same values as `ImpactItem.kind`. Optional; the editor reads a missing kind as empty.
4823
+ label:
4824
+ type: string
4825
+ description: The name of the place.
4826
+ url:
4827
+ type: string
4828
+ nullable: true
4829
+ description: Where to look at the place, or null when there is no page for it.
4830
+ message:
4831
+ type: string
4832
+ nullable: true
4833
+ description: What the rename does to this place, in plain words. Optional; shown beside the place when given.
4834
+ enabled:
4835
+ type: boolean
4836
+ description: Whether the place is switched on. Optional; when `false` the editor notes that the place is switched off. A place that is switched off still follows a rename.
4837
+ ImpactRename:
4838
+ type: object
4839
+ description: |
4840
+ An input or output of the workflow that the draft renames in place, with
4841
+ the places that use the old name. Those places follow the new name when
4842
+ the save sets `followRenames`.
4843
+ required:
4844
+ - direction
4845
+ - from
4846
+ - to
4847
+ - places
4848
+ properties:
4849
+ direction:
4850
+ type: string
4851
+ enum:
4852
+ - input
4853
+ - output
4854
+ from:
4855
+ type: string
4856
+ description: The port name stored now.
4857
+ to:
4858
+ type: string
4859
+ description: The port name in the draft.
4860
+ places:
4861
+ type: array
4862
+ items:
4863
+ $ref: '#/components/schemas/ImpactRenamePlace'
4864
+ ImpactInterfaceChange:
4865
+ type: object
4866
+ description: One difference between the stored workflow interface and the draft.
4867
+ properties:
4868
+ side:
4869
+ type: string
4870
+ enum:
4871
+ - input
4872
+ - output
4873
+ path:
4874
+ type: string
4875
+ description: Where in the interface the difference is.
4876
+ kind:
4877
+ type: string
4878
+ description: What kind of difference it is.
4879
+ breaking:
4880
+ type: boolean
4881
+ description: Whether the difference breaks callers of that side.
4882
+ ImpactReport:
4883
+ type: object
4884
+ description: |
4885
+ What saving the draft would do to the workflows, profiles and triggers
4886
+ that use the saved workflow. Nothing is saved. The shape is experimental
4887
+ and may change in a minor release of the backend.
4888
+ required:
4889
+ - confirm
4890
+ - interface
4891
+ - items
4892
+ - refused
4893
+ properties:
4894
+ confirm:
4895
+ type: boolean
4896
+ description: True when the author should confirm before saving, because at least one item is not `info`.
4897
+ interface:
4898
+ type: object
4899
+ description: How the draft changes the workflow interface (its inputs and outputs).
4900
+ properties:
4901
+ level:
4902
+ type: string
4903
+ description: The version level the change calls for.
4904
+ enum:
4905
+ - major
4906
+ - minor
4907
+ - patch
4908
+ - none
4909
+ breaking:
4910
+ type: boolean
4911
+ description: Whether the interface change breaks callers.
4912
+ changes:
4913
+ type: array
4914
+ items:
4915
+ $ref: '#/components/schemas/ImpactInterfaceChange'
4916
+ items:
4917
+ type: array
4918
+ description: The affected places, breaking ones first.
4919
+ items:
4920
+ $ref: '#/components/schemas/ImpactItem'
4921
+ ways:
4922
+ type: array
4923
+ description: Ways to make the change safely.
4924
+ items:
4925
+ type: object
4926
+ properties:
4927
+ title:
4928
+ type: string
4929
+ description:
4930
+ type: string
4931
+ url:
4932
+ type: string
4933
+ code:
4934
+ type: string
4935
+ refused:
4936
+ type: boolean
4937
+ description: |
4938
+ True when the save would be refused, because it breaks a place that is
4939
+ in use. A PUT with the same draft answers 409 `WORKFLOW_IN_USE_BREAKING`.
4940
+ refusedMessage:
4941
+ type: string
4942
+ nullable: true
4943
+ description: The refusal in plain words, naming each place. Null when the save is not refused.
4944
+ copyUrl:
4945
+ type: string
4946
+ nullable: true
4947
+ description: |
4948
+ Where to POST the draft to save it as a new workflow instead (see
4949
+ `copyWorkflow`). Either a path from the site root, such as
4950
+ `/api/flowdrop/workflows/{id}/copy` (resolved against the site, not
4951
+ the API base), or an absolute URL on the site's or the API's origin.
4952
+ The editor offers no copy for anything else. Null when the backend
4953
+ offers no copy.
4954
+ renames:
4955
+ type: array
4956
+ description: Inputs and outputs the draft renames in place, with the places that use them.
4957
+ items:
4958
+ $ref: '#/components/schemas/ImpactRename'
4959
+ ImpactResponse:
4960
+ allOf:
4961
+ - $ref: '#/components/schemas/ApiResponse'
4962
+ - type: object
4963
+ properties:
4964
+ data:
4965
+ $ref: '#/components/schemas/ImpactReport'
4966
+ WorkflowCopyResponse:
4967
+ allOf:
4968
+ - $ref: '#/components/schemas/ApiResponse'
4969
+ - type: object
4970
+ properties:
4971
+ data:
4972
+ type: object
4973
+ required:
4974
+ - id
4975
+ properties:
4976
+ id:
4977
+ type: string
4978
+ description: The id of the new workflow.
4979
+ label:
4980
+ type: string
4981
+ description: The name of the new workflow, the draft name followed by ` (copy)`.
4982
+ editorUrl:
4983
+ type: string
4984
+ nullable: true
4985
+ description: |
4986
+ Where the new workflow opens in the editor: a path from the site
4987
+ root or an http(s) address. Optional; when it is missing or null
4988
+ the editor offers no link to the copy.
4989
+ triggersSwitchedOff:
4990
+ type: boolean
4991
+ description: True when triggers carried over from the original start switched off.
4502
4992
  JobStatus:
4503
4993
  type: object
4504
4994
  properties:
@@ -6692,6 +7182,7 @@ components:
6692
7182
  nullable: true
6693
7183
  description: Interface input that receives the person's message.
6694
7184
  history:
7185
+ type: object
6695
7186
  allOf:
6696
7187
  - $ref: '#/components/schemas/PlaygroundChatHistory'
6697
7188
  nullable: true
@@ -6724,6 +7215,7 @@ components:
6724
7215
  binding.
6725
7216
  properties:
6726
7217
  chat:
7218
+ type: object
6727
7219
  allOf:
6728
7220
  - $ref: '#/components/schemas/PlaygroundChatBinding'
6729
7221
  nullable: true
@@ -73,6 +73,11 @@ export interface NodeTypeInfo {
73
73
  * The node edits its text in place. Enter on the focused node, the
74
74
  * context menu's "Edit text" and a double-click then ask the component to
75
75
  * start typing (via `fd.inlineEdit`) instead of opening the config panel.
76
+ *
77
+ * A component that edits in place should mark its editing element with a
78
+ * `data-lock-commit` attribute and commit on blur. When the editor is about
79
+ * to be locked, the focused element carrying that attribute is blurred first,
80
+ * so what is half typed is saved before the lock is applied.
76
81
  */
77
82
  editsInPlace?: boolean;
78
83
  }
@@ -818,6 +818,7 @@
818
818
  "history": {
819
819
  "anyOf": [
820
820
  {
821
+ "type": "object",
821
822
  "allOf": [
822
823
  {
823
824
  "$ref": "#/$defs/PlaygroundChatHistory"
@@ -1422,6 +1423,7 @@
1422
1423
  "chat": {
1423
1424
  "anyOf": [
1424
1425
  {
1426
+ "type": "object",
1425
1427
  "allOf": [
1426
1428
  {
1427
1429
  "$ref": "#/$defs/PlaygroundChatBinding"
@@ -87,6 +87,8 @@ interface DraftMetadata {
87
87
  workflowId?: string;
88
88
  /** Workflow name */
89
89
  workflowName?: string;
90
+ /** Revision of the workflow the draft started from (absent in older drafts) */
91
+ baseRevision?: string;
90
92
  }
91
93
  /**
92
94
  * Complete draft data stored in draft storage
@@ -189,6 +191,16 @@ export declare function getDraftMetadata(storageKey: string, storage?: DraftStor
189
191
  * @returns The number of entries removed.
190
192
  */
191
193
  export declare function clearAllDrafts(extraKeys?: readonly string[], storage?: DraftStorageAdapter): number;
194
+ /**
195
+ * Fingerprint of everything a draft preserves, for change detection.
196
+ *
197
+ * Covers name, description, nodes, edges, the workflow interface and the
198
+ * Playground settings. Not cryptographic, just a stable string to compare.
199
+ *
200
+ * @param workflow - The workflow to fingerprint
201
+ * @returns A string that changes whenever a draft-relevant part changes
202
+ */
203
+ export declare function draftFingerprint(workflow: Workflow): string;
192
204
  /**
193
205
  * Draft auto-save manager
194
206
  *
@@ -221,6 +233,8 @@ export declare class DraftAutoSaveManager {
221
233
  private storage;
222
234
  /** Last saved workflow hash (for change detection) */
223
235
  private lastSavedHash;
236
+ /** Open draft offers: while any is open, a clean tick keeps the stored draft. */
237
+ private holds;
224
238
  /**
225
239
  * Create a new DraftAutoSaveManager
226
240
  *
@@ -247,6 +261,14 @@ export declare class DraftAutoSaveManager {
247
261
  * Stop auto-save interval
248
262
  */
249
263
  stop(): void;
264
+ /**
265
+ * Keep the stored draft while an offer to restore it is open. A tick that
266
+ * finds the workflow clean would otherwise delete it behind the offer.
267
+ *
268
+ * @returns a function that ends the hold; Restore and Discard call it, and
269
+ * `stop()` ends every hold
270
+ */
271
+ holdDraft(): () => void;
250
272
  /**
251
273
  * Save draft if there are unsaved changes
252
274
  *
@@ -268,7 +290,8 @@ export declare class DraftAutoSaveManager {
268
290
  /**
269
291
  * Mark the current state as saved
270
292
  *
271
- * Updates the hash so the next saveIfDirty won't save unless there are new changes.
293
+ * Updates the hash so the next saveIfDirty won't save unless there are new
294
+ * changes, and removes the stored draft (a saved workflow has none).
272
295
  */
273
296
  markAsSaved(): void;
274
297
  /**
@@ -279,15 +302,6 @@ export declare class DraftAutoSaveManager {
279
302
  * @param newKey - The new storage key
280
303
  */
281
304
  updateStorageKey(newKey: string): void;
282
- /**
283
- * Simple hash function for change detection
284
- *
285
- * Not cryptographically secure, just for detecting changes.
286
- *
287
- * @param workflow - The workflow to hash
288
- * @returns A simple hash string
289
- */
290
- private hashWorkflow;
291
305
  /**
292
306
  * Check if auto-save is currently running
293
307
  */