@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.10

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 (228) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/MIGRATION-2.0.md +173 -3
  3. package/README.md +5 -5
  4. package/dist/adapters/WorkflowAdapter.js +4 -5
  5. package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
  6. package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
  7. package/dist/api/enhanced-client.js +6 -11
  8. package/dist/commands/executor.js +51 -26
  9. package/dist/commands/storeIntegration.svelte.js +11 -1
  10. package/dist/commands/types.js +5 -5
  11. package/dist/components/App.svelte +547 -386
  12. package/dist/components/App.svelte.d.ts +16 -8
  13. package/dist/components/Button.stories.svelte +65 -0
  14. package/dist/components/Button.stories.svelte.d.ts +19 -0
  15. package/dist/components/Button.svelte +62 -0
  16. package/dist/components/Button.svelte.d.ts +24 -0
  17. package/dist/components/CanvasIconButton.svelte +76 -0
  18. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  19. package/dist/components/ConfigForm.svelte +167 -562
  20. package/dist/components/ConfigForm.svelte.d.ts +24 -7
  21. package/dist/components/ConfigModal.svelte +9 -1
  22. package/dist/components/ConfigPanel.svelte +234 -15
  23. package/dist/components/ConfigPanel.svelte.d.ts +6 -0
  24. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  25. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  26. package/dist/components/EditorStatusBar.svelte +99 -0
  27. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  28. package/dist/components/IconButton.svelte +80 -0
  29. package/dist/components/IconButton.svelte.d.ts +30 -0
  30. package/dist/components/Input.svelte +74 -0
  31. package/dist/components/Input.svelte.d.ts +17 -0
  32. package/dist/components/LogoWordmark.svelte +113 -0
  33. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  34. package/dist/components/Navbar.svelte +17 -63
  35. package/dist/components/Navbar.svelte.d.ts +3 -0
  36. package/dist/components/NodeSidebar.svelte +21 -126
  37. package/dist/components/NodeSwapPicker.svelte +12 -30
  38. package/dist/components/PipelineStatus.svelte +6 -1
  39. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  40. package/dist/components/PortMappingRow.svelte +0 -2
  41. package/dist/components/SchemaForm.svelte +4 -14
  42. package/dist/components/Select.svelte +53 -0
  43. package/dist/components/Select.svelte.d.ts +15 -0
  44. package/dist/components/SettingsModal.svelte +0 -5
  45. package/dist/components/SettingsPanel.svelte +24 -6
  46. package/dist/components/Textarea.svelte +39 -0
  47. package/dist/components/Textarea.svelte.d.ts +12 -0
  48. package/dist/components/ThemeToggle.svelte +15 -94
  49. package/dist/components/UniversalNode.svelte +36 -4
  50. package/dist/components/UniversalNode.svelte.d.ts +1 -1
  51. package/dist/components/WorkflowEditor.svelte +66 -52
  52. package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
  53. package/dist/components/chat/AIChatPanel.svelte +7 -2
  54. package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
  55. package/dist/components/console/ConsoleInput.svelte +3 -3
  56. package/dist/components/console/ConsoleOutput.svelte +2 -2
  57. package/dist/components/form/FormArray.svelte +37 -173
  58. package/dist/components/form/FormAutocomplete.svelte +18 -15
  59. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  60. package/dist/components/form/FormCodeEditor.svelte +9 -7
  61. package/dist/components/form/FormField.svelte +18 -42
  62. package/dist/components/form/FormFieldLight.svelte +52 -48
  63. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  64. package/dist/components/form/FormFieldset.svelte +45 -11
  65. package/dist/components/form/FormMarkdownEditor.svelte +8 -5
  66. package/dist/components/form/FormNumberField.svelte +4 -36
  67. package/dist/components/form/FormPorts.svelte +262 -0
  68. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  69. package/dist/components/form/FormRangeField.svelte +61 -30
  70. package/dist/components/form/FormSelect.svelte +13 -75
  71. package/dist/components/form/FormTemplateEditor.svelte +6 -4
  72. package/dist/components/form/FormTextField.svelte +3 -35
  73. package/dist/components/form/FormTextarea.svelte +4 -39
  74. package/dist/components/form/FormToggle.svelte +0 -4
  75. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  76. package/dist/components/form/resolveFieldType.d.ts +24 -0
  77. package/dist/components/form/resolveFieldType.js +55 -0
  78. package/dist/components/icons/CloseIcon.svelte +6 -0
  79. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  80. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  81. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  82. package/dist/components/icons/MenuIcon.svelte +4 -0
  83. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  84. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  85. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  86. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  87. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  88. package/dist/components/interrupt/InterruptBubble.svelte +11 -12
  89. package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
  90. package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
  91. package/dist/components/layouts/MainLayout.svelte +4 -5
  92. package/dist/components/nodes/AtomNode.svelte +62 -76
  93. package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
  94. package/dist/components/nodes/GatewayNode.svelte +117 -164
  95. package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
  96. package/dist/components/nodes/IdeaNode.svelte +72 -98
  97. package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
  98. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  99. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  100. package/dist/components/nodes/NotesNode.svelte +76 -85
  101. package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
  102. package/dist/components/nodes/SimpleNode.svelte +59 -133
  103. package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
  104. package/dist/components/nodes/SquareNode.svelte +110 -164
  105. package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
  106. package/dist/components/nodes/TerminalNode.svelte +62 -124
  107. package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
  108. package/dist/components/nodes/ToolNode.svelte +92 -103
  109. package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
  110. package/dist/components/nodes/WorkflowNode.svelte +132 -191
  111. package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
  112. package/dist/components/playground/ChatInput.svelte +0 -1
  113. package/dist/components/playground/InputCollector.svelte +11 -48
  114. package/dist/components/playground/PipelineKanbanView.svelte +6 -4
  115. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  116. package/dist/components/playground/PipelinePanel.svelte +20 -3
  117. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  118. package/dist/components/playground/PipelineTableView.svelte +6 -4
  119. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  120. package/dist/components/playground/Playground.svelte +76 -25
  121. package/dist/components/playground/Playground.svelte.d.ts +3 -0
  122. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  123. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  124. package/dist/components/playground/PlaygroundModal.svelte +5 -0
  125. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  126. package/dist/components/playground/PlaygroundStudio.svelte +7 -6
  127. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  128. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
  129. package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
  130. package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
  131. package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
  132. package/dist/components/surfaces/TabbedSurface.svelte +133 -0
  133. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
  134. package/dist/config/endpoints.d.ts +23 -0
  135. package/dist/config/endpoints.js +28 -0
  136. package/dist/core/index.d.ts +2 -3
  137. package/dist/core/index.js +2 -6
  138. package/dist/display/index.d.ts +6 -1
  139. package/dist/display/index.js +9 -1
  140. package/dist/editor/index.d.ts +1 -1
  141. package/dist/editor/index.js +1 -1
  142. package/dist/form/full.d.ts +2 -1
  143. package/dist/form/full.js +4 -1
  144. package/dist/form/index.d.ts +0 -1
  145. package/dist/form/index.js +3 -2
  146. package/dist/helpers/workflowEditorHelper.d.ts +4 -2
  147. package/dist/helpers/workflowEditorHelper.js +8 -8
  148. package/dist/messages/index.d.ts +1 -1
  149. package/dist/messages/index.js +1 -1
  150. package/dist/openapi/v1/openapi.yaml +35 -23
  151. package/dist/playground/index.d.ts +2 -2
  152. package/dist/playground/index.js +2 -2
  153. package/dist/playground/mount.d.ts +19 -5
  154. package/dist/playground/mount.js +16 -8
  155. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  156. package/dist/registry/builtinNodeTypes.js +67 -0
  157. package/dist/registry/builtinNodes.d.ts +2 -39
  158. package/dist/registry/builtinNodes.js +6 -53
  159. package/dist/registry/nodeComponentRegistry.d.ts +2 -1
  160. package/dist/schemas/v1/workflow.schema.json +16 -14
  161. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  162. package/dist/services/agentSpecExecutionService.js +0 -2
  163. package/dist/services/apiVariableService.js +12 -26
  164. package/dist/services/categoriesApi.js +3 -6
  165. package/dist/services/chatService.d.ts +4 -3
  166. package/dist/services/chatService.js +13 -18
  167. package/dist/services/dynamicSchemaService.d.ts +31 -4
  168. package/dist/services/dynamicSchemaService.js +62 -33
  169. package/dist/services/historyService.d.ts +30 -8
  170. package/dist/services/historyService.js +51 -15
  171. package/dist/services/interruptService.d.ts +7 -6
  172. package/dist/services/interruptService.js +19 -21
  173. package/dist/services/playgroundService.d.ts +9 -8
  174. package/dist/services/playgroundService.js +23 -25
  175. package/dist/services/portConfigApi.js +3 -6
  176. package/dist/services/settingsService.d.ts +9 -4
  177. package/dist/services/settingsService.js +23 -12
  178. package/dist/skins/drafter.d.ts +30 -0
  179. package/dist/skins/drafter.js +198 -0
  180. package/dist/skins/index.d.ts +2 -1
  181. package/dist/skins/index.js +4 -2
  182. package/dist/stores/apiContext.d.ts +11 -0
  183. package/dist/stores/apiContext.js +15 -0
  184. package/dist/stores/categoriesStore.svelte.js +0 -1
  185. package/dist/stores/historyStore.svelte.d.ts +17 -3
  186. package/dist/stores/historyStore.svelte.js +30 -3
  187. package/dist/stores/instanceContainer.svelte.js +5 -0
  188. package/dist/stores/playgroundStore.svelte.js +1 -3
  189. package/dist/stores/settingsStore.svelte.d.ts +13 -0
  190. package/dist/stores/settingsStore.svelte.js +32 -0
  191. package/dist/stores/workflowStore.svelte.d.ts +42 -5
  192. package/dist/stores/workflowStore.svelte.js +109 -32
  193. package/dist/styles/base.css +285 -14
  194. package/dist/styles/tokens.css +60 -2
  195. package/dist/svelte-app.d.ts +18 -1
  196. package/dist/svelte-app.js +75 -110
  197. package/dist/themes/drafter.d.ts +2 -0
  198. package/dist/themes/drafter.js +15 -0
  199. package/dist/themes/index.d.ts +2 -1
  200. package/dist/themes/index.js +8 -2
  201. package/dist/types/auth.d.ts +9 -51
  202. package/dist/types/auth.js +4 -54
  203. package/dist/types/events.d.ts +18 -0
  204. package/dist/types/events.js +2 -1
  205. package/dist/types/index.d.ts +84 -29
  206. package/dist/types/index.js +0 -1
  207. package/dist/types/settings.d.ts +17 -1
  208. package/dist/types/settings.js +4 -2
  209. package/dist/types/skin.d.ts +1 -1
  210. package/dist/types/theme.d.ts +16 -2
  211. package/dist/types/uischema.d.ts +5 -0
  212. package/dist/utils/colors.d.ts +27 -0
  213. package/dist/utils/colors.js +23 -0
  214. package/dist/utils/connections.js +20 -56
  215. package/dist/utils/edgeStyling.js +9 -5
  216. package/dist/utils/fetchWithAuth.d.ts +36 -15
  217. package/dist/utils/fetchWithAuth.js +53 -23
  218. package/dist/utils/nodeIds.d.ts +1 -1
  219. package/dist/utils/nodeIds.js +1 -1
  220. package/dist/utils/nodeSwap.js +3 -6
  221. package/dist/utils/nodeTypes.js +1 -1
  222. package/dist/utils/portUtils.d.ts +47 -11
  223. package/dist/utils/portUtils.js +67 -14
  224. package/dist/utils/portal.d.ts +18 -0
  225. package/dist/utils/portal.js +34 -0
  226. package/dist/utils/schemaMerge.d.ts +25 -0
  227. package/dist/utils/schemaMerge.js +61 -0
  228. package/package.json +2 -1
@@ -8,6 +8,7 @@
8
8
  import { logger } from '../../utils/logger.js';
9
9
  import type { Workflow, PipelineViewDef } from '../../types/index.js';
10
10
  import type { EndpointConfig } from '../../config/endpoints.js';
11
+ import type { AuthProvider } from '../../types/auth.js';
11
12
  import type { PlaygroundConfig, PlaygroundMode } from '../../types/playground.js';
12
13
 
13
14
  interface Props {
@@ -17,6 +18,8 @@
17
18
  workflow?: Workflow;
18
19
  /** API endpoint configuration */
19
20
  endpointConfig?: EndpointConfig;
21
+ /** Auth provider applied to this instance's API requests. */
22
+ authProvider?: AuthProvider;
20
23
  /** Display mode (default: standalone) */
21
24
  mode?: PlaygroundMode;
22
25
  /** Session ID to activate on mount. Changing this prop remounts the Playground. */
@@ -43,6 +46,7 @@
43
46
  workflowId,
44
47
  workflow: workflowProp,
45
48
  endpointConfig,
49
+ authProvider,
46
50
  mode = 'standalone',
47
51
  initialSessionId,
48
52
  config = {},
@@ -99,7 +103,7 @@
99
103
  fd.pipelinePanel.setOpen(initialPipelineOpen);
100
104
  }
101
105
  if (endpointConfig) {
102
- fd.api.configure(endpointConfig);
106
+ fd.api.configure(endpointConfig, authProvider);
103
107
  }
104
108
  if (!workflowProp) {
105
109
  void loadWorkflow();
@@ -182,6 +186,7 @@
182
186
  pipelineId={activeId}
183
187
  workflow={resolvedWorkflow}
184
188
  {endpointConfig}
189
+ {authProvider}
185
190
  isPinned={fd.playground.pinnedExecutionId !== null}
186
191
  {executions}
187
192
  latestExecutionId={fd.playground.latestExecutionId}
@@ -238,6 +243,7 @@
238
243
  {workflowId}
239
244
  workflow={resolvedWorkflow}
240
245
  {endpointConfig}
246
+ {authProvider}
241
247
  {mode}
242
248
  {initialSessionId}
243
249
  {config}
@@ -457,11 +463,6 @@
457
463
  .playground-studio__back-to-chat:hover {
458
464
  background-color: var(--fd-muted);
459
465
  }
460
-
461
- .playground-studio__back-to-chat:focus-visible {
462
- outline: 2px solid var(--fd-ring);
463
- outline-offset: 2px;
464
- }
465
466
  }
466
467
 
467
468
  @media (prefers-reduced-motion: reduce) {
@@ -1,6 +1,7 @@
1
1
  import type { FlowDropInstance } from '../../stores/instanceContainer.svelte.js';
2
2
  import type { Workflow, PipelineViewDef } from '../../types/index.js';
3
3
  import type { EndpointConfig } from '../../config/endpoints.js';
4
+ import type { AuthProvider } from '../../types/auth.js';
4
5
  import type { PlaygroundConfig, PlaygroundMode } from '../../types/playground.js';
5
6
  interface Props {
6
7
  /** Target workflow ID */
@@ -9,6 +10,8 @@ interface Props {
9
10
  workflow?: Workflow;
10
11
  /** API endpoint configuration */
11
12
  endpointConfig?: EndpointConfig;
13
+ /** Auth provider applied to this instance's API requests. */
14
+ authProvider?: AuthProvider;
12
15
  /** Display mode (default: standalone) */
13
16
  mode?: PlaygroundMode;
14
17
  /** Session ID to activate on mount. Changing this prop remounts the Playground. */
@@ -1,4 +1,5 @@
1
1
  import type { EndpointConfig } from '../../config/endpoints.js';
2
+ import type { AuthProvider } from '../../types/auth.js';
2
3
  import type { NodeExecutionStatus, KanbanColumnDef } from '../../types/index.js';
3
4
  export type NodeStatus = NodeExecutionStatus;
4
5
  export interface NodeStatusData {
@@ -40,7 +41,7 @@ export declare function resolveStatus(raw: NodeStatusData | undefined): NodeStat
40
41
  * `endpointConfig` is used once to construct the API client — it must be stable.
41
42
  * `getPipelineId` is called on every fetch so pipeline ID changes are picked up.
42
43
  */
43
- export declare function createPipelineDataFetcher(getPipelineId: () => string, endpointConfig: EndpointConfig): {
44
+ export declare function createPipelineDataFetcher(getPipelineId: () => string, endpointConfig: EndpointConfig, authProvider?: AuthProvider): {
44
45
  readonly nodeStatusMap: Record<string, NodeStatusData>;
45
46
  readonly jobs: PipelineJobItem[];
46
47
  readonly kanbanConfig: KanbanColumnDef[] | null;
@@ -55,8 +55,8 @@ export function resolveStatus(raw) {
55
55
  * `endpointConfig` is used once to construct the API client — it must be stable.
56
56
  * `getPipelineId` is called on every fetch so pipeline ID changes are picked up.
57
57
  */
58
- export function createPipelineDataFetcher(getPipelineId, endpointConfig) {
59
- const client = new EnhancedFlowDropApiClient(endpointConfig);
58
+ export function createPipelineDataFetcher(getPipelineId, endpointConfig, authProvider) {
59
+ const client = new EnhancedFlowDropApiClient(endpointConfig, authProvider);
60
60
  let nodeStatusMap = $state({});
61
61
  let jobs = $state([]);
62
62
  let kanbanConfig = $state(null);
@@ -0,0 +1,153 @@
1
+ <!--
2
+ SurfaceOverlay
3
+ A reusable centered modal shell used to host a surface (or a TabbedSurface of
4
+ several) in the `modal` placement. Portals to `document.body` so the fixed
5
+ backdrop escapes any ancestor that establishes a containing block (transform,
6
+ filter, backdrop-filter, …). Esc and backdrop-click close it.
7
+
8
+ Promotes the modal shell first built inline in ConfigPanel so config, console,
9
+ and chat can all float when their placement is `modal`.
10
+ -->
11
+
12
+ <script lang="ts">
13
+ import type { Snippet } from 'svelte';
14
+ import { portal } from '../../utils/portal.js';
15
+
16
+ interface Props {
17
+ /** Header title. */
18
+ title: string;
19
+ /** Accessible label for the close button. */
20
+ closeLabel?: string;
21
+ /** Called on Esc, backdrop click, or the close button. */
22
+ onClose: () => void;
23
+ /** Overlay body. */
24
+ children: Snippet;
25
+ }
26
+
27
+ const { title, closeLabel = 'Close', onClose, children }: Props = $props();
28
+
29
+ const uid = $props.id();
30
+ const titleId = `${uid}-surface-overlay-title`;
31
+
32
+ function handleKeydown(event: KeyboardEvent) {
33
+ if (event.key === 'Escape') {
34
+ event.stopPropagation();
35
+ onClose();
36
+ }
37
+ }
38
+
39
+ function handleBackdropClick(event: MouseEvent) {
40
+ if (event.target === event.currentTarget) {
41
+ onClose();
42
+ }
43
+ }
44
+ </script>
45
+
46
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
47
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
48
+ <div
49
+ class="surface-overlay__backdrop"
50
+ use:portal
51
+ onclick={handleBackdropClick}
52
+ onkeydown={handleKeydown}
53
+ >
54
+ <div
55
+ class="surface-overlay"
56
+ role="dialog"
57
+ aria-modal="true"
58
+ aria-labelledby={titleId}
59
+ tabindex="-1"
60
+ >
61
+ <div class="surface-overlay__header">
62
+ <h2 id={titleId} class="surface-overlay__title">{title}</h2>
63
+ <button class="surface-overlay__close" onclick={onClose} aria-label={closeLabel}> × </button>
64
+ </div>
65
+ <div class="surface-overlay__body">
66
+ {@render children()}
67
+ </div>
68
+ </div>
69
+ </div>
70
+
71
+ <style>
72
+ .surface-overlay__backdrop {
73
+ position: fixed;
74
+ inset: 0;
75
+ /*
76
+ Portalled to document.body, this shell sits outside the editor container
77
+ that carries the app font, so it would otherwise inherit the host page's
78
+ default (e.g. serif on a bare Drupal page). Re-establish the font here,
79
+ mirroring the mount container's declaration.
80
+ */
81
+ font-family: var(--fd-font-family, system-ui, -apple-system, sans-serif);
82
+ background-color: var(--fd-backdrop, rgba(0, 0, 0, 0.5));
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ z-index: 1000;
87
+ padding: 1rem;
88
+ }
89
+
90
+ .surface-overlay {
91
+ display: flex;
92
+ flex-direction: column;
93
+ width: 100%;
94
+ max-width: 48rem;
95
+ max-height: 90vh;
96
+ background-color: var(--fd-panel-bg, var(--fd-card));
97
+ border: 1px solid var(--fd-border);
98
+ border-radius: var(--fd-radius-lg, 0.75rem);
99
+ box-shadow: var(--fd-shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.25));
100
+ overflow: hidden;
101
+ }
102
+
103
+ .surface-overlay__header {
104
+ display: flex;
105
+ justify-content: space-between;
106
+ align-items: center;
107
+ padding: 0.875rem 1rem;
108
+ border-bottom: 1px solid var(--fd-border);
109
+ background-color: var(--fd-card);
110
+ flex-shrink: 0;
111
+ }
112
+
113
+ .surface-overlay__title {
114
+ margin: 0;
115
+ font-size: 1rem;
116
+ font-weight: 600;
117
+ color: var(--fd-foreground);
118
+ }
119
+
120
+ .surface-overlay__close {
121
+ background: none;
122
+ border: none;
123
+ font-size: 1.25rem;
124
+ line-height: 1;
125
+ cursor: pointer;
126
+ color: var(--fd-muted-foreground);
127
+ padding: 0.25rem;
128
+ border-radius: var(--fd-radius-sm);
129
+ transition:
130
+ color var(--fd-transition-fast),
131
+ background-color var(--fd-transition-fast);
132
+ }
133
+
134
+ .surface-overlay__close:hover {
135
+ color: var(--fd-foreground);
136
+ background-color: var(--fd-subtle);
137
+ }
138
+
139
+ .surface-overlay__body {
140
+ flex: 1;
141
+ min-height: 0;
142
+ overflow-y: auto;
143
+ display: flex;
144
+ flex-direction: column;
145
+ }
146
+
147
+ @media (max-width: 640px) {
148
+ .surface-overlay {
149
+ max-width: 100%;
150
+ max-height: 95vh;
151
+ }
152
+ }
153
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ /** Header title. */
4
+ title: string;
5
+ /** Accessible label for the close button. */
6
+ closeLabel?: string;
7
+ /** Called on Esc, backdrop click, or the close button. */
8
+ onClose: () => void;
9
+ /** Overlay body. */
10
+ children: Snippet;
11
+ }
12
+ declare const SurfaceOverlay: import("svelte").Component<Props, {}, "">;
13
+ type SurfaceOverlay = ReturnType<typeof SurfaceOverlay>;
14
+ export default SurfaceOverlay;
@@ -0,0 +1,133 @@
1
+ <!--
2
+ TabbedSurface
3
+ A reusable tabbed container that hosts one or more "surfaces" (config panel,
4
+ console, AI Assistant). Promotes the bottom-panel tab strip so the same
5
+ container can host surfaces in the sidebar, bottom panel, or a modal overlay.
6
+
7
+ All tab bodies stay mounted (toggled via `display`) so surface state — console
8
+ scrollback, chat history, in-progress form edits — survives tab switches. The
9
+ tab bar hides itself when only a single surface is present, so a lone surface
10
+ reads as a plain panel with no redundant chrome.
11
+ -->
12
+
13
+ <script lang="ts">
14
+ import type { Snippet } from 'svelte';
15
+
16
+ /** A single hostable surface. */
17
+ export interface SurfaceTab {
18
+ /** Stable identifier, unique within the host. */
19
+ id: string;
20
+ /** Tab-strip label. */
21
+ label: string;
22
+ /** Body content. Rendered once — a surface has exactly one host. */
23
+ content: Snippet;
24
+ /**
25
+ * `display` value applied while active. Some surfaces (the console) expect
26
+ * to be a direct flex child of the content area and use `contents`; most
27
+ * use `flex`. Defaults to `flex`.
28
+ */
29
+ display?: 'flex' | 'contents';
30
+ }
31
+
32
+ interface Props {
33
+ /** Surfaces to host, in tab order. */
34
+ tabs: SurfaceTab[];
35
+ /** Currently active tab id. */
36
+ activeId: string;
37
+ /** Called when a tab is selected. */
38
+ onSelect: (id: string) => void;
39
+ }
40
+
41
+ const { tabs, activeId, onSelect }: Props = $props();
42
+
43
+ // Fall back to the first tab when `activeId` doesn't match any present tab
44
+ // (e.g. the active surface was just routed to a different host).
45
+ const resolvedActiveId = $derived(
46
+ tabs.some((t) => t.id === activeId) ? activeId : (tabs[0]?.id ?? '')
47
+ );
48
+ </script>
49
+
50
+ <div class="tabbed-surface">
51
+ {#if tabs.length > 1}
52
+ <div class="tabbed-surface__bar" role="tablist">
53
+ {#each tabs as tab (tab.id)}
54
+ <button
55
+ class="tabbed-surface__tab {tab.id === resolvedActiveId
56
+ ? 'tabbed-surface__tab--active'
57
+ : ''}"
58
+ role="tab"
59
+ aria-selected={tab.id === resolvedActiveId}
60
+ onclick={() => onSelect(tab.id)}
61
+ >
62
+ {tab.label}
63
+ </button>
64
+ {/each}
65
+ </div>
66
+ {/if}
67
+
68
+ <div class="tabbed-surface__content">
69
+ {#each tabs as tab (tab.id)}
70
+ <div
71
+ class="tabbed-surface__panel"
72
+ style:display={tab.id === resolvedActiveId ? (tab.display ?? 'flex') : 'none'}
73
+ >
74
+ {@render tab.content()}
75
+ </div>
76
+ {/each}
77
+ </div>
78
+ </div>
79
+
80
+ <style>
81
+ .tabbed-surface {
82
+ display: flex;
83
+ flex-direction: column;
84
+ height: 100%;
85
+ overflow: hidden;
86
+ }
87
+
88
+ .tabbed-surface__bar {
89
+ display: flex;
90
+ gap: 0;
91
+ background: var(--fd-muted);
92
+ border-bottom: 1px solid var(--fd-border);
93
+ flex-shrink: 0;
94
+ }
95
+
96
+ .tabbed-surface__tab {
97
+ padding: 0.375rem 0.75rem;
98
+ font-size: 0.75rem;
99
+ font-weight: 500;
100
+ cursor: pointer;
101
+ border: none;
102
+ border-bottom: 2px solid transparent;
103
+ background: transparent;
104
+ color: var(--fd-muted-foreground);
105
+ transition: all var(--fd-transition-fast);
106
+ }
107
+
108
+ .tabbed-surface__tab:hover {
109
+ color: var(--fd-foreground);
110
+ background: var(--fd-background);
111
+ }
112
+
113
+ .tabbed-surface__tab--active {
114
+ color: var(--fd-foreground);
115
+ border-bottom-color: var(--fd-primary);
116
+ background: var(--fd-background);
117
+ }
118
+
119
+ .tabbed-surface__content {
120
+ flex: 1;
121
+ min-height: 0;
122
+ overflow: hidden;
123
+ display: flex;
124
+ flex-direction: column;
125
+ }
126
+
127
+ .tabbed-surface__panel {
128
+ flex: 1;
129
+ min-height: 0;
130
+ overflow: hidden;
131
+ flex-direction: column;
132
+ }
133
+ </style>
@@ -0,0 +1,27 @@
1
+ import type { Snippet } from 'svelte';
2
+ /** A single hostable surface. */
3
+ export interface SurfaceTab {
4
+ /** Stable identifier, unique within the host. */
5
+ id: string;
6
+ /** Tab-strip label. */
7
+ label: string;
8
+ /** Body content. Rendered once — a surface has exactly one host. */
9
+ content: Snippet;
10
+ /**
11
+ * `display` value applied while active. Some surfaces (the console) expect
12
+ * to be a direct flex child of the content area and use `contents`; most
13
+ * use `flex`. Defaults to `flex`.
14
+ */
15
+ display?: 'flex' | 'contents';
16
+ }
17
+ interface Props {
18
+ /** Surfaces to host, in tab order. */
19
+ tabs: SurfaceTab[];
20
+ /** Currently active tab id. */
21
+ activeId: string;
22
+ /** Called when a tab is selected. */
23
+ onSelect: (id: string) => void;
24
+ }
25
+ declare const TabbedSurface: import("svelte").Component<Props, {}, "">;
26
+ type TabbedSurface = ReturnType<typeof TabbedSurface>;
27
+ export default TabbedSurface;
@@ -3,6 +3,7 @@
3
3
  * Provides configurable endpoints for all API actions
4
4
  */
5
5
  import type { AgentSpecEndpointConfig } from './agentSpecEndpoints.js';
6
+ import type { AuthProvider } from '../types/auth.js';
6
7
  export interface EndpointConfig {
7
8
  /** Base URL for all endpoints */
8
9
  baseUrl: string;
@@ -159,3 +160,25 @@ export declare function getEndpointMethod(config: EndpointConfig, endpointKey: s
159
160
  * Get custom headers for an endpoint
160
161
  */
161
162
  export declare function getEndpointHeaders(config: EndpointConfig, endpointKey: string): Record<string, string>;
163
+ /**
164
+ * Build request headers for an endpoint, layering the auth provider's headers
165
+ * over the static endpoint headers.
166
+ *
167
+ * This is the single header-building path shared by the per-instance services
168
+ * (playground, chat, interrupt, settings, port config, categories). Routing all
169
+ * of them through this helper guarantees a configured {@link AuthProvider}
170
+ * authenticates every request consistently — matching the behaviour of
171
+ * {@link EnhancedFlowDropApiClient}, which owns the equivalent merge for the
172
+ * typed workflow/node API.
173
+ *
174
+ * `getAuthHeaders()` is awaited per call so providers can return freshly
175
+ * refreshed tokens. When no provider is supplied the result is identical to
176
+ * {@link getEndpointHeaders} (no auth) — keeping unauthenticated callers
177
+ * working unchanged.
178
+ *
179
+ * @param config - The endpoint configuration
180
+ * @param endpointKey - Key identifying the endpoint (for static header lookup)
181
+ * @param authProvider - Optional auth provider supplying `Authorization` etc.
182
+ * @returns Merged headers: static endpoint headers < auth headers
183
+ */
184
+ export declare function getRequestHeaders(config: EndpointConfig, endpointKey: string, authProvider?: AuthProvider): Promise<Record<string, string>>;
@@ -141,3 +141,31 @@ export function getEndpointHeaders(config, endpointKey) {
141
141
  }
142
142
  return baseHeaders;
143
143
  }
144
+ /**
145
+ * Build request headers for an endpoint, layering the auth provider's headers
146
+ * over the static endpoint headers.
147
+ *
148
+ * This is the single header-building path shared by the per-instance services
149
+ * (playground, chat, interrupt, settings, port config, categories). Routing all
150
+ * of them through this helper guarantees a configured {@link AuthProvider}
151
+ * authenticates every request consistently — matching the behaviour of
152
+ * {@link EnhancedFlowDropApiClient}, which owns the equivalent merge for the
153
+ * typed workflow/node API.
154
+ *
155
+ * `getAuthHeaders()` is awaited per call so providers can return freshly
156
+ * refreshed tokens. When no provider is supplied the result is identical to
157
+ * {@link getEndpointHeaders} (no auth) — keeping unauthenticated callers
158
+ * working unchanged.
159
+ *
160
+ * @param config - The endpoint configuration
161
+ * @param endpointKey - Key identifying the endpoint (for static header lookup)
162
+ * @param authProvider - Optional auth provider supplying `Authorization` etc.
163
+ * @returns Merged headers: static endpoint headers < auth headers
164
+ */
165
+ export async function getRequestHeaders(config, endpointKey, authProvider) {
166
+ const headers = getEndpointHeaders(config, endpointKey);
167
+ if (authProvider) {
168
+ Object.assign(headers, await authProvider.getAuthHeaders());
169
+ }
170
+ return headers;
171
+ }
@@ -16,7 +16,7 @@
16
16
  */
17
17
  export type { WorkflowFormat, BuiltinWorkflowFormat } from '../types/index.js';
18
18
  export { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
19
- export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
19
+ export type { NodeCategory, BuiltinNodeCategory, CategoryDefinition, NodeDataType, NodePort, DynamicPort, Branch, NodeMetadata, NodeExtensions, NodeUIExtensions, PortsConfig, PortConfigEntry, ConfigValues, WorkflowNode, WorkflowEdge, Workflow, ApiResponse, NodesResponse, WorkflowResponse, WorkflowsResponse, ExecutionStatus, ExecutionResult, FlowDropConfig, WorkflowEvents, BuiltinNodeType, PortConfig, PortCompatibilityRule, ConfigSchema, ConfigProperty, HttpMethod, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, EdgeCategory, UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from '../types/index.js';
20
20
  export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from '../types/index.js';
21
21
  export type { WorkflowEditorConfig, EditorFeatures, UIConfig, APIConfig, ExecutionConfig, StorageConfig } from '../types/config.js';
22
22
  export type { AuthProvider, StaticAuthConfig, CallbackAuthConfig } from '../types/auth.js';
@@ -68,7 +68,7 @@ export { computeAutoLayout } from '../adapters/agentspec/autoLayout.js';
68
68
  export type { AutoLayoutConfig } from '../adapters/agentspec/autoLayout.js';
69
69
  export type { AgentSpecEndpointConfig } from '../config/agentSpecEndpoints.js';
70
70
  export { defaultAgentSpecEndpoints, createAgentSpecEndpointConfig, buildAgentSpecUrl, getAgentSpecAuthHeaders } from '../config/agentSpecEndpoints.js';
71
- export { AgentSpecExecutionService, agentSpecExecutionService } from '../services/agentSpecExecutionService.js';
71
+ export { AgentSpecExecutionService } from '../services/agentSpecExecutionService.js';
72
72
  export type { AgentSpecExecutionHandle } from '../services/agentSpecExecutionService.js';
73
73
  export { workflowSchema, WORKFLOW_SCHEMA_VERSION } from '../schemas/index.js';
74
74
  export type { FlowDropTheme, FlowDropThemeName, FlowDropThemeConfig } from '../types/theme.js';
@@ -77,7 +77,6 @@ export type { FlowDropSkin, FlowDropSkinName, FlowDropSkinTokens } from '../type
77
77
  export { slateSkin, defaultSkin } from '../skins/index.js';
78
78
  export type { ThemePreference, ResolvedTheme } from '../stores/settingsStore.svelte.js';
79
79
  export { getTheme as theme, getResolvedTheme as resolvedTheme, setTheme, toggleTheme, cycleTheme, initializeTheme, isThemeInitialized } from '../stores/settingsStore.svelte.js';
80
- export { sanitizeHtml } from '../utils/sanitize.js';
81
80
  export { logger, setLogLevel, getLogLevel } from '../utils/logger.js';
82
81
  export type { LogLevel } from '../utils/logger.js';
83
82
  export { computeSwapPreview, computeSwapPreviewWithOptions, executeSwap, mapConfig, getVersionUpgrade, compareSemver, performSwap, validateSwapResult, SwapValidationError } from '../utils/nodeSwap.js';
@@ -80,8 +80,8 @@ export { validateForAgentSpecExport, validateAgentSpecFlow } from '../adapters/a
80
80
  // Agent Spec auto-layout
81
81
  export { computeAutoLayout } from '../adapters/agentspec/autoLayout.js';
82
82
  export { defaultAgentSpecEndpoints, createAgentSpecEndpointConfig, buildAgentSpecUrl, getAgentSpecAuthHeaders } from '../config/agentSpecEndpoints.js';
83
- // Agent Spec execution service
84
- export { AgentSpecExecutionService, agentSpecExecutionService } from '../services/agentSpecExecutionService.js';
83
+ // Agent Spec execution service (instantiate per instance — no global singleton)
84
+ export { AgentSpecExecutionService } from '../services/agentSpecExecutionService.js';
85
85
  // ============================================================================
86
86
  // Workflow JSON Schema
87
87
  // ============================================================================
@@ -90,10 +90,6 @@ export { defaultTheme, minimalTheme, resolveTheme } from '../themes/index.js';
90
90
  export { slateSkin, defaultSkin } from '../skins/index.js';
91
91
  export { getTheme as theme, getResolvedTheme as resolvedTheme, setTheme, toggleTheme, cycleTheme, initializeTheme, isThemeInitialized } from '../stores/settingsStore.svelte.js';
92
92
  // ============================================================================
93
- // HTML Sanitization
94
- // ============================================================================
95
- export { sanitizeHtml } from '../utils/sanitize.js';
96
- // ============================================================================
97
93
  // Logger
98
94
  // ============================================================================
99
95
  export { logger, setLogLevel, getLogLevel } from '../utils/logger.js';
@@ -5,9 +5,13 @@
5
5
  *
6
6
  * @module display
7
7
  *
8
+ * This entry renders user/API-provided HTML, so it pulls in the HTML sanitizer
9
+ * (DOMPurify). `sanitizeHtml` is exposed here — rather than from
10
+ * `@flowdrop/flowdrop/core` — to keep `core` free of that heavier dependency.
11
+ *
8
12
  * @example
9
13
  * ```typescript
10
- * import { MarkdownDisplay } from "@flowdrop/flowdrop/display";
14
+ * import { MarkdownDisplay, sanitizeHtml } from "@flowdrop/flowdrop/display";
11
15
  * ```
12
16
  *
13
17
  * @example In Svelte:
@@ -25,3 +29,4 @@
25
29
  * ```
26
30
  */
27
31
  export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte';
32
+ export { sanitizeHtml } from '../utils/sanitize.js';
@@ -5,9 +5,13 @@
5
5
  *
6
6
  * @module display
7
7
  *
8
+ * This entry renders user/API-provided HTML, so it pulls in the HTML sanitizer
9
+ * (DOMPurify). `sanitizeHtml` is exposed here — rather than from
10
+ * `@flowdrop/flowdrop/core` — to keep `core` free of that heavier dependency.
11
+ *
8
12
  * @example
9
13
  * ```typescript
10
- * import { MarkdownDisplay } from "@flowdrop/flowdrop/display";
14
+ * import { MarkdownDisplay, sanitizeHtml } from "@flowdrop/flowdrop/display";
11
15
  * ```
12
16
  *
13
17
  * @example In Svelte:
@@ -28,3 +32,7 @@
28
32
  // Display Components
29
33
  // ============================================================================
30
34
  export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte';
35
+ // ============================================================================
36
+ // HTML Sanitization (DOMPurify-backed — lives here, not in core)
37
+ // ============================================================================
38
+ export { sanitizeHtml } from '../utils/sanitize.js';
@@ -74,7 +74,7 @@ export { PortCoordinateStore } from '../stores/portCoordinateStore.svelte.js';
74
74
  export { HistoryService } from '../services/historyService.js';
75
75
  export type { HistoryEntry, HistoryState, PushOptions } from '../stores/historyStore.svelte.js';
76
76
  export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from '../services/toastService.js';
77
- export { NodeExecutionService, nodeExecutionService } from '../services/nodeExecutionService.js';
77
+ export { NodeExecutionService } from '../services/nodeExecutionService.js';
78
78
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
79
79
  export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
80
80
  export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
@@ -109,7 +109,7 @@ export { HistoryService } from '../services/historyService.js';
109
109
  // Services
110
110
  // ============================================================================
111
111
  export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from '../services/toastService.js';
112
- export { NodeExecutionService, nodeExecutionService } from '../services/nodeExecutionService.js';
112
+ export { NodeExecutionService } from '../services/nodeExecutionService.js';
113
113
  export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
114
114
  export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
115
115
  export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
@@ -20,7 +20,8 @@
20
20
  * // Now all field types are available
21
21
  * ```
22
22
  */
23
- export { SchemaForm, FormField, FormFieldFull, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
23
+ export { default as FormFieldFull } from '../components/form/FormField.svelte';
24
+ export { SchemaForm, FormField, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
24
25
  export type { FieldSchema, FieldType, FieldFormat, FieldOption, OneOfItem, SchemaFormProps, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, FormFieldFactoryProps, FormFieldWrapperProps, FieldComponentProps, FieldMatcher, FieldMatcherRegistration, FieldComponent, FieldComponentRegistration } from './index.js';
25
26
  export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, getSchemaOptions } from './index.js';
26
27
  export { FieldComponentRegistry, hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from './index.js';
package/dist/form/full.js CHANGED
@@ -21,8 +21,11 @@
21
21
  * ```
22
22
  */
23
23
  // Re-export everything from the light form module
24
+ // The "everything statically bundled" FormField variant lives here (this is the
25
+ // heavy entry), not in the light `@flowdrop/flowdrop/form`.
26
+ export { default as FormFieldFull } from '../components/form/FormField.svelte';
24
27
  // Components
25
- export { SchemaForm, FormField, FormFieldFull, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
28
+ export { SchemaForm, FormField, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
26
29
  // Utility functions
27
30
  export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, getSchemaOptions } from './index.js';
28
31
  // Field Registry
@@ -59,7 +59,6 @@
59
59
  */
60
60
  export { default as SchemaForm } from '../components/SchemaForm.svelte';
61
61
  export { default as FormField } from '../components/form/FormFieldLight.svelte';
62
- export { default as FormFieldFull } from '../components/form/FormField.svelte';
63
62
  export { default as FormFieldWrapper } from '../components/form/FormFieldWrapper.svelte';
64
63
  export { default as FormTextField } from '../components/form/FormTextField.svelte';
65
64
  export { default as FormTextarea } from '../components/form/FormTextarea.svelte';