@elqnt/workflow 2.1.4 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +6 -0
  2. package/SKILL.md +442 -0
  3. package/dist/api/index.js +3 -4
  4. package/dist/api/index.js.map +1 -1
  5. package/dist/api/index.mjs +1 -2
  6. package/dist/chunk-3GG6KTGJ.js +998 -0
  7. package/dist/chunk-3GG6KTGJ.js.map +1 -0
  8. package/dist/{chunk-UE4ZBFLG.mjs → chunk-4AUWFGQK.mjs} +1 -3
  9. package/dist/{chunk-UE4ZBFLG.mjs.map → chunk-4AUWFGQK.mjs.map} +1 -1
  10. package/dist/{chunk-H24IF5AA.js → chunk-6DV2LPSN.js} +2 -4
  11. package/dist/chunk-6DV2LPSN.js.map +1 -0
  12. package/dist/chunk-AXXQSYT7.mjs +998 -0
  13. package/dist/chunk-AXXQSYT7.mjs.map +1 -0
  14. package/dist/{chunk-YCEGKVXP.mjs → chunk-IY5JCMLA.mjs} +1 -3
  15. package/dist/{chunk-YCEGKVXP.mjs.map → chunk-IY5JCMLA.mjs.map} +1 -1
  16. package/dist/{chunk-JES2EBNO.js → chunk-YCO5IFZK.js} +2 -4
  17. package/dist/chunk-YCO5IFZK.js.map +1 -0
  18. package/dist/components/index.d.mts +245 -0
  19. package/dist/components/index.d.ts +245 -0
  20. package/dist/components/index.js +10 -0
  21. package/dist/components/index.js.map +1 -0
  22. package/dist/components/index.mjs +10 -0
  23. package/dist/components/index.mjs.map +1 -0
  24. package/dist/hooks/index.d.mts +72 -27
  25. package/dist/hooks/index.d.ts +72 -27
  26. package/dist/hooks/index.js +397 -5
  27. package/dist/hooks/index.js.map +1 -1
  28. package/dist/hooks/index.mjs +401 -9
  29. package/dist/hooks/index.mjs.map +1 -1
  30. package/dist/index.d.mts +4 -246
  31. package/dist/index.d.ts +4 -246
  32. package/dist/index.js +8 -1012
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.mjs +5 -1009
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/models/index.js +3 -4
  37. package/dist/models/index.js.map +1 -1
  38. package/dist/models/index.mjs +1 -2
  39. package/package.json +12 -6
  40. package/dist/chunk-H24IF5AA.js.map +0 -1
  41. package/dist/chunk-JES2EBNO.js.map +0 -1
  42. package/dist/chunk-KWWX35B4.js +0 -413
  43. package/dist/chunk-KWWX35B4.js.map +0 -1
  44. package/dist/chunk-WDERYFU3.mjs +0 -413
  45. package/dist/chunk-WDERYFU3.mjs.map +0 -1
@@ -0,0 +1,245 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { JSONSchema } from '@elqnt/types';
3
+
4
+ interface DynamicSchemaFormUIComponents {
5
+ Input: React.ComponentType<{
6
+ type?: string;
7
+ value: any;
8
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
9
+ disabled?: boolean;
10
+ className?: string;
11
+ placeholder?: string;
12
+ min?: number;
13
+ max?: number;
14
+ step?: string | number;
15
+ }>;
16
+ Label: React.ComponentType<{
17
+ htmlFor?: string;
18
+ className?: string;
19
+ children: React.ReactNode;
20
+ }>;
21
+ Textarea: React.ComponentType<{
22
+ value: any;
23
+ onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
24
+ disabled?: boolean;
25
+ rows?: number;
26
+ className?: string;
27
+ placeholder?: string;
28
+ }>;
29
+ Checkbox: React.ComponentType<{
30
+ id?: string;
31
+ checked: boolean;
32
+ onCheckedChange: (checked: boolean) => void;
33
+ disabled?: boolean;
34
+ }>;
35
+ Select: React.ComponentType<{
36
+ value: string;
37
+ onValueChange: (value: string) => void;
38
+ disabled?: boolean;
39
+ children: React.ReactNode;
40
+ }>;
41
+ SelectTrigger: React.ComponentType<{
42
+ className?: string;
43
+ children: React.ReactNode;
44
+ }>;
45
+ SelectValue: React.ComponentType<{
46
+ placeholder?: string;
47
+ }>;
48
+ SelectContent: React.ComponentType<{
49
+ children: React.ReactNode;
50
+ }>;
51
+ SelectItem: React.ComponentType<{
52
+ value: string;
53
+ className?: string;
54
+ children: React.ReactNode;
55
+ }>;
56
+ Button: React.ComponentType<{
57
+ type?: "button" | "submit" | "reset";
58
+ variant?: string;
59
+ size?: string;
60
+ className?: string;
61
+ onClick?: () => void;
62
+ disabled?: boolean;
63
+ children: React.ReactNode;
64
+ }>;
65
+ Card: React.ComponentType<{
66
+ className?: string;
67
+ children: React.ReactNode;
68
+ }>;
69
+ PlusIcon: React.ComponentType<{
70
+ className?: string;
71
+ }>;
72
+ TrashIcon: React.ComponentType<{
73
+ className?: string;
74
+ }>;
75
+ ChevronDownIcon: React.ComponentType<{
76
+ className?: string;
77
+ }>;
78
+ ChevronRightIcon: React.ComponentType<{
79
+ className?: string;
80
+ }>;
81
+ VariableIcon?: React.ComponentType<{
82
+ className?: string;
83
+ }>;
84
+ CheckIcon?: React.ComponentType<{
85
+ className?: string;
86
+ }>;
87
+ EditIcon?: React.ComponentType<{
88
+ className?: string;
89
+ }>;
90
+ Popover?: React.ComponentType<{
91
+ open?: boolean;
92
+ onOpenChange?: (open: boolean) => void;
93
+ children: React.ReactNode;
94
+ }>;
95
+ PopoverTrigger?: React.ComponentType<{
96
+ asChild?: boolean;
97
+ children: React.ReactNode;
98
+ }>;
99
+ PopoverContent?: React.ComponentType<{
100
+ className?: string;
101
+ align?: "start" | "center" | "end";
102
+ children: React.ReactNode;
103
+ }>;
104
+ Dialog?: React.ComponentType<{
105
+ open?: boolean;
106
+ onOpenChange?: (open: boolean) => void;
107
+ children: React.ReactNode;
108
+ }>;
109
+ DialogContent?: React.ComponentType<{
110
+ className?: string;
111
+ children: React.ReactNode;
112
+ }>;
113
+ DialogHeader?: React.ComponentType<{
114
+ className?: string;
115
+ children: React.ReactNode;
116
+ }>;
117
+ DialogTitle?: React.ComponentType<{
118
+ className?: string;
119
+ children: React.ReactNode;
120
+ }>;
121
+ DialogFooter?: React.ComponentType<{
122
+ className?: string;
123
+ children: React.ReactNode;
124
+ }>;
125
+ ScrollArea?: React.ComponentType<{
126
+ className?: string;
127
+ children: React.ReactNode;
128
+ }>;
129
+ MarkdownEditor?: React.ComponentType<{
130
+ content: string;
131
+ onChange: (markdown: string) => void;
132
+ placeholder?: string;
133
+ className?: string;
134
+ readOnly?: boolean;
135
+ minHeight?: string;
136
+ variables?: Array<{
137
+ name: string;
138
+ path: string;
139
+ title?: string;
140
+ }>;
141
+ }>;
142
+ cn: (...classes: (string | undefined | null | false)[]) => string;
143
+ }
144
+ /**
145
+ * Variable definition for workflow variables
146
+ */
147
+ interface WorkflowVariable {
148
+ name: string;
149
+ type: string;
150
+ title?: string;
151
+ path: string;
152
+ }
153
+ interface DynamicSchemaFormProps {
154
+ schema: JSONSchema;
155
+ value: any;
156
+ onChange: (value: any) => void;
157
+ disabled?: boolean;
158
+ path?: string[];
159
+ components: DynamicSchemaFormUIComponents;
160
+ /** Workflow variables available for selection */
161
+ variables?: WorkflowVariable[];
162
+ /** Whether to show variable picker buttons */
163
+ showVariablePicker?: boolean;
164
+ }
165
+ declare function DynamicSchemaForm({ schema, value, onChange, disabled, path, components, variables, showVariablePicker, }: DynamicSchemaFormProps): react_jsx_runtime.JSX.Element;
166
+
167
+ interface SchemaBuilderUIComponents {
168
+ Input: React.ComponentType<{
169
+ value: any;
170
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
171
+ disabled?: boolean;
172
+ className?: string;
173
+ placeholder?: string;
174
+ }>;
175
+ Label: React.ComponentType<{
176
+ htmlFor?: string;
177
+ className?: string;
178
+ children: React.ReactNode;
179
+ }>;
180
+ Checkbox: React.ComponentType<{
181
+ id?: string;
182
+ checked: boolean;
183
+ onCheckedChange: (checked: boolean) => void;
184
+ disabled?: boolean;
185
+ }>;
186
+ Select: React.ComponentType<{
187
+ value: string;
188
+ onValueChange: (value: string) => void;
189
+ disabled?: boolean;
190
+ children: React.ReactNode;
191
+ }>;
192
+ SelectTrigger: React.ComponentType<{
193
+ className?: string;
194
+ children: React.ReactNode;
195
+ }>;
196
+ SelectValue: React.ComponentType<{
197
+ placeholder?: string;
198
+ }>;
199
+ SelectContent: React.ComponentType<{
200
+ children: React.ReactNode;
201
+ }>;
202
+ SelectItem: React.ComponentType<{
203
+ value: string;
204
+ className?: string;
205
+ children: React.ReactNode;
206
+ }>;
207
+ Button: React.ComponentType<{
208
+ type?: "button" | "submit" | "reset";
209
+ variant?: string;
210
+ size?: string;
211
+ className?: string;
212
+ onClick?: () => void;
213
+ disabled?: boolean;
214
+ children: React.ReactNode;
215
+ }>;
216
+ Card: React.ComponentType<{
217
+ className?: string;
218
+ children: React.ReactNode;
219
+ }>;
220
+ PlusIcon: React.ComponentType<{
221
+ className?: string;
222
+ }>;
223
+ TrashIcon: React.ComponentType<{
224
+ className?: string;
225
+ }>;
226
+ GripVerticalIcon: React.ComponentType<{
227
+ className?: string;
228
+ }>;
229
+ ChevronDownIcon: React.ComponentType<{
230
+ className?: string;
231
+ }>;
232
+ ChevronRightIcon: React.ComponentType<{
233
+ className?: string;
234
+ }>;
235
+ cn: (...classes: (string | undefined | null | false)[]) => string;
236
+ }
237
+ interface SchemaBuilderProps {
238
+ schema: JSONSchema;
239
+ onChange: (schema: JSONSchema) => void;
240
+ disabled?: boolean;
241
+ components: SchemaBuilderUIComponents;
242
+ }
243
+ declare function SchemaBuilder({ schema, onChange, disabled, components, }: SchemaBuilderProps): react_jsx_runtime.JSX.Element;
244
+
245
+ export { DynamicSchemaForm, type DynamicSchemaFormProps, type DynamicSchemaFormUIComponents, SchemaBuilder, type SchemaBuilderProps, type SchemaBuilderUIComponents, type WorkflowVariable };
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+
3
+
4
+
5
+ var _chunk3GG6KTGJjs = require('../chunk-3GG6KTGJ.js');
6
+
7
+
8
+
9
+ exports.DynamicSchemaForm = _chunk3GG6KTGJjs.DynamicSchemaForm; exports.SchemaBuilder = _chunk3GG6KTGJjs.SchemaBuilder;
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages/@elqnt/workflow/dist/components/index.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uHAAC","file":"/home/runner/work/eloquent/eloquent/packages/@elqnt/workflow/dist/components/index.js"}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ DynamicSchemaForm,
4
+ SchemaBuilder
5
+ } from "../chunk-AXXQSYT7.mjs";
6
+ export {
7
+ DynamicSchemaForm,
8
+ SchemaBuilder
9
+ };
10
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -6,84 +6,129 @@ import '@elqnt/types';
6
6
 
7
7
  type UseWorkflowsOptions = ApiClientOptions;
8
8
  /**
9
- * Hook for workflow definition CRUD operations
9
+ * The exact, stable return surface of `useWorkflows`.
10
10
  *
11
- * @example
12
- * ```tsx
13
- * const { loading, error, listWorkflows, createWorkflow } = useWorkflows({
14
- * baseUrl: apiGatewayUrl,
15
- * orgId: selectedOrgId,
16
- * });
17
- *
18
- * const workflows = await listWorkflows();
19
- * ```
11
+ * This is the agent/consumer **contract**: the only methods that exist on the
12
+ * workflow-definitions hook. Every method is imperative and DOES NOT throw — on
13
+ * failure it resolves to the documented default and sets `error`. See `SKILL.md`.
20
14
  */
21
- declare function useWorkflows(options: UseWorkflowsOptions): {
15
+ interface UseWorkflowsReturn {
16
+ /** True while any method is in flight. */
22
17
  loading: boolean;
18
+ /** Latest method error, else null. */
23
19
  error: string | null;
20
+ /** GET /api/v1/workflows — default `[]` on error. */
24
21
  listWorkflows: () => Promise<WorkflowDefinition[]>;
22
+ /** GET /api/v1/workflows/{id} — default `null`. */
25
23
  getWorkflow: (workflowId: string) => Promise<WorkflowDefinition | null>;
24
+ /** POST /api/v1/workflows — created definition, or `null` on error. */
26
25
  createWorkflow: (workflow: Partial<WorkflowDefinition>) => Promise<WorkflowDefinition | null>;
26
+ /** PUT /api/v1/workflows/{id} — updated definition, or `null` on error. */
27
27
  updateWorkflow: (workflowId: string, workflow: Partial<WorkflowDefinition>) => Promise<WorkflowDefinition | null>;
28
+ /** DELETE /api/v1/workflows/{id} — `true`/`false`. */
28
29
  deleteWorkflow: (workflowId: string) => Promise<boolean>;
29
- };
30
-
31
- type UseWorkflowInstancesOptions = ApiClientOptions;
30
+ }
32
31
  /**
33
- * Hook for workflow instance operations
32
+ * Hook for workflow definition CRUD operations
34
33
  *
35
34
  * @example
36
35
  * ```tsx
37
- * const { listInstances, getInstance, createInstance } = useWorkflowInstances({
36
+ * const { loading, error, listWorkflows, createWorkflow } = useWorkflows({
38
37
  * baseUrl: apiGatewayUrl,
39
38
  * orgId: selectedOrgId,
40
39
  * });
41
40
  *
42
- * const instances = await listInstances(definitionId);
41
+ * const workflows = await listWorkflows();
43
42
  * ```
44
43
  */
45
- declare function useWorkflowInstances(options: UseWorkflowInstancesOptions): {
44
+ declare function useWorkflows(options: UseWorkflowsOptions): UseWorkflowsReturn;
45
+
46
+ type UseWorkflowInstancesOptions = ApiClientOptions;
47
+ /**
48
+ * The exact, stable return surface of `useWorkflowInstances`.
49
+ *
50
+ * This is the agent/consumer **contract**: the only methods that exist on the
51
+ * workflow-instances hook. Every method is imperative and DOES NOT throw — on
52
+ * failure it resolves to the documented default and sets `error`. See `SKILL.md`.
53
+ */
54
+ interface UseWorkflowInstancesReturn {
55
+ /** True while any method is in flight. */
46
56
  loading: boolean;
57
+ /** Latest method error, else null. */
47
58
  error: string | null;
59
+ /** GET /api/v1/workflows/{definitionId}/instances(?userId=&status=) — default `[]`. */
48
60
  listInstances: (definitionId: string, filters?: {
49
61
  userId?: string;
50
62
  status?: string;
51
63
  }) => Promise<WorkflowInstance[]>;
64
+ /** GET /api/v1/workflows/instances/{id} — default `null`. */
52
65
  getInstance: (instanceId: string) => Promise<WorkflowInstance | null>;
66
+ /** POST /api/v1/workflows/{definitionId}/instances — new instance, or `null`. */
53
67
  createInstance: (definitionId: string, data?: {
54
68
  variables?: Record<string, unknown>;
55
69
  autoExecute?: boolean;
56
70
  }) => Promise<WorkflowInstance | null>;
71
+ /** PUT /api/v1/workflows/instances/{id}/status — updated instance, or `null`. */
57
72
  updateStatus: (instanceId: string, status: string) => Promise<WorkflowInstance | null>;
73
+ /** POST .../instances/{id}/nodes/{nodeId}/execute — node output, or `null`. */
58
74
  executeNode: (instanceId: string, nodeId: string, input: Record<string, unknown>) => Promise<Record<string, unknown> | null>;
75
+ /** POST .../instances/{id}/nodes/{nodeId}/resume — updated instance, or `null`. */
59
76
  resumeNode: (instanceId: string, nodeId: string, result: Record<string, unknown>) => Promise<WorkflowInstance | null>;
77
+ /** POST .../instances/{id}/nodes/{nodeId}/retry — updated instance, or `null`. */
60
78
  retryNode: (instanceId: string, nodeId: string) => Promise<WorkflowInstance | null>;
61
- };
62
-
63
- type UseWorkflowTemplatesOptions = ApiClientOptions;
79
+ }
64
80
  /**
65
- * Hook for workflow template operations
81
+ * Hook for workflow instance operations
66
82
  *
67
83
  * @example
68
84
  * ```tsx
69
- * const { listTemplates, getTemplate, instantiateTemplate } = useWorkflowTemplates({
85
+ * const { listInstances, getInstance, createInstance } = useWorkflowInstances({
70
86
  * baseUrl: apiGatewayUrl,
71
87
  * orgId: selectedOrgId,
72
88
  * });
73
89
  *
74
- * const templates = await listTemplates();
90
+ * const instances = await listInstances(definitionId);
75
91
  * ```
76
92
  */
77
- declare function useWorkflowTemplates(options: UseWorkflowTemplatesOptions): {
93
+ declare function useWorkflowInstances(options: UseWorkflowInstancesOptions): UseWorkflowInstancesReturn;
94
+
95
+ type UseWorkflowTemplatesOptions = ApiClientOptions;
96
+ /**
97
+ * The exact, stable return surface of `useWorkflowTemplates`.
98
+ *
99
+ * This is the agent/consumer **contract**: the only methods that exist on the
100
+ * workflow-templates hook. Every method is imperative and DOES NOT throw — on
101
+ * failure it resolves to the documented default and sets `error`. See `SKILL.md`.
102
+ */
103
+ interface UseWorkflowTemplatesReturn {
104
+ /** True while any method is in flight. */
78
105
  loading: boolean;
106
+ /** Latest method error, else null. */
79
107
  error: string | null;
108
+ /** GET /api/v1/workflows/templates(?category=) — default `[]` on error. */
80
109
  listTemplates: (category?: string) => Promise<WorkflowTemplate[]>;
110
+ /** GET /api/v1/workflows/templates/{id} — default `null`. */
81
111
  getTemplate: (templateId: string) => Promise<WorkflowTemplate | null>;
112
+ /** POST /api/v1/workflows/templates/{id}/instantiate — new definition, or `null`. */
82
113
  instantiateTemplate: (templateId: string, params: {
83
114
  variables: Record<string, unknown>;
84
115
  title?: string;
85
116
  }) => Promise<WorkflowDefinition | null>;
86
- };
117
+ }
118
+ /**
119
+ * Hook for workflow template operations
120
+ *
121
+ * @example
122
+ * ```tsx
123
+ * const { listTemplates, getTemplate, instantiateTemplate } = useWorkflowTemplates({
124
+ * baseUrl: apiGatewayUrl,
125
+ * orgId: selectedOrgId,
126
+ * });
127
+ *
128
+ * const templates = await listTemplates();
129
+ * ```
130
+ */
131
+ declare function useWorkflowTemplates(options: UseWorkflowTemplatesOptions): UseWorkflowTemplatesReturn;
87
132
 
88
133
  /**
89
134
  * Keep a mutable ref synchronized with the latest value
@@ -104,4 +149,4 @@ declare function useWorkflowTemplates(options: UseWorkflowTemplatesOptions): {
104
149
  */
105
150
  declare function useOptionsRef<T>(options: T): React.MutableRefObject<T>;
106
151
 
107
- export { type UseWorkflowInstancesOptions, type UseWorkflowTemplatesOptions, type UseWorkflowsOptions, useOptionsRef, useWorkflowInstances, useWorkflowTemplates, useWorkflows };
152
+ export { type UseWorkflowInstancesOptions, type UseWorkflowInstancesReturn, type UseWorkflowTemplatesOptions, type UseWorkflowTemplatesReturn, type UseWorkflowsOptions, type UseWorkflowsReturn, useOptionsRef, useWorkflowInstances, useWorkflowTemplates, useWorkflows };
@@ -6,84 +6,129 @@ import '@elqnt/types';
6
6
 
7
7
  type UseWorkflowsOptions = ApiClientOptions;
8
8
  /**
9
- * Hook for workflow definition CRUD operations
9
+ * The exact, stable return surface of `useWorkflows`.
10
10
  *
11
- * @example
12
- * ```tsx
13
- * const { loading, error, listWorkflows, createWorkflow } = useWorkflows({
14
- * baseUrl: apiGatewayUrl,
15
- * orgId: selectedOrgId,
16
- * });
17
- *
18
- * const workflows = await listWorkflows();
19
- * ```
11
+ * This is the agent/consumer **contract**: the only methods that exist on the
12
+ * workflow-definitions hook. Every method is imperative and DOES NOT throw — on
13
+ * failure it resolves to the documented default and sets `error`. See `SKILL.md`.
20
14
  */
21
- declare function useWorkflows(options: UseWorkflowsOptions): {
15
+ interface UseWorkflowsReturn {
16
+ /** True while any method is in flight. */
22
17
  loading: boolean;
18
+ /** Latest method error, else null. */
23
19
  error: string | null;
20
+ /** GET /api/v1/workflows — default `[]` on error. */
24
21
  listWorkflows: () => Promise<WorkflowDefinition[]>;
22
+ /** GET /api/v1/workflows/{id} — default `null`. */
25
23
  getWorkflow: (workflowId: string) => Promise<WorkflowDefinition | null>;
24
+ /** POST /api/v1/workflows — created definition, or `null` on error. */
26
25
  createWorkflow: (workflow: Partial<WorkflowDefinition>) => Promise<WorkflowDefinition | null>;
26
+ /** PUT /api/v1/workflows/{id} — updated definition, or `null` on error. */
27
27
  updateWorkflow: (workflowId: string, workflow: Partial<WorkflowDefinition>) => Promise<WorkflowDefinition | null>;
28
+ /** DELETE /api/v1/workflows/{id} — `true`/`false`. */
28
29
  deleteWorkflow: (workflowId: string) => Promise<boolean>;
29
- };
30
-
31
- type UseWorkflowInstancesOptions = ApiClientOptions;
30
+ }
32
31
  /**
33
- * Hook for workflow instance operations
32
+ * Hook for workflow definition CRUD operations
34
33
  *
35
34
  * @example
36
35
  * ```tsx
37
- * const { listInstances, getInstance, createInstance } = useWorkflowInstances({
36
+ * const { loading, error, listWorkflows, createWorkflow } = useWorkflows({
38
37
  * baseUrl: apiGatewayUrl,
39
38
  * orgId: selectedOrgId,
40
39
  * });
41
40
  *
42
- * const instances = await listInstances(definitionId);
41
+ * const workflows = await listWorkflows();
43
42
  * ```
44
43
  */
45
- declare function useWorkflowInstances(options: UseWorkflowInstancesOptions): {
44
+ declare function useWorkflows(options: UseWorkflowsOptions): UseWorkflowsReturn;
45
+
46
+ type UseWorkflowInstancesOptions = ApiClientOptions;
47
+ /**
48
+ * The exact, stable return surface of `useWorkflowInstances`.
49
+ *
50
+ * This is the agent/consumer **contract**: the only methods that exist on the
51
+ * workflow-instances hook. Every method is imperative and DOES NOT throw — on
52
+ * failure it resolves to the documented default and sets `error`. See `SKILL.md`.
53
+ */
54
+ interface UseWorkflowInstancesReturn {
55
+ /** True while any method is in flight. */
46
56
  loading: boolean;
57
+ /** Latest method error, else null. */
47
58
  error: string | null;
59
+ /** GET /api/v1/workflows/{definitionId}/instances(?userId=&status=) — default `[]`. */
48
60
  listInstances: (definitionId: string, filters?: {
49
61
  userId?: string;
50
62
  status?: string;
51
63
  }) => Promise<WorkflowInstance[]>;
64
+ /** GET /api/v1/workflows/instances/{id} — default `null`. */
52
65
  getInstance: (instanceId: string) => Promise<WorkflowInstance | null>;
66
+ /** POST /api/v1/workflows/{definitionId}/instances — new instance, or `null`. */
53
67
  createInstance: (definitionId: string, data?: {
54
68
  variables?: Record<string, unknown>;
55
69
  autoExecute?: boolean;
56
70
  }) => Promise<WorkflowInstance | null>;
71
+ /** PUT /api/v1/workflows/instances/{id}/status — updated instance, or `null`. */
57
72
  updateStatus: (instanceId: string, status: string) => Promise<WorkflowInstance | null>;
73
+ /** POST .../instances/{id}/nodes/{nodeId}/execute — node output, or `null`. */
58
74
  executeNode: (instanceId: string, nodeId: string, input: Record<string, unknown>) => Promise<Record<string, unknown> | null>;
75
+ /** POST .../instances/{id}/nodes/{nodeId}/resume — updated instance, or `null`. */
59
76
  resumeNode: (instanceId: string, nodeId: string, result: Record<string, unknown>) => Promise<WorkflowInstance | null>;
77
+ /** POST .../instances/{id}/nodes/{nodeId}/retry — updated instance, or `null`. */
60
78
  retryNode: (instanceId: string, nodeId: string) => Promise<WorkflowInstance | null>;
61
- };
62
-
63
- type UseWorkflowTemplatesOptions = ApiClientOptions;
79
+ }
64
80
  /**
65
- * Hook for workflow template operations
81
+ * Hook for workflow instance operations
66
82
  *
67
83
  * @example
68
84
  * ```tsx
69
- * const { listTemplates, getTemplate, instantiateTemplate } = useWorkflowTemplates({
85
+ * const { listInstances, getInstance, createInstance } = useWorkflowInstances({
70
86
  * baseUrl: apiGatewayUrl,
71
87
  * orgId: selectedOrgId,
72
88
  * });
73
89
  *
74
- * const templates = await listTemplates();
90
+ * const instances = await listInstances(definitionId);
75
91
  * ```
76
92
  */
77
- declare function useWorkflowTemplates(options: UseWorkflowTemplatesOptions): {
93
+ declare function useWorkflowInstances(options: UseWorkflowInstancesOptions): UseWorkflowInstancesReturn;
94
+
95
+ type UseWorkflowTemplatesOptions = ApiClientOptions;
96
+ /**
97
+ * The exact, stable return surface of `useWorkflowTemplates`.
98
+ *
99
+ * This is the agent/consumer **contract**: the only methods that exist on the
100
+ * workflow-templates hook. Every method is imperative and DOES NOT throw — on
101
+ * failure it resolves to the documented default and sets `error`. See `SKILL.md`.
102
+ */
103
+ interface UseWorkflowTemplatesReturn {
104
+ /** True while any method is in flight. */
78
105
  loading: boolean;
106
+ /** Latest method error, else null. */
79
107
  error: string | null;
108
+ /** GET /api/v1/workflows/templates(?category=) — default `[]` on error. */
80
109
  listTemplates: (category?: string) => Promise<WorkflowTemplate[]>;
110
+ /** GET /api/v1/workflows/templates/{id} — default `null`. */
81
111
  getTemplate: (templateId: string) => Promise<WorkflowTemplate | null>;
112
+ /** POST /api/v1/workflows/templates/{id}/instantiate — new definition, or `null`. */
82
113
  instantiateTemplate: (templateId: string, params: {
83
114
  variables: Record<string, unknown>;
84
115
  title?: string;
85
116
  }) => Promise<WorkflowDefinition | null>;
86
- };
117
+ }
118
+ /**
119
+ * Hook for workflow template operations
120
+ *
121
+ * @example
122
+ * ```tsx
123
+ * const { listTemplates, getTemplate, instantiateTemplate } = useWorkflowTemplates({
124
+ * baseUrl: apiGatewayUrl,
125
+ * orgId: selectedOrgId,
126
+ * });
127
+ *
128
+ * const templates = await listTemplates();
129
+ * ```
130
+ */
131
+ declare function useWorkflowTemplates(options: UseWorkflowTemplatesOptions): UseWorkflowTemplatesReturn;
87
132
 
88
133
  /**
89
134
  * Keep a mutable ref synchronized with the latest value
@@ -104,4 +149,4 @@ declare function useWorkflowTemplates(options: UseWorkflowTemplatesOptions): {
104
149
  */
105
150
  declare function useOptionsRef<T>(options: T): React.MutableRefObject<T>;
106
151
 
107
- export { type UseWorkflowInstancesOptions, type UseWorkflowTemplatesOptions, type UseWorkflowsOptions, useOptionsRef, useWorkflowInstances, useWorkflowTemplates, useWorkflows };
152
+ export { type UseWorkflowInstancesOptions, type UseWorkflowInstancesReturn, type UseWorkflowTemplatesOptions, type UseWorkflowTemplatesReturn, type UseWorkflowsOptions, type UseWorkflowsReturn, useOptionsRef, useWorkflowInstances, useWorkflowTemplates, useWorkflows };