@mantir/headless-view 0.1.8 → 0.1.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.
package/README.md CHANGED
@@ -35,6 +35,9 @@ function App() {
35
35
  <HeadlessExecutor
36
36
  workflow={workflow}
37
37
  apiEndpoint="/api/execute"
38
+ onResult={(result) => console.log('Final workflow result:', result)}
39
+ onDone={() => console.log('Execution finished')}
40
+ initialInput="Programmatic input value"
38
41
  />
39
42
  </div>
40
43
  );
@@ -53,10 +56,14 @@ function CustomExecutor({ workflow }) {
53
56
  messages,
54
57
  isRunning,
55
58
  pendingInterrupt,
56
- restart,
59
+ execute, // Programmatic trigger
57
60
  resume
58
61
  } = useWorkflowExecution({
59
- apiEndpoint: "/api/execute"
62
+ apiEndpoint: "/api/execute",
63
+ workflow: workflow, // Pass to enable initialInput auto-start
64
+ initialInput: "Hello world",
65
+ onResult: (data) => console.log(data),
66
+ onDone: () => console.log("Done")
60
67
  });
61
68
 
62
69
  return (
@@ -67,6 +74,17 @@ function CustomExecutor({ workflow }) {
67
74
  }
68
75
  ```
69
76
 
77
+ ## Props / Hook Options
78
+
79
+ - `apiEndpoint`: (string) The URL to post workflow execution requests to.
80
+ - `workflow`: (Workflow) The JSON workflow definition.
81
+ - `initialInput`: (string, optional) If provided, the workflow will automatically start on mount using this value.
82
+ - `onResult`: (callback, optional) Called when the workflow produces a final JSON result.
83
+ - `onDone`: (callback, optional) Called when the execution stream finishes completely.
84
+ - `onMessage`: (callback, optional) Called for every message/trace event.
85
+ - `onInterrupt`: (callback, optional) Called when the workflow requires user input.
86
+ - `onError`: (callback, optional) Called if a network or execution error occurs.
87
+
70
88
  ## Configuration for Tailwind CSS Projects
71
89
 
72
90
  If your project already uses Tailwind CSS (v3 or v4) and you want to use your project's theme and styles, you should add the package to your Tailwind configuration instead of importing the CSS file.
package/dist/index.d.mts CHANGED
@@ -154,6 +154,7 @@ interface HeadlessExecutorProps {
154
154
  apiEndpoint?: string;
155
155
  className?: string;
156
156
  onResult?: (result: any) => void;
157
+ onDone?: () => void;
157
158
  initialInput?: string;
158
159
  }
159
160
  declare const HeadlessExecutor: React.FC<HeadlessExecutorProps>;
package/dist/index.d.ts CHANGED
@@ -154,6 +154,7 @@ interface HeadlessExecutorProps {
154
154
  apiEndpoint?: string;
155
155
  className?: string;
156
156
  onResult?: (result: any) => void;
157
+ onDone?: () => void;
157
158
  initialInput?: string;
158
159
  }
159
160
  declare const HeadlessExecutor: React.FC<HeadlessExecutorProps>;