@flowdrop/flowdrop 2.10.0 → 2.11.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.
- package/CHANGELOG.md +175 -0
- package/dist/components/App.svelte +112 -29
- package/dist/components/CanvasController.svelte +1 -1
- package/dist/components/ConfigForm.svelte +5 -5
- package/dist/components/ConfigModal.svelte +2 -2
- package/dist/components/ConfigModal.svelte.d.ts +1 -1
- package/dist/components/ConnectionLine.svelte +1 -1
- package/dist/components/EdgeRefresher.svelte +1 -1
- package/dist/components/FlowDropZone.svelte +11 -7
- package/dist/components/FlowDropZone.svelte.d.ts +12 -0
- package/dist/components/LogsSidebar.svelte +15 -12
- package/dist/components/MarkdownDisplay.svelte +1 -1
- package/dist/components/PipelineStatus.svelte +5 -18
- package/dist/components/PortCoordinateTracker.svelte +1 -1
- package/dist/components/SchemaForm.svelte +1 -1
- package/dist/components/SettingsModal.svelte +1 -1
- package/dist/components/SettingsPanel.svelte +1 -1
- package/dist/components/WorkflowEditor.svelte +200 -174
- package/dist/components/WorkflowInterfaceEditor.svelte +43 -8
- package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +12 -1
- package/dist/components/WorkflowInterfaceEntryCard.svelte +117 -44
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +14 -1
- package/dist/components/WorkflowPlaygroundSettings.svelte +551 -0
- package/dist/components/WorkflowPlaygroundSettings.svelte.d.ts +20 -0
- package/dist/components/chat/AIChatPanel.svelte +1 -1
- package/dist/components/form/index.d.ts +2 -2
- package/dist/components/form/index.js +2 -2
- package/dist/components/nodes/ToolNode.svelte +1 -1
- package/dist/components/playground/ControlPanel.svelte +30 -0
- package/dist/components/playground/ControlPanel.svelte.d.ts +5 -0
- package/dist/components/playground/Playground.svelte +94 -42
- package/dist/components/playground/PlaygroundApp.svelte +1 -1
- package/dist/components/playground/PlaygroundModal.svelte +1 -1
- package/dist/components/playground/PlaygroundStudio.svelte +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/helpers/workflowEditorHelper.d.ts +12 -0
- package/dist/helpers/workflowEditorHelper.js +31 -0
- package/dist/messages/defaults.d.ts +53 -0
- package/dist/messages/defaults.js +48 -2
- package/dist/openapi/v1/openapi.yaml +113 -5
- package/dist/playground/index.d.ts +3 -1
- package/dist/playground/index.js +2 -1
- package/dist/playground/mount.d.ts +6 -10
- package/dist/playground/mount.js +43 -24
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/v1/workflow.schema.json +140 -2
- package/dist/services/globalSave.js +11 -1
- package/dist/services/playgroundService.d.ts +6 -1
- package/dist/services/playgroundService.js +5 -0
- package/dist/skins/default.d.ts +1 -1
- package/dist/skins/drafter.d.ts +1 -1
- package/dist/skins/index.d.ts +4 -4
- package/dist/skins/index.js +3 -3
- package/dist/skins/slate.d.ts +1 -1
- package/dist/stores/instanceContainer.svelte.d.ts +15 -0
- package/dist/stores/instanceContainer.svelte.js +11 -1
- package/dist/stores/playgroundStore.svelte.d.ts +8 -0
- package/dist/stores/playgroundStore.svelte.js +18 -4
- package/dist/stores/workflowStore.svelte.d.ts +4 -1
- package/dist/stores/workflowStore.svelte.js +8 -1
- package/dist/styles/base.css +14 -3
- package/dist/styles/tokenAliases.d.ts +13 -0
- package/dist/styles/tokenAliases.js +89 -0
- package/dist/themes/scopedSkinCss.d.ts +30 -0
- package/dist/themes/scopedSkinCss.js +95 -0
- package/dist/types/index.d.ts +86 -4
- package/dist/types/index.js +15 -3
- package/dist/types/skin.d.ts +2 -2
- package/dist/utils/playgroundChat.d.ts +121 -0
- package/dist/utils/playgroundChat.js +275 -0
- package/dist/utils/portal.d.ts +8 -0
- package/dist/utils/portal.js +15 -0
- package/dist/utils/workflowInterface.d.ts +88 -20
- package/dist/utils/workflowInterface.js +179 -18
- package/dist/webmcp/WebMCPConfirm.svelte +68 -18
- package/dist/webmcp/gate.d.ts +6 -0
- package/dist/webmcp/gate.js +4 -0
- package/dist/webmcp/runtime.js +2 -1
- package/package.json +8 -7
- package/dist/components/Button.stories.svelte +0 -65
- package/dist/components/Button.stories.svelte.d.ts +0 -19
- package/dist/components/CanvasBanner.stories.svelte +0 -30
- package/dist/components/CanvasBanner.stories.svelte.d.ts +0 -27
- package/dist/components/CanvasContextMenu.stories.svelte +0 -63
- package/dist/components/CanvasContextMenu.stories.svelte.d.ts +0 -19
- package/dist/components/ConfigPanel.stories.svelte +0 -47
- package/dist/components/ConfigPanel.stories.svelte.d.ts +0 -27
- package/dist/components/EditorStatusBar.stories.svelte +0 -44
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +0 -27
- package/dist/components/FlowDropEdge.stories.svelte +0 -197
- package/dist/components/FlowDropEdge.stories.svelte.d.ts +0 -26
- package/dist/components/LoadingSpinner.stories.svelte +0 -30
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +0 -27
- package/dist/components/Logo.stories.svelte +0 -22
- package/dist/components/Logo.stories.svelte.d.ts +0 -27
- package/dist/components/MarkdownDisplay.stories.svelte +0 -38
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +0 -27
- package/dist/components/Navbar.stories.svelte +0 -58
- package/dist/components/Navbar.stories.svelte.d.ts +0 -27
- package/dist/components/NodeStatusOverlay.stories.svelte +0 -85
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +0 -27
- package/dist/components/SchemaForm.stories.svelte +0 -122
- package/dist/components/SchemaForm.stories.svelte.d.ts +0 -27
- package/dist/components/StatusIcon.stories.svelte +0 -60
- package/dist/components/StatusIcon.stories.svelte.d.ts +0 -27
- package/dist/components/StatusLabel.stories.svelte +0 -17
- package/dist/components/StatusLabel.stories.svelte.d.ts +0 -27
- package/dist/components/ThemeToggle.stories.svelte +0 -25
- package/dist/components/ThemeToggle.stories.svelte.d.ts +0 -27
- package/dist/components/console/CommandConsole.stories.svelte +0 -111
- package/dist/components/console/CommandConsole.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormCheckboxGroup.stories.svelte +0 -28
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormFieldWrapper.stories.svelte +0 -53
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormNumberField.stories.svelte +0 -36
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormRangeField.stories.svelte +0 -31
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormSelect.stories.svelte +0 -50
- package/dist/components/form/FormSelect.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormTextField.stories.svelte +0 -30
- package/dist/components/form/FormTextField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormTextarea.stories.svelte +0 -34
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormToggle.stories.svelte +0 -30
- package/dist/components/form/FormToggle.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +0 -68
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +0 -71
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +0 -77
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +0 -51
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/nodes/CaptionNode.stories.svelte +0 -65
- package/dist/components/nodes/CaptionNode.stories.svelte.d.ts +0 -18
- package/dist/components/nodes/GatewayNode.stories.svelte +0 -108
- package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/IdeaNode.stories.svelte +0 -52
- package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/NotesNode.stories.svelte +0 -76
- package/dist/components/nodes/NotesNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/SimpleNode.stories.svelte +0 -223
- package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/SquareNode.stories.svelte +0 -127
- package/dist/components/nodes/SquareNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/TerminalNode.stories.svelte +0 -25
- package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/ToolNode.stories.svelte +0 -189
- package/dist/components/nodes/ToolNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/WorkflowNode.stories.svelte +0 -188
- package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +0 -26
- package/dist/components/playground/MessageBubble.stories.svelte +0 -151
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +0 -27
- package/dist/mocks/app-environment.d.ts +0 -8
- package/dist/mocks/app-environment.js +0 -16
- package/dist/mocks/app-forms.d.ts +0 -6
- package/dist/mocks/app-forms.js +0 -29
- package/dist/mocks/app-navigation.d.ts +0 -5
- package/dist/mocks/app-navigation.js +0 -36
- package/dist/mocks/app-stores.d.ts +0 -14
- package/dist/mocks/app-stores.js +0 -26
- package/dist/stories/CanvasDecorator.svelte +0 -49
- package/dist/stories/CanvasDecorator.svelte.d.ts +0 -8
- package/dist/stories/EdgeDecorator.svelte +0 -125
- package/dist/stories/EdgeDecorator.svelte.d.ts +0 -17
- package/dist/stories/NodeDecorator.svelte +0 -75
- package/dist/stories/NodeDecorator.svelte.d.ts +0 -8
- package/dist/stories/WebMCPFakeAgent.svelte +0 -229
- package/dist/stories/WebMCPFakeAgent.svelte.d.ts +0 -10
- package/dist/stories/utils.d.ts +0 -93
- package/dist/stories/utils.js +0 -156
- package/dist/webmcp/WebMCP.stories.svelte +0 -101
- package/dist/webmcp/WebMCP.stories.svelte.d.ts +0 -18
package/dist/skins/slate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { FlowDropSkin } from '../types/skin';
|
|
1
|
+
import type { FlowDropSkin } from '../types/skin.js';
|
|
2
2
|
export declare const slateSkin: FlowDropSkin;
|
|
@@ -25,6 +25,7 @@ import { CategoriesStore } from './categoriesStore.svelte.js';
|
|
|
25
25
|
import { PortCoordinateStore } from './portCoordinateStore.svelte.js';
|
|
26
26
|
import { PipelinePanelStore } from './pipelinePanelStore.svelte.js';
|
|
27
27
|
import { InlineEditStore } from './inlineEditStore.svelte.js';
|
|
28
|
+
import { PlaygroundService } from '../services/playgroundService.js';
|
|
28
29
|
import { ApiContext } from './apiContext.js';
|
|
29
30
|
import { PortCompatibilityChecker } from '../utils/connections.js';
|
|
30
31
|
import { NodeComponentRegistry } from '../registry/nodeComponentRegistry.js';
|
|
@@ -54,6 +55,13 @@ export interface FlowDropInstance {
|
|
|
54
55
|
readonly historyBindings: HistoryStore;
|
|
55
56
|
/** Playground sessions, messages, and execution state. */
|
|
56
57
|
readonly playground: PlaygroundStore;
|
|
58
|
+
/**
|
|
59
|
+
* The playground API client and its polling loop. The default instance
|
|
60
|
+
* uses the exported `playgroundService` singleton, so legacy external
|
|
61
|
+
* `playgroundService.stopPolling()` calls still reach it; every other
|
|
62
|
+
* instance owns a separate service, so sessions poll independently.
|
|
63
|
+
*/
|
|
64
|
+
readonly playgroundService: PlaygroundService;
|
|
57
65
|
/** Pending interrupt/confirmation dialogs. */
|
|
58
66
|
readonly interrupts: InterruptStore;
|
|
59
67
|
/** Endpoint configuration, auth provider, and API client for this instance. */
|
|
@@ -109,6 +117,13 @@ export interface FlowDropInstance {
|
|
|
109
117
|
* publisher clears it when it goes away. `null` until a surface exists.
|
|
110
118
|
*/
|
|
111
119
|
approvalGate: ApprovalGate | null;
|
|
120
|
+
/**
|
|
121
|
+
* The skin scope (`data-fd-scope`) of the editor rendering this instance,
|
|
122
|
+
* set by `App` while it is mounted. Overlays mounted outside the editor tree
|
|
123
|
+
* (the WebMCP approval dialog) copy it so they keep the editor's skin.
|
|
124
|
+
* `null` when no editor is mounted.
|
|
125
|
+
*/
|
|
126
|
+
skinScope: string | null;
|
|
112
127
|
/**
|
|
113
128
|
* Run `fn` when this instance is destroyed. Returns an unsubscribe; calling
|
|
114
129
|
* it before `destroy()` means `fn` never runs. Adapters that bind to an
|
|
@@ -22,6 +22,7 @@ import { CategoriesStore } from './categoriesStore.svelte.js';
|
|
|
22
22
|
import { PortCoordinateStore } from './portCoordinateStore.svelte.js';
|
|
23
23
|
import { PipelinePanelStore } from './pipelinePanelStore.svelte.js';
|
|
24
24
|
import { InlineEditStore } from './inlineEditStore.svelte.js';
|
|
25
|
+
import { PlaygroundService, playgroundService } from '../services/playgroundService.js';
|
|
25
26
|
import { ApiContext } from './apiContext.js';
|
|
26
27
|
import { PortCompatibilityChecker } from '../utils/connections.js';
|
|
27
28
|
import { DEFAULT_PORT_CONFIG } from '../config/defaultPortConfig.js';
|
|
@@ -104,13 +105,20 @@ export function createFlowDropInstance(options = {}) {
|
|
|
104
105
|
// dangling transaction itself — it has no access to the live state).
|
|
105
106
|
historyBindings.setBeforeNavigateCallback(() => workflow.finalizeNodeConfig());
|
|
106
107
|
const playground = new PlaygroundStore();
|
|
108
|
+
const instancePlaygroundService = isDefault ? playgroundService : new PlaygroundService();
|
|
107
109
|
const cleanups = [
|
|
108
110
|
() => historyBindings.cleanup(),
|
|
109
111
|
() => historyBindings.setOnRestoreCallback(null),
|
|
110
112
|
() => historyBindings.setBeforeNavigateCallback(null),
|
|
111
113
|
() => workflow.setOnDirtyStateChange(null),
|
|
112
114
|
() => workflow.setOnWorkflowChange(null),
|
|
113
|
-
() => playground.dispose()
|
|
115
|
+
() => playground.dispose(),
|
|
116
|
+
// An owned service stops with its instance. The default one is the shared
|
|
117
|
+
// singleton and keeps the legacy behavior (outlives its mounts).
|
|
118
|
+
() => {
|
|
119
|
+
if (!isDefault)
|
|
120
|
+
instancePlaygroundService.stopPolling();
|
|
121
|
+
}
|
|
114
122
|
];
|
|
115
123
|
return {
|
|
116
124
|
id,
|
|
@@ -120,6 +128,7 @@ export function createFlowDropInstance(options = {}) {
|
|
|
120
128
|
workflow,
|
|
121
129
|
historyBindings,
|
|
122
130
|
playground,
|
|
131
|
+
playgroundService: instancePlaygroundService,
|
|
123
132
|
interrupts: new InterruptStore(),
|
|
124
133
|
api: new ApiContext(),
|
|
125
134
|
nodes: new NodeComponentRegistry({
|
|
@@ -137,6 +146,7 @@ export function createFlowDropInstance(options = {}) {
|
|
|
137
146
|
nodeTypes: new NodeTypesStore(),
|
|
138
147
|
host: new HostHooksStore(),
|
|
139
148
|
approvalGate: null,
|
|
149
|
+
skinScope: null,
|
|
140
150
|
onDestroy(fn) {
|
|
141
151
|
cleanups.push(fn);
|
|
142
152
|
return () => {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import type { PlaygroundSession, PlaygroundTurnResult, PlaygroundMessage, PlaygroundInputField, PlaygroundSessionStatus, PlaygroundMessagesApiResponse, PlaygroundExecution } from '../types/playground.js';
|
|
14
14
|
import type { Workflow, WorkflowInterfaceEntry } from '../types/index.js';
|
|
15
15
|
import { type InterfaceInputsResult, type PlaygroundInputMode } from '../utils/workflowInterface.js';
|
|
16
|
+
import { type ResolvedPlaygroundChat } from '../utils/playgroundChat.js';
|
|
16
17
|
/**
|
|
17
18
|
* Playground mutation actions for a {@link PlaygroundStore}.
|
|
18
19
|
*
|
|
@@ -108,6 +109,13 @@ export declare class PlaygroundStore {
|
|
|
108
109
|
* its interface declares no `turn`.
|
|
109
110
|
*/
|
|
110
111
|
get inputMode(): PlaygroundInputMode;
|
|
112
|
+
/**
|
|
113
|
+
* The chat binding in effect for the current workflow and where it came
|
|
114
|
+
* from (`settings`, the deprecated interface `turn`, or `none`), or `null`
|
|
115
|
+
* when the server sends no Playground settings (before FlowDrop 2.7.0).
|
|
116
|
+
* `source: 'none'` is a workflow with no chat until somebody sets it up.
|
|
117
|
+
*/
|
|
118
|
+
get chatBinding(): ResolvedPlaygroundChat | null;
|
|
111
119
|
/**
|
|
112
120
|
* The interface inputs a person fills in (inputs without a `turn`), in
|
|
113
121
|
* interface order. Empty in `legacy` mode: there the node-based
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* @module stores/playgroundStore
|
|
12
12
|
*/
|
|
13
13
|
import { hasEnableRunFlag, isChatInputNode } from '../types/playground.js';
|
|
14
|
-
import { collectInterfaceInputs,
|
|
14
|
+
import { collectInterfaceInputs, interfaceFormEntriesFor, playgroundInputModeFor } from '../utils/workflowInterface.js';
|
|
15
|
+
import { resolvePlaygroundChat } from '../utils/playgroundChat.js';
|
|
15
16
|
import { logger } from '../utils/logger.js';
|
|
16
17
|
// =========================================================================
|
|
17
18
|
// Helper Functions (pure, instance-independent)
|
|
@@ -82,10 +83,14 @@ export class PlaygroundStore {
|
|
|
82
83
|
#error = $state(null);
|
|
83
84
|
/** Current workflow being tested */
|
|
84
85
|
#currentWorkflow = $state(null);
|
|
85
|
-
/**
|
|
86
|
-
#
|
|
86
|
+
/** The chat binding in effect — see {@link chatBinding}. Resolved once, read by the two below. */
|
|
87
|
+
#chatBinding = $derived(resolvePlaygroundChat(this.#currentWorkflow));
|
|
88
|
+
/** Input mode from the workflow's chat binding — see {@link inputMode}. */
|
|
89
|
+
#inputMode = $derived(playgroundInputModeFor(this.#currentWorkflow?.interface, this.#chatBinding));
|
|
87
90
|
/** Form entries from the workflow interface — see {@link interfaceFormEntries}. */
|
|
88
|
-
#interfaceFormEntries = $derived(this.#inputMode === 'legacy'
|
|
91
|
+
#interfaceFormEntries = $derived(this.#inputMode === 'legacy'
|
|
92
|
+
? []
|
|
93
|
+
: interfaceFormEntriesFor(this.#currentWorkflow?.interface, this.#chatBinding));
|
|
89
94
|
/** Values of the interface input form, keyed by entry id. */
|
|
90
95
|
#formValues = $state({});
|
|
91
96
|
/** What a turn would send now — see {@link turnInputs}. */
|
|
@@ -319,6 +324,15 @@ export class PlaygroundStore {
|
|
|
319
324
|
get inputMode() {
|
|
320
325
|
return this.#inputMode;
|
|
321
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* The chat binding in effect for the current workflow and where it came
|
|
329
|
+
* from (`settings`, the deprecated interface `turn`, or `none`), or `null`
|
|
330
|
+
* when the server sends no Playground settings (before FlowDrop 2.7.0).
|
|
331
|
+
* `source: 'none'` is a workflow with no chat until somebody sets it up.
|
|
332
|
+
*/
|
|
333
|
+
get chatBinding() {
|
|
334
|
+
return this.#chatBinding;
|
|
335
|
+
}
|
|
322
336
|
/**
|
|
323
337
|
* The interface inputs a person fills in (inputs without a `turn`), in
|
|
324
338
|
* interface order. Empty in `legacy` mode: there the node-based
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module stores/workflowStore
|
|
12
12
|
*/
|
|
13
|
-
import type { Workflow, WorkflowNode, WorkflowEdge } from '../types';
|
|
13
|
+
import type { Workflow, WorkflowNode, WorkflowEdge } from '../types/index.js';
|
|
14
14
|
import type { WorkflowChangeType } from '../types/events.js';
|
|
15
15
|
import type { HistoryService } from '../services/historyService.js';
|
|
16
16
|
import type { PortMapping } from '../utils/nodeSwap.js';
|
|
@@ -72,6 +72,8 @@ export interface WorkflowStoreActions {
|
|
|
72
72
|
config?: Record<string, unknown>;
|
|
73
73
|
/** The workflow's public contract. Omit to leave it untouched. */
|
|
74
74
|
interface?: Workflow['interface'];
|
|
75
|
+
/** The workflow's Playground settings. Omit to leave them untouched. */
|
|
76
|
+
playground?: Workflow['playground'];
|
|
75
77
|
}) => void;
|
|
76
78
|
swapNode: (updates: {
|
|
77
79
|
nodes: WorkflowNode[];
|
|
@@ -294,6 +296,7 @@ export declare class WorkflowStore {
|
|
|
294
296
|
metadata?: Partial<Workflow['metadata']>;
|
|
295
297
|
config?: Record<string, unknown>;
|
|
296
298
|
interface?: Workflow['interface'];
|
|
299
|
+
playground?: Workflow['playground'];
|
|
297
300
|
}): void;
|
|
298
301
|
/**
|
|
299
302
|
* Swap a node — atomically replaces nodes and edges with a descriptive history entry.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { DEFAULT_WORKFLOW_FORMAT } from '../types/index.js';
|
|
14
14
|
import { WORKFLOW_SCHEMA_VERSION } from '../schemas/index.js';
|
|
15
15
|
import { interfaceBoundHandles, rewriteInterfaceBindings } from '../utils/workflowInterface.js';
|
|
16
|
+
import { rewritePlaygroundReplies } from '../utils/playgroundChat.js';
|
|
16
17
|
/**
|
|
17
18
|
* Safely build updated workflow metadata, providing defaults for required fields.
|
|
18
19
|
*
|
|
@@ -687,6 +688,7 @@ export class WorkflowStore {
|
|
|
687
688
|
// able to say so. Testing `!== undefined` silently dropped that update and
|
|
688
689
|
// left the old contract in place.
|
|
689
690
|
...('interface' in updates && { interface: updates.interface }),
|
|
691
|
+
...('playground' in updates && { playground: updates.playground }),
|
|
690
692
|
metadata: buildMetadata(this.#workflow.metadata, updates.metadata ?? undefined)
|
|
691
693
|
};
|
|
692
694
|
this.#pushToHistory('Batch update');
|
|
@@ -703,7 +705,11 @@ export class WorkflowStore {
|
|
|
703
705
|
if (!this.#workflow)
|
|
704
706
|
return;
|
|
705
707
|
// Node swap is the one mutation that actively moves interface bindings —
|
|
706
|
-
// every other mutation (including delete) leaves them untouched.
|
|
708
|
+
// every other mutation (including delete) leaves them untouched. The chat
|
|
709
|
+
// binding's replies name node ports directly, so they move with it.
|
|
710
|
+
const playgroundAfterSwap = updates.oldNodeId && updates.newNodeId
|
|
711
|
+
? rewritePlaygroundReplies(this.#workflow.playground, updates.oldNodeId, updates.newNodeId, updates.portMappings ?? [])
|
|
712
|
+
: this.#workflow.playground;
|
|
707
713
|
const interfaceAfterSwap = updates.oldNodeId && updates.newNodeId
|
|
708
714
|
? rewriteInterfaceBindings(this.#workflow.interface, updates.oldNodeId, updates.newNodeId, updates.portMappings ?? [])
|
|
709
715
|
: this.#workflow.interface;
|
|
@@ -712,6 +718,7 @@ export class WorkflowStore {
|
|
|
712
718
|
nodes: updates.nodes,
|
|
713
719
|
edges: updates.edges,
|
|
714
720
|
interface: interfaceAfterSwap,
|
|
721
|
+
...(playgroundAfterSwap !== undefined && { playground: playgroundAfterSwap }),
|
|
715
722
|
metadata: buildMetadata(this.#workflow.metadata)
|
|
716
723
|
};
|
|
717
724
|
this.#pushToHistory(updates.description ?? 'Swap node');
|
package/dist/styles/base.css
CHANGED
|
@@ -3,14 +3,23 @@
|
|
|
3
3
|
/* Import design tokens */
|
|
4
4
|
@import './tokens.css';
|
|
5
5
|
|
|
6
|
-
/* Reset and base styles
|
|
7
|
-
|
|
6
|
+
/* Reset and base styles.
|
|
7
|
+
Scoped to the library's roots so importing this file never changes the host
|
|
8
|
+
page. :where() keeps the old specificity (the bare `*` was 0,0,0 and `p`
|
|
9
|
+
0,0,1), so component rules win exactly as before.
|
|
10
|
+
|
|
11
|
+
Roots: .flowdrop-root (App), .flowdrop-scope (marker on the outermost element
|
|
12
|
+
of every component that can be mounted on its own: editor, playground, forms,
|
|
13
|
+
settings, chat, markdown display), .flowdrop-portal (overlays moved to
|
|
14
|
+
<body>), .svelte-flow (xyflow canvas). */
|
|
15
|
+
:where(.flowdrop-root, .flowdrop-scope, .flowdrop-portal, .svelte-flow),
|
|
16
|
+
:where(.flowdrop-root, .flowdrop-scope, .flowdrop-portal, .svelte-flow) * {
|
|
8
17
|
box-sizing: border-box;
|
|
9
18
|
}
|
|
10
19
|
|
|
11
20
|
/* Drop the UA default margin on paragraphs so block text sits on the grid;
|
|
12
21
|
contexts that want spacing (e.g. .markdown-display p) opt back in. */
|
|
13
|
-
p {
|
|
22
|
+
:where(.flowdrop-root, .flowdrop-scope, .flowdrop-portal, .svelte-flow) p {
|
|
14
23
|
margin: 0;
|
|
15
24
|
}
|
|
16
25
|
|
|
@@ -24,6 +33,8 @@ p {
|
|
|
24
33
|
click. Scoped to the library roots so it never leaks into the host app.
|
|
25
34
|
─────────────────────────────────────────────────────────────────────────── */
|
|
26
35
|
.flowdrop-root :focus-visible,
|
|
36
|
+
.flowdrop-scope :focus-visible,
|
|
37
|
+
.flowdrop-portal :focus-visible,
|
|
27
38
|
.svelte-flow :focus-visible {
|
|
28
39
|
outline: var(--fd-ring-width) solid var(--fd-ring);
|
|
29
40
|
outline-offset: var(--fd-ring-offset);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED by scripts/generate-token-aliases.mjs from styles/tokens.css and
|
|
3
|
+
* styles/base.css. Do not edit by hand; run `pnpm run generate:token-aliases`.
|
|
4
|
+
*
|
|
5
|
+
* Alias tokens: declarations whose value reads another --fd-* token. A custom
|
|
6
|
+
* property holding var() is resolved where it is declared, so a skin scoped to
|
|
7
|
+
* an editor root must redeclare the aliases that depend on the tokens it sets.
|
|
8
|
+
* Keys omit the --fd- prefix.
|
|
9
|
+
*/
|
|
10
|
+
/** Light/base aliases (:root). */
|
|
11
|
+
export declare const LIGHT_ALIASES: Readonly<Record<string, string>>;
|
|
12
|
+
/** Dark overrides ([data-theme='dark']): aliases, plus literal dark values of light aliases. */
|
|
13
|
+
export declare const DARK_ALIASES: Readonly<Record<string, string>>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED by scripts/generate-token-aliases.mjs from styles/tokens.css and
|
|
3
|
+
* styles/base.css. Do not edit by hand; run `pnpm run generate:token-aliases`.
|
|
4
|
+
*
|
|
5
|
+
* Alias tokens: declarations whose value reads another --fd-* token. A custom
|
|
6
|
+
* property holding var() is resolved where it is declared, so a skin scoped to
|
|
7
|
+
* an editor root must redeclare the aliases that depend on the tokens it sets.
|
|
8
|
+
* Keys omit the --fd- prefix.
|
|
9
|
+
*/
|
|
10
|
+
/** Light/base aliases (:root). */
|
|
11
|
+
export const LIGHT_ALIASES = {
|
|
12
|
+
'canvas-bg': 'var(--fd-background)',
|
|
13
|
+
'caption-node-bg': 'var(--fd-foreground)',
|
|
14
|
+
'caption-node-fg': 'var(--fd-background)',
|
|
15
|
+
'control-radius': 'var(--fd-radius-lg)',
|
|
16
|
+
'handle-offset': 'calc(-1 * var(--fd-handle-size) / 2)',
|
|
17
|
+
'interrupt-avatar-size': 'var(--fd-size-avatar)',
|
|
18
|
+
'interrupt-badge-completed-bg': 'var(--fd-primary-muted)',
|
|
19
|
+
'interrupt-badge-completed-text': 'var(--fd-primary)',
|
|
20
|
+
'interrupt-btn-min-height': 'var(--fd-size-btn-min)',
|
|
21
|
+
'interrupt-btn-primary-bg': 'linear-gradient(135deg, var(--fd-primary) 0%, var(--fd-primary-hover) 100%)',
|
|
22
|
+
'interrupt-btn-primary-bg-hover': 'linear-gradient(135deg, var(--fd-primary-hover) 0%, var(--fd-primary-hover) 100%)',
|
|
23
|
+
'interrupt-btn-secondary-bg': 'var(--fd-muted)',
|
|
24
|
+
'interrupt-btn-secondary-border': 'var(--fd-border)',
|
|
25
|
+
'interrupt-btn-secondary-text': 'var(--fd-foreground)',
|
|
26
|
+
'interrupt-cancelled-avatar': 'var(--fd-muted-foreground)',
|
|
27
|
+
'interrupt-cancelled-bg': 'linear-gradient(135deg, var(--fd-muted) 0%, var(--fd-subtle) 100%)',
|
|
28
|
+
'interrupt-cancelled-border': 'var(--fd-muted-foreground)',
|
|
29
|
+
'interrupt-cancelled-text': 'var(--fd-muted-foreground)',
|
|
30
|
+
'interrupt-cancelled-text-light': 'var(--fd-muted-foreground)',
|
|
31
|
+
'interrupt-completed-avatar': 'var(--fd-primary)',
|
|
32
|
+
'interrupt-completed-bg': 'linear-gradient(135deg, var(--fd-info-muted) 0%, var(--fd-primary-muted) 100%)',
|
|
33
|
+
'interrupt-completed-border': 'var(--fd-primary)',
|
|
34
|
+
'interrupt-completed-text': 'var(--fd-primary-hover)',
|
|
35
|
+
'interrupt-completed-text-light': 'var(--fd-primary)',
|
|
36
|
+
'interrupt-error-avatar': 'var(--fd-error)',
|
|
37
|
+
'interrupt-error-bg': 'linear-gradient(135deg, var(--fd-error-muted) 0%, var(--fd-error-muted) 100%)',
|
|
38
|
+
'interrupt-error-border': 'var(--fd-error)',
|
|
39
|
+
'interrupt-error-text': 'var(--fd-error-hover)',
|
|
40
|
+
'interrupt-error-text-light': 'var(--fd-error)',
|
|
41
|
+
'interrupt-font-error': 'var(--fd-text-xsm)',
|
|
42
|
+
'interrupt-font-message': 'var(--fd-text-md)',
|
|
43
|
+
'interrupt-font-mono': 'var(--fd-font-mono)',
|
|
44
|
+
'interrupt-line-height': 'var(--fd-leading-normal)',
|
|
45
|
+
'interrupt-pending-avatar': 'var(--fd-warning)',
|
|
46
|
+
'interrupt-pending-bg': 'linear-gradient(135deg, var(--fd-warning-muted) 0%, var(--fd-warning-muted) 100%)',
|
|
47
|
+
'interrupt-pending-border': 'var(--fd-warning)',
|
|
48
|
+
'interrupt-pending-text': 'var(--fd-warning-hover)',
|
|
49
|
+
'interrupt-pending-text-light': 'var(--fd-warning-hover)',
|
|
50
|
+
'interrupt-selected-confirm-bg': 'var(--fd-interrupt-btn-primary-bg)',
|
|
51
|
+
'interrupt-selected-confirm-border': 'var(--fd-primary-hover)',
|
|
52
|
+
'interrupt-selected-decline-bg': 'var(--fd-error-muted)',
|
|
53
|
+
'interrupt-selected-decline-border': 'var(--fd-error)',
|
|
54
|
+
'interrupt-selected-decline-text': 'var(--fd-error)',
|
|
55
|
+
'interrupt-spinner-size': 'var(--fd-size-spinner)',
|
|
56
|
+
'node-bg': 'var(--fd-card)',
|
|
57
|
+
'node-header-bg': 'var(--fd-header)',
|
|
58
|
+
'node-header-divider-color': 'var(--fd-border-muted)',
|
|
59
|
+
'node-radius': 'var(--fd-radius-xl)',
|
|
60
|
+
'node-shadow': 'var(--fd-shadow-md)',
|
|
61
|
+
'node-shadow-hover': 'var(--fd-shadow-lg)',
|
|
62
|
+
'note-border': 'var(--fd-node-border)',
|
|
63
|
+
'note-border-hover': 'var(--fd-node-border-hover)',
|
|
64
|
+
'panel-bg': 'var(--fd-background)',
|
|
65
|
+
'playground-icon-btn-size': 'var(--fd-size-icon-btn)',
|
|
66
|
+
'review-font-mono': 'var(--fd-interrupt-font-mono)',
|
|
67
|
+
'review-font-size-error': 'var(--fd-interrupt-font-error)',
|
|
68
|
+
'review-font-size-html-toggle': 'var(--fd-text-2xs)',
|
|
69
|
+
'review-font-size-message': 'var(--fd-interrupt-font-message)',
|
|
70
|
+
'review-line-height': 'var(--fd-interrupt-line-height)',
|
|
71
|
+
'review-line-height-content': 'var(--fd-leading-relaxed)',
|
|
72
|
+
'review-space-lg': 'var(--fd-space-lg)',
|
|
73
|
+
'review-space-md': 'var(--fd-space-sm)',
|
|
74
|
+
'review-space-sm': 'var(--fd-space-2xs)',
|
|
75
|
+
'review-toggle-height': 'var(--fd-size-icon-btn)',
|
|
76
|
+
'sidebar-category-color': 'var(--fd-muted-foreground)',
|
|
77
|
+
'sidebar-flat-item-color': 'var(--fd-foreground)'
|
|
78
|
+
};
|
|
79
|
+
/** Dark overrides ([data-theme='dark']): aliases, plus literal dark values of light aliases. */
|
|
80
|
+
export const DARK_ALIASES = {
|
|
81
|
+
'caption-node-bg': 'var(--fd-foreground)',
|
|
82
|
+
'caption-node-fg': 'var(--fd-background)',
|
|
83
|
+
'interrupt-badge-completed-bg': 'var(--fd-primary-muted)',
|
|
84
|
+
'interrupt-badge-completed-text': 'var(--fd-primary)',
|
|
85
|
+
'interrupt-btn-secondary-bg': 'var(--fd-secondary)',
|
|
86
|
+
'interrupt-btn-secondary-border': 'var(--fd-border)',
|
|
87
|
+
'interrupt-btn-secondary-text': 'var(--fd-foreground)',
|
|
88
|
+
'interrupt-selected-decline-bg': 'rgba(248, 113, 113, 0.15)'
|
|
89
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FlowDropSkin } from '../types/skin.js';
|
|
2
|
+
import { SCOPE_ATTR } from '../utils/portal.js';
|
|
3
|
+
export { SCOPE_ATTR };
|
|
4
|
+
/**
|
|
5
|
+
* Aliases (transitively) reading any of `seeds`, minus `exclude`.
|
|
6
|
+
*
|
|
7
|
+
* A custom property holding var() is resolved on the element that declares it,
|
|
8
|
+
* so `--fd-panel-bg: var(--fd-background)` declared on :root keeps the default
|
|
9
|
+
* background even when a skin sets --fd-background lower down. The scoped rule
|
|
10
|
+
* redeclares every such alias next to the skin's own tokens.
|
|
11
|
+
*/
|
|
12
|
+
export declare function aliasClosure(seeds: Iterable<string>, aliases: Readonly<Record<string, string>>, exclude?: ReadonlySet<string>): Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* The scope id as written everywhere: the `data-fd-scope` attribute, the skin
|
|
15
|
+
* rule and `FlowDropInstance.skinScope`. Clean once at the source so every
|
|
16
|
+
* side agrees; idempotent, so cleaning again is harmless.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toScopeId(raw: string): string;
|
|
19
|
+
/** Attribute selector for a scope id (cleaned again, so a raw id cannot inject CSS). */
|
|
20
|
+
export declare function scopeSelector(scopeId: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* CSS for one editor instance's skin, confined to its scope element.
|
|
23
|
+
*
|
|
24
|
+
* tokens → [data-fd-scope="id"] (light / base)
|
|
25
|
+
* darkTokens → [data-theme='dark'] [data-fd-scope="id"] (dark)
|
|
26
|
+
*
|
|
27
|
+
* data-theme stays page-global (on <html>, or any ancestor of the scope).
|
|
28
|
+
* Returns '' when the skin sets nothing.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildScopedSkinCss(scopeId: string, skin: Pick<FlowDropSkin, 'tokens' | 'darkTokens'> | undefined): string;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { LIGHT_ALIASES, DARK_ALIASES } from '../styles/tokenAliases.js';
|
|
2
|
+
import { SCOPE_ATTR } from '../utils/portal.js';
|
|
3
|
+
export { SCOPE_ATTR };
|
|
4
|
+
const VAR_REF = /var\(\s*--fd-([a-z0-9_-]+)/gi;
|
|
5
|
+
function dependenciesOf(expression) {
|
|
6
|
+
return [...expression.matchAll(VAR_REF)].map((m) => m[1]);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Aliases (transitively) reading any of `seeds`, minus `exclude`.
|
|
10
|
+
*
|
|
11
|
+
* A custom property holding var() is resolved on the element that declares it,
|
|
12
|
+
* so `--fd-panel-bg: var(--fd-background)` declared on :root keeps the default
|
|
13
|
+
* background even when a skin sets --fd-background lower down. The scoped rule
|
|
14
|
+
* redeclares every such alias next to the skin's own tokens.
|
|
15
|
+
*/
|
|
16
|
+
export function aliasClosure(seeds, aliases, exclude = new Set()) {
|
|
17
|
+
const known = new Set(seeds);
|
|
18
|
+
const result = {};
|
|
19
|
+
let grew = true;
|
|
20
|
+
while (grew) {
|
|
21
|
+
grew = false;
|
|
22
|
+
for (const [name, expression] of Object.entries(aliases)) {
|
|
23
|
+
if (name in result || exclude.has(name))
|
|
24
|
+
continue;
|
|
25
|
+
if (dependenciesOf(expression).some((dep) => known.has(dep))) {
|
|
26
|
+
result[name] = expression;
|
|
27
|
+
known.add(name);
|
|
28
|
+
grew = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
function rule(selector, declarations) {
|
|
35
|
+
const body = Object.entries(declarations)
|
|
36
|
+
.map(([k, v]) => ` --fd-${k}: ${v};`)
|
|
37
|
+
.join('\n');
|
|
38
|
+
return `${selector} {\n${body}\n}\n`;
|
|
39
|
+
}
|
|
40
|
+
/** Dark-mode alias values: the light ones with the dark block's overrides applied. */
|
|
41
|
+
function effectiveDarkAliases() {
|
|
42
|
+
return { ...LIGHT_ALIASES, ...DARK_ALIASES };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The scope id as written everywhere: the `data-fd-scope` attribute, the skin
|
|
46
|
+
* rule and `FlowDropInstance.skinScope`. Clean once at the source so every
|
|
47
|
+
* side agrees; idempotent, so cleaning again is harmless.
|
|
48
|
+
*/
|
|
49
|
+
export function toScopeId(raw) {
|
|
50
|
+
return raw.replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
51
|
+
}
|
|
52
|
+
/** Attribute selector for a scope id (cleaned again, so a raw id cannot inject CSS). */
|
|
53
|
+
export function scopeSelector(scopeId) {
|
|
54
|
+
return `[${SCOPE_ATTR}="${toScopeId(scopeId)}"]`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* CSS for one editor instance's skin, confined to its scope element.
|
|
58
|
+
*
|
|
59
|
+
* tokens → [data-fd-scope="id"] (light / base)
|
|
60
|
+
* darkTokens → [data-theme='dark'] [data-fd-scope="id"] (dark)
|
|
61
|
+
*
|
|
62
|
+
* data-theme stays page-global (on <html>, or any ancestor of the scope).
|
|
63
|
+
* Returns '' when the skin sets nothing.
|
|
64
|
+
*/
|
|
65
|
+
export function buildScopedSkinCss(scopeId, skin) {
|
|
66
|
+
const tokens = skin?.tokens ?? {};
|
|
67
|
+
const darkTokens = skin?.darkTokens ?? {};
|
|
68
|
+
const lightKeys = Object.keys(tokens);
|
|
69
|
+
const darkKeys = Object.keys(darkTokens);
|
|
70
|
+
if (lightKeys.length === 0 && darkKeys.length === 0)
|
|
71
|
+
return '';
|
|
72
|
+
const scope = scopeSelector(scopeId);
|
|
73
|
+
// A skin's light tokens also apply in dark mode (as with the old :root rule),
|
|
74
|
+
// so an alias a skin sets in either palette is never overridden here.
|
|
75
|
+
const skinSet = new Set([...lightKeys, ...darkKeys]);
|
|
76
|
+
let css = '';
|
|
77
|
+
const lightAliases = aliasClosure(lightKeys, LIGHT_ALIASES, skinSet);
|
|
78
|
+
if (lightKeys.length > 0) {
|
|
79
|
+
css += rule(scope, { ...lightAliases, ...tokens });
|
|
80
|
+
}
|
|
81
|
+
// Every alias the light rule redeclares shadows the :root dark value, so the
|
|
82
|
+
// dark rule restores it — including dark values that are literals, which the
|
|
83
|
+
// closure (it follows var() references) would never pick up.
|
|
84
|
+
const darkAliases = {
|
|
85
|
+
...aliasClosure(skinSet, effectiveDarkAliases(), skinSet)
|
|
86
|
+
};
|
|
87
|
+
for (const name of Object.keys(lightAliases)) {
|
|
88
|
+
if (name in DARK_ALIASES && !(name in darkAliases))
|
|
89
|
+
darkAliases[name] = DARK_ALIASES[name];
|
|
90
|
+
}
|
|
91
|
+
if (darkKeys.length > 0 || Object.keys(darkAliases).length > 0) {
|
|
92
|
+
css += rule(`[data-theme='dark'] ${scope}`, { ...darkAliases, ...darkTokens });
|
|
93
|
+
}
|
|
94
|
+
return css;
|
|
95
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1386,7 +1386,13 @@ export interface WorkflowInterfaceEntry {
|
|
|
1386
1386
|
meta?: Record<string, unknown>;
|
|
1387
1387
|
/**
|
|
1388
1388
|
* What this port is for in a chat turn (see {@link WorkflowInterfaceTurn}).
|
|
1389
|
-
* Absent means the port plays no part in a turn.
|
|
1389
|
+
* Absent means the port plays no part in a turn.
|
|
1390
|
+
*
|
|
1391
|
+
* @deprecated since 2.11.0, removed in 3.0. The chat binding lives in the
|
|
1392
|
+
* workflow's Playground settings ({@link Workflow.playground}); a server
|
|
1393
|
+
* from FlowDrop 2.7.0 on reads `turn` only for a workflow without them.
|
|
1394
|
+
* Still read here, and still round-tripped, until 3.0.
|
|
1395
|
+
* Validated by the server
|
|
1390
1396
|
* against its vocabulary; a value this library does not know (from a newer
|
|
1391
1397
|
* server) round-trips verbatim, which is why the type admits any string
|
|
1392
1398
|
* beside the known values. Narrow with `isKnownTurn` before indexing by it.
|
|
@@ -1405,14 +1411,83 @@ export interface WorkflowInterfaceEntry {
|
|
|
1405
1411
|
*
|
|
1406
1412
|
* Outputs (any number):
|
|
1407
1413
|
* - `reply`: each value becomes one assistant message
|
|
1414
|
+
*
|
|
1415
|
+
* @deprecated since 2.11.0, removed in 3.0. See {@link PlaygroundChatBinding}.
|
|
1408
1416
|
*/
|
|
1409
1417
|
export type WorkflowInterfaceTurn = 'message' | 'history' | 'session_id' | 'message_id' | 'reply';
|
|
1410
|
-
/**
|
|
1418
|
+
/**
|
|
1419
|
+
* Turn values valid on an input entry, in selector order.
|
|
1420
|
+
*
|
|
1421
|
+
* @deprecated since 2.11.0, removed in 3.0, with {@link WorkflowInterfaceEntry.turn}.
|
|
1422
|
+
*/
|
|
1411
1423
|
export declare const WORKFLOW_INTERFACE_INPUT_TURNS: readonly WorkflowInterfaceTurn[];
|
|
1412
|
-
/**
|
|
1424
|
+
/**
|
|
1425
|
+
* Turn values valid on an output entry, in selector order.
|
|
1426
|
+
*
|
|
1427
|
+
* @deprecated since 2.11.0, removed in 3.0, with {@link WorkflowInterfaceEntry.turn}.
|
|
1428
|
+
*/
|
|
1413
1429
|
export declare const WORKFLOW_INTERFACE_OUTPUT_TURNS: readonly WorkflowInterfaceTurn[];
|
|
1414
|
-
/**
|
|
1430
|
+
/**
|
|
1431
|
+
* How many recent messages the server passes to a history input that states
|
|
1432
|
+
* no limit: a `history` port without `meta.limit`, or Playground settings
|
|
1433
|
+
* whose `history` gives none.
|
|
1434
|
+
*/
|
|
1415
1435
|
export declare const DEFAULT_HISTORY_TURN_LIMIT = 10;
|
|
1436
|
+
/**
|
|
1437
|
+
* A workflow's chat binding, stored in its Playground settings: which
|
|
1438
|
+
* interface input the person's message fills, which one receives recent
|
|
1439
|
+
* messages and the two ids, and which node output ports print as replies.
|
|
1440
|
+
*
|
|
1441
|
+
* Inputs are named by interface entry `id` (the name the server matches
|
|
1442
|
+
* inputs on); replies by node port, so a reply needs no interface entry.
|
|
1443
|
+
* `null` means "not bound".
|
|
1444
|
+
*/
|
|
1445
|
+
export interface PlaygroundChatBinding {
|
|
1446
|
+
/** The input the chat message fills. `null` = no chat box. */
|
|
1447
|
+
message: string | null;
|
|
1448
|
+
/** The input that receives recent user and assistant messages. */
|
|
1449
|
+
history: {
|
|
1450
|
+
input: string;
|
|
1451
|
+
limit: number;
|
|
1452
|
+
} | null;
|
|
1453
|
+
/** The input that receives the session's id. */
|
|
1454
|
+
session_id: string | null;
|
|
1455
|
+
/** The input that receives the id of the person's message. */
|
|
1456
|
+
message_id: string | null;
|
|
1457
|
+
/** Node output ports whose results print as replies, in order. */
|
|
1458
|
+
replies: PlaygroundReplyPort[];
|
|
1459
|
+
/** Whether sub-workflows running in the session post their own replies. */
|
|
1460
|
+
sub_workflow_replies: boolean;
|
|
1461
|
+
}
|
|
1462
|
+
/** A node output port whose result prints as a reply. */
|
|
1463
|
+
export interface PlaygroundReplyPort {
|
|
1464
|
+
node_id: string;
|
|
1465
|
+
port: string;
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Where the binding in effect comes from: the workflow's Playground
|
|
1469
|
+
* settings, the deprecated interface `turn` annotations (a workflow without
|
|
1470
|
+
* settings, until 3.0), or nowhere (no chat until somebody sets it up).
|
|
1471
|
+
*/
|
|
1472
|
+
export type PlaygroundChatSource = 'settings' | 'interface_turn' | 'none';
|
|
1473
|
+
/**
|
|
1474
|
+
* A workflow's Playground settings, as a server from FlowDrop 2.7.0 on sends
|
|
1475
|
+
* them with the workflow and saves them with it (one Save, versioned with the
|
|
1476
|
+
* workflow).
|
|
1477
|
+
*
|
|
1478
|
+
* Only `chat` is written back on save; `resolved` and `source` are what the
|
|
1479
|
+
* server computed when it sent the workflow, and go stale as soon as the
|
|
1480
|
+
* settings or the interface are edited (use `resolvePlaygroundChat`, which
|
|
1481
|
+
* applies the same rule to the workflow as it is now).
|
|
1482
|
+
*/
|
|
1483
|
+
export interface WorkflowPlayground {
|
|
1484
|
+
/** The stored binding, or `null` when the workflow has none. */
|
|
1485
|
+
chat: PlaygroundChatBinding | null;
|
|
1486
|
+
/** The binding in effect when the server sent the workflow. */
|
|
1487
|
+
resolved?: PlaygroundChatBinding;
|
|
1488
|
+
/** Where `resolved` came from. A newer server may send other values. */
|
|
1489
|
+
source?: PlaygroundChatSource | (string & {});
|
|
1490
|
+
}
|
|
1416
1491
|
/** A workflow's public contract. Array order is the caller-facing order. */
|
|
1417
1492
|
export interface WorkflowInterface {
|
|
1418
1493
|
inputs?: WorkflowInterfaceEntry[];
|
|
@@ -1443,6 +1518,13 @@ export interface Workflow {
|
|
|
1443
1518
|
config?: Record<string, unknown>;
|
|
1444
1519
|
/** Public contract for callers. Absent = the workflow declares no interface. */
|
|
1445
1520
|
interface?: WorkflowInterface;
|
|
1521
|
+
/**
|
|
1522
|
+
* The workflow's Playground settings (the chat binding). Absent = the server
|
|
1523
|
+
* predates them (before FlowDrop 2.7.0), so the Playground falls back to
|
|
1524
|
+
* interface `turn` and then to guessing; present with `chat: null` = this
|
|
1525
|
+
* workflow has no chat until somebody sets it up.
|
|
1526
|
+
*/
|
|
1527
|
+
playground?: WorkflowPlayground;
|
|
1446
1528
|
/**
|
|
1447
1529
|
* What the current user may do with this workflow, computed by the host and
|
|
1448
1530
|
* passed through untouched (`save`, `run`, …). The browser-agent tools
|
package/dist/types/index.js
CHANGED
|
@@ -21,16 +21,28 @@ export function dynamicPortToNodePort(port, portType) {
|
|
|
21
21
|
description: port.description
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Turn values valid on an input entry, in selector order.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated since 2.11.0, removed in 3.0, with {@link WorkflowInterfaceEntry.turn}.
|
|
28
|
+
*/
|
|
25
29
|
export const WORKFLOW_INTERFACE_INPUT_TURNS = [
|
|
26
30
|
'message',
|
|
27
31
|
'history',
|
|
28
32
|
'session_id',
|
|
29
33
|
'message_id'
|
|
30
34
|
];
|
|
31
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Turn values valid on an output entry, in selector order.
|
|
37
|
+
*
|
|
38
|
+
* @deprecated since 2.11.0, removed in 3.0, with {@link WorkflowInterfaceEntry.turn}.
|
|
39
|
+
*/
|
|
32
40
|
export const WORKFLOW_INTERFACE_OUTPUT_TURNS = ['reply'];
|
|
33
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* How many recent messages the server passes to a history input that states
|
|
43
|
+
* no limit: a `history` port without `meta.limit`, or Playground settings
|
|
44
|
+
* whose `history` gives none.
|
|
45
|
+
*/
|
|
34
46
|
export const DEFAULT_HISTORY_TURN_LIMIT = 10;
|
|
35
47
|
export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider } from './auth.js';
|
|
36
48
|
export { DEFAULT_SETTINGS, DEFAULT_THEME_SETTINGS, DEFAULT_EDITOR_SETTINGS, DEFAULT_UI_SETTINGS, DEFAULT_BEHAVIOR_SETTINGS, DEFAULT_API_SETTINGS, SETTINGS_CATEGORIES, SETTINGS_CATEGORY_LABELS, SETTINGS_CATEGORY_ICONS, SETTINGS_STORAGE_KEY } from './settings.js';
|
package/dist/types/skin.d.ts
CHANGED
|
@@ -23,9 +23,9 @@ export interface FlowDropSkin {
|
|
|
23
23
|
* <App skin={{ name: 'minimal', tokens: { primary: '#e11d48' } }} />
|
|
24
24
|
*/
|
|
25
25
|
name?: FlowDropSkinName | (string & {});
|
|
26
|
-
/** CSS token overrides injected
|
|
26
|
+
/** CSS token overrides injected on the editor's own scope element (not :root) — active in light mode (and as base) */
|
|
27
27
|
tokens?: FlowDropSkinTokens;
|
|
28
|
-
/** CSS token overrides injected
|
|
28
|
+
/** CSS token overrides injected under [data-theme='dark'] on the editor's scope element — active in dark mode only */
|
|
29
29
|
darkTokens?: FlowDropSkinTokens;
|
|
30
30
|
}
|
|
31
31
|
export type FlowDropSkinName = 'default' | 'slate' | 'drafter';
|