@d34dman/flowdrop 0.0.56 → 0.0.57

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 (43) hide show
  1. package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +92 -0
  2. package/dist/adapters/agentspec/AgentSpecAdapter.js +658 -0
  3. package/dist/adapters/agentspec/agentAdapter.d.ts +59 -0
  4. package/dist/adapters/agentspec/agentAdapter.js +91 -0
  5. package/dist/adapters/agentspec/autoLayout.d.ts +34 -0
  6. package/dist/adapters/agentspec/autoLayout.js +127 -0
  7. package/dist/adapters/agentspec/index.d.ts +35 -0
  8. package/dist/adapters/agentspec/index.js +37 -0
  9. package/dist/adapters/agentspec/nodeTypeRegistry.d.ts +62 -0
  10. package/dist/adapters/agentspec/nodeTypeRegistry.js +589 -0
  11. package/dist/adapters/agentspec/validator.d.ts +34 -0
  12. package/dist/adapters/agentspec/validator.js +169 -0
  13. package/dist/components/ConfigForm.svelte +46 -12
  14. package/dist/components/ConfigForm.svelte.d.ts +8 -0
  15. package/dist/components/SchemaForm.svelte +34 -12
  16. package/dist/components/SchemaForm.svelte.d.ts +8 -0
  17. package/dist/components/form/FormFieldset.svelte +142 -0
  18. package/dist/components/form/FormFieldset.svelte.d.ts +11 -0
  19. package/dist/components/form/FormUISchemaRenderer.svelte +140 -0
  20. package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +32 -0
  21. package/dist/components/form/index.d.ts +2 -0
  22. package/dist/components/form/index.js +3 -0
  23. package/dist/config/agentSpecEndpoints.d.ts +70 -0
  24. package/dist/config/agentSpecEndpoints.js +65 -0
  25. package/dist/config/endpoints.d.ts +6 -0
  26. package/dist/core/index.d.ts +17 -1
  27. package/dist/core/index.js +17 -0
  28. package/dist/form/index.d.ts +2 -0
  29. package/dist/form/index.js +3 -0
  30. package/dist/helpers/workflowEditorHelper.d.ts +24 -0
  31. package/dist/helpers/workflowEditorHelper.js +55 -0
  32. package/dist/services/agentSpecExecutionService.d.ts +106 -0
  33. package/dist/services/agentSpecExecutionService.js +333 -0
  34. package/dist/types/agentspec.d.ts +318 -0
  35. package/dist/types/agentspec.js +48 -0
  36. package/dist/types/events.d.ts +28 -1
  37. package/dist/types/index.d.ts +13 -0
  38. package/dist/types/index.js +1 -0
  39. package/dist/types/uischema.d.ts +144 -0
  40. package/dist/types/uischema.js +51 -0
  41. package/dist/utils/uischema.d.ts +52 -0
  42. package/dist/utils/uischema.js +88 -0
  43. package/package.json +1 -1
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module types/events
8
8
  */
9
- import type { Workflow } from './index.js';
9
+ import type { Workflow, NodeExecutionInfo } from './index.js';
10
10
  /**
11
11
  * Types of workflow changes
12
12
  *
@@ -113,6 +113,33 @@ export interface FlowDropEventHandlers {
113
113
  * @returns true to suppress default error handling, false/void to show default toast
114
114
  */
115
115
  onApiError?: (error: Error, operation: string) => boolean | void;
116
+ /**
117
+ * Called when an Agent Spec execution starts
118
+ *
119
+ * @param executionId - The runtime execution ID
120
+ */
121
+ onAgentSpecExecutionStarted?: (executionId: string) => void;
122
+ /**
123
+ * Called when an Agent Spec execution completes successfully
124
+ *
125
+ * @param executionId - The runtime execution ID
126
+ * @param results - Execution results from the runtime
127
+ */
128
+ onAgentSpecExecutionCompleted?: (executionId: string, results: Record<string, unknown>) => void;
129
+ /**
130
+ * Called when an Agent Spec execution fails
131
+ *
132
+ * @param executionId - The runtime execution ID
133
+ * @param error - The error that occurred
134
+ */
135
+ onAgentSpecExecutionFailed?: (executionId: string, error: Error) => void;
136
+ /**
137
+ * Called when a node's execution status is updated during Agent Spec execution
138
+ *
139
+ * @param nodeId - The FlowDrop node ID
140
+ * @param status - Updated execution info
141
+ */
142
+ onAgentSpecNodeStatusUpdate?: (nodeId: string, status: NodeExecutionInfo) => void;
116
143
  }
117
144
  /**
118
145
  * Feature flags for FlowDrop
@@ -536,6 +536,17 @@ export interface NodeMetadata {
536
536
  inputs: NodePort[];
537
537
  outputs: NodePort[];
538
538
  configSchema?: ConfigSchema;
539
+ /**
540
+ * Optional UI Schema that controls how configSchema fields are
541
+ * arranged, grouped, and displayed in the configuration form.
542
+ *
543
+ * When not provided, fields render in flat order (backward compatible).
544
+ * Uses JSON Forms-inspired format with VerticalLayout, Group, and Control elements.
545
+ *
546
+ * @see UISchemaElement for the element type definitions
547
+ * @see https://jsonforms.io/docs/uischema
548
+ */
549
+ uiSchema?: import('./uischema.js').UISchemaElement;
539
550
  /** Default configuration values for this node type */
540
551
  config?: Record<string, unknown>;
541
552
  tags?: string[];
@@ -1199,3 +1210,5 @@ export type { AuthProvider, StaticAuthConfig, CallbackAuthConfig } from './auth.
1199
1210
  export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider } from './auth.js';
1200
1211
  export type { FlowDropSettings, ThemeSettings, EditorSettings, UISettings, BehaviorSettings, ApiSettings, ThemePreference, ResolvedTheme, SettingsCategory, PartialSettings, SyncStatus, SettingsStoreState, SettingsChangeEvent, SettingsChangeCallback } from './settings.js';
1201
1212
  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';
1213
+ export type { UISchemaElementType, UISchemaElementBase, UISchemaControl, UISchemaVerticalLayout, UISchemaGroup, UISchemaElement } from './uischema.js';
1214
+ export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from './uischema.js';
@@ -20,3 +20,4 @@ export function dynamicPortToNodePort(port, portType) {
20
20
  }
21
21
  export { StaticAuthProvider, CallbackAuthProvider, NoAuthProvider } from './auth.js';
22
22
  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';
23
+ export { isUISchemaControl, isUISchemaVerticalLayout, isUISchemaGroup } from './uischema.js';
@@ -0,0 +1,144 @@
1
+ /**
2
+ * UISchema Types for FlowDrop Form Layout
3
+ *
4
+ * Inspired by JSON Forms (EclipseSource) UISchema specification.
5
+ * Controls how form fields are arranged, grouped, and displayed
6
+ * without modifying the underlying data schema (ConfigSchema).
7
+ *
8
+ * The UISchema is a separate concern from the data schema:
9
+ * - ConfigSchema defines what data is valid (validation)
10
+ * - UISchema defines how the form is rendered (presentation)
11
+ *
12
+ * @see https://jsonforms.io/docs/uischema
13
+ *
14
+ * @example
15
+ * ```json
16
+ * {
17
+ * "type": "VerticalLayout",
18
+ * "elements": [
19
+ * { "type": "Control", "scope": "#/properties/model" },
20
+ * {
21
+ * "type": "Group",
22
+ * "label": "Advanced Settings",
23
+ * "collapsible": true,
24
+ * "defaultOpen": false,
25
+ * "elements": [
26
+ * { "type": "Control", "scope": "#/properties/temperature" },
27
+ * { "type": "Control", "scope": "#/properties/maxTokens" }
28
+ * ]
29
+ * }
30
+ * ]
31
+ * }
32
+ * ```
33
+ */
34
+ /**
35
+ * Supported UISchema element types.
36
+ * Designed for future extension with HorizontalLayout, Categorization, etc.
37
+ */
38
+ export type UISchemaElementType = 'VerticalLayout' | 'Group' | 'Control';
39
+ /**
40
+ * Base interface for all UISchema elements.
41
+ */
42
+ export interface UISchemaElementBase {
43
+ /** Discriminator for the element type */
44
+ type: UISchemaElementType;
45
+ }
46
+ /**
47
+ * Control element - references a single field in the data schema.
48
+ * Uses JSON Pointer syntax for the scope path.
49
+ *
50
+ * @example
51
+ * ```json
52
+ * { "type": "Control", "scope": "#/properties/temperature" }
53
+ * ```
54
+ */
55
+ export interface UISchemaControl extends UISchemaElementBase {
56
+ type: 'Control';
57
+ /**
58
+ * JSON Pointer to the property in the data schema.
59
+ * Must follow the format: #/properties/<fieldName>
60
+ */
61
+ scope: string;
62
+ /**
63
+ * Optional label override. If not provided, the field's
64
+ * schema title or key is used.
65
+ */
66
+ label?: string;
67
+ }
68
+ /**
69
+ * Layout container that arranges its child elements vertically.
70
+ * Can be used as root element or nested inside groups.
71
+ *
72
+ * @example
73
+ * ```json
74
+ * {
75
+ * "type": "VerticalLayout",
76
+ * "elements": [
77
+ * { "type": "Control", "scope": "#/properties/name" },
78
+ * { "type": "Control", "scope": "#/properties/email" }
79
+ * ]
80
+ * }
81
+ * ```
82
+ */
83
+ export interface UISchemaVerticalLayout extends UISchemaElementBase {
84
+ type: 'VerticalLayout';
85
+ /** Child elements to render vertically */
86
+ elements: UISchemaElement[];
87
+ }
88
+ /**
89
+ * Group element - renders a fieldset with a label and optional collapsible behavior.
90
+ * Extends the JSON Forms Group with FlowDrop-specific collapse options.
91
+ *
92
+ * @example
93
+ * ```json
94
+ * {
95
+ * "type": "Group",
96
+ * "label": "Advanced Settings",
97
+ * "description": "Fine-tuning parameters",
98
+ * "collapsible": true,
99
+ * "defaultOpen": false,
100
+ * "elements": [
101
+ * { "type": "Control", "scope": "#/properties/temperature" },
102
+ * { "type": "Control", "scope": "#/properties/maxTokens" }
103
+ * ]
104
+ * }
105
+ * ```
106
+ */
107
+ export interface UISchemaGroup extends UISchemaElementBase {
108
+ type: 'Group';
109
+ /** Display label for the fieldset legend / summary */
110
+ label: string;
111
+ /** Child elements within the group */
112
+ elements: UISchemaElement[];
113
+ /** Optional description displayed below the label */
114
+ description?: string;
115
+ /**
116
+ * Whether the group can be collapsed.
117
+ * When true, renders as `<details>/<summary>`.
118
+ * @default true
119
+ */
120
+ collapsible?: boolean;
121
+ /**
122
+ * Whether the group is initially open (expanded).
123
+ * Only relevant when collapsible is true.
124
+ * @default true
125
+ */
126
+ defaultOpen?: boolean;
127
+ }
128
+ /**
129
+ * Union type of all supported UISchema elements.
130
+ * This is the recursive type used in elements arrays.
131
+ */
132
+ export type UISchemaElement = UISchemaControl | UISchemaVerticalLayout | UISchemaGroup;
133
+ /**
134
+ * Type guard: checks if element is a Control
135
+ */
136
+ export declare function isUISchemaControl(element: UISchemaElement): element is UISchemaControl;
137
+ /**
138
+ * Type guard: checks if element is a VerticalLayout
139
+ */
140
+ export declare function isUISchemaVerticalLayout(element: UISchemaElement): element is UISchemaVerticalLayout;
141
+ /**
142
+ * Type guard: checks if element is a Group
143
+ */
144
+ export declare function isUISchemaGroup(element: UISchemaElement): element is UISchemaGroup;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * UISchema Types for FlowDrop Form Layout
3
+ *
4
+ * Inspired by JSON Forms (EclipseSource) UISchema specification.
5
+ * Controls how form fields are arranged, grouped, and displayed
6
+ * without modifying the underlying data schema (ConfigSchema).
7
+ *
8
+ * The UISchema is a separate concern from the data schema:
9
+ * - ConfigSchema defines what data is valid (validation)
10
+ * - UISchema defines how the form is rendered (presentation)
11
+ *
12
+ * @see https://jsonforms.io/docs/uischema
13
+ *
14
+ * @example
15
+ * ```json
16
+ * {
17
+ * "type": "VerticalLayout",
18
+ * "elements": [
19
+ * { "type": "Control", "scope": "#/properties/model" },
20
+ * {
21
+ * "type": "Group",
22
+ * "label": "Advanced Settings",
23
+ * "collapsible": true,
24
+ * "defaultOpen": false,
25
+ * "elements": [
26
+ * { "type": "Control", "scope": "#/properties/temperature" },
27
+ * { "type": "Control", "scope": "#/properties/maxTokens" }
28
+ * ]
29
+ * }
30
+ * ]
31
+ * }
32
+ * ```
33
+ */
34
+ /**
35
+ * Type guard: checks if element is a Control
36
+ */
37
+ export function isUISchemaControl(element) {
38
+ return element.type === 'Control';
39
+ }
40
+ /**
41
+ * Type guard: checks if element is a VerticalLayout
42
+ */
43
+ export function isUISchemaVerticalLayout(element) {
44
+ return element.type === 'VerticalLayout';
45
+ }
46
+ /**
47
+ * Type guard: checks if element is a Group
48
+ */
49
+ export function isUISchemaGroup(element) {
50
+ return element.type === 'Group';
51
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * UISchema Utilities
3
+ *
4
+ * Functions for resolving JSON Pointer scope strings to property keys,
5
+ * and for generating default UISchema from a ConfigSchema.
6
+ */
7
+ import type { ConfigSchema } from '../types/index.js';
8
+ import type { UISchemaElement, UISchemaVerticalLayout } from '../types/uischema.js';
9
+ /**
10
+ * Resolve a JSON Pointer scope string to a property key.
11
+ *
12
+ * Supports the JSON Forms scope format: #/properties/<fieldName>
13
+ *
14
+ * @param scope - JSON Pointer string (e.g., "#/properties/temperature")
15
+ * @returns The property key (e.g., "temperature"), or null if invalid
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * resolveScopeToKey("#/properties/temperature") // => "temperature"
20
+ * resolveScopeToKey("#/properties/nested/deep") // => null (only single-level supported)
21
+ * resolveScopeToKey("invalid") // => null
22
+ * ```
23
+ */
24
+ export declare function resolveScopeToKey(scope: string): string | null;
25
+ /**
26
+ * Build a scope string from a property key.
27
+ * Inverse of resolveScopeToKey.
28
+ *
29
+ * @param key - Property key (e.g., "temperature")
30
+ * @returns JSON Pointer scope string (e.g., "#/properties/temperature")
31
+ */
32
+ export declare function keyToScope(key: string): string;
33
+ /**
34
+ * Generate a default UISchema from a ConfigSchema.
35
+ * Creates a flat VerticalLayout with one Control per property,
36
+ * preserving the property iteration order.
37
+ *
38
+ * This is a convenience utility for programmatically building UISchema.
39
+ *
40
+ * @param schema - The ConfigSchema to generate a UISchema from
41
+ * @returns A VerticalLayout UISchema element
42
+ */
43
+ export declare function generateDefaultUISchema(schema: ConfigSchema): UISchemaVerticalLayout;
44
+ /**
45
+ * Collect all property keys referenced by Controls in a UISchema tree.
46
+ * Useful for detecting properties that are NOT in the UISchema
47
+ * (e.g., to warn about unreferenced fields during development).
48
+ *
49
+ * @param element - Root UISchema element
50
+ * @returns Set of property keys referenced by Controls
51
+ */
52
+ export declare function collectReferencedKeys(element: UISchemaElement): Set<string>;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * UISchema Utilities
3
+ *
4
+ * Functions for resolving JSON Pointer scope strings to property keys,
5
+ * and for generating default UISchema from a ConfigSchema.
6
+ */
7
+ /**
8
+ * Resolve a JSON Pointer scope string to a property key.
9
+ *
10
+ * Supports the JSON Forms scope format: #/properties/<fieldName>
11
+ *
12
+ * @param scope - JSON Pointer string (e.g., "#/properties/temperature")
13
+ * @returns The property key (e.g., "temperature"), or null if invalid
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * resolveScopeToKey("#/properties/temperature") // => "temperature"
18
+ * resolveScopeToKey("#/properties/nested/deep") // => null (only single-level supported)
19
+ * resolveScopeToKey("invalid") // => null
20
+ * ```
21
+ */
22
+ export function resolveScopeToKey(scope) {
23
+ const prefix = '#/properties/';
24
+ if (!scope.startsWith(prefix)) {
25
+ return null;
26
+ }
27
+ const key = scope.slice(prefix.length);
28
+ // Only support single-level property references (no nested paths)
29
+ if (key.includes('/') || key.length === 0) {
30
+ return null;
31
+ }
32
+ return key;
33
+ }
34
+ /**
35
+ * Build a scope string from a property key.
36
+ * Inverse of resolveScopeToKey.
37
+ *
38
+ * @param key - Property key (e.g., "temperature")
39
+ * @returns JSON Pointer scope string (e.g., "#/properties/temperature")
40
+ */
41
+ export function keyToScope(key) {
42
+ return `#/properties/${key}`;
43
+ }
44
+ /**
45
+ * Generate a default UISchema from a ConfigSchema.
46
+ * Creates a flat VerticalLayout with one Control per property,
47
+ * preserving the property iteration order.
48
+ *
49
+ * This is a convenience utility for programmatically building UISchema.
50
+ *
51
+ * @param schema - The ConfigSchema to generate a UISchema from
52
+ * @returns A VerticalLayout UISchema element
53
+ */
54
+ export function generateDefaultUISchema(schema) {
55
+ const elements = Object.keys(schema.properties).map((key) => ({
56
+ type: 'Control',
57
+ scope: keyToScope(key)
58
+ }));
59
+ return {
60
+ type: 'VerticalLayout',
61
+ elements
62
+ };
63
+ }
64
+ /**
65
+ * Collect all property keys referenced by Controls in a UISchema tree.
66
+ * Useful for detecting properties that are NOT in the UISchema
67
+ * (e.g., to warn about unreferenced fields during development).
68
+ *
69
+ * @param element - Root UISchema element
70
+ * @returns Set of property keys referenced by Controls
71
+ */
72
+ export function collectReferencedKeys(element) {
73
+ const keys = new Set();
74
+ function walk(el) {
75
+ if (el.type === 'Control') {
76
+ const key = resolveScopeToKey(el.scope);
77
+ if (key)
78
+ keys.add(key);
79
+ }
80
+ else if (el.type === 'VerticalLayout' || el.type === 'Group') {
81
+ for (const child of el.elements) {
82
+ walk(child);
83
+ }
84
+ }
85
+ }
86
+ walk(element);
87
+ return keys;
88
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@d34dman/flowdrop",
3
3
  "license": "MIT",
4
4
  "private": false,
5
- "version": "0.0.56",
5
+ "version": "0.0.57",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",