footprintjs 4.3.1 → 4.4.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.
@@ -136,31 +136,28 @@ export interface FlowchartCheckpoint {
136
136
  * await executor.resume(checkpoint, { approved: true, approver: 'Jane' });
137
137
  * ```
138
138
  */
139
- export interface PausableHandler<TScope = any, TInput = unknown> {
139
+ export interface PausableHandler<TScope = any, TInput = unknown, TPauseData = unknown> {
140
140
  /**
141
141
  * First-run phase. Return data to pause, or void/undefined to continue normally.
142
142
  *
143
143
  * Any non-void return value becomes the `pauseData` in the checkpoint.
144
- * The library detects the return and pauses automatically no need to
145
- * call `pause()` or construct `{ pause: true }`.
144
+ * The consumer defines the `TPauseData` type the FE uses it to render
145
+ * the right UI (form fields, approval buttons, etc.).
146
146
  *
147
147
  * @example
148
148
  * ```typescript
149
- * execute: async (scope) => {
150
- * scope.orderId = '123';
151
- * return { question: `Approve order ${scope.orderId}?` }; // ← pauses
152
- * }
153
- *
154
- * // Conditional pause
155
- * execute: async (scope) => {
156
- * if (scope.amount > 500) {
157
- * return { reason: 'High-value order needs approval' }; // ← pauses
158
- * }
159
- * // void return → no pause, continues normally
160
- * }
149
+ * // TPauseData = { question: string; riskLevel: string }
150
+ * const handler: PausableHandler<MyState, { approved: boolean }, { question: string; riskLevel: string }> = {
151
+ * execute: async (scope) => {
152
+ * return { question: `Approve order ${scope.orderId}?`, riskLevel: 'high' };
153
+ * },
154
+ * resume: async (scope, input) => {
155
+ * scope.approved = input.approved;
156
+ * },
157
+ * };
161
158
  * ```
162
159
  */
163
- execute: (scope: TScope) => Promise<unknown> | unknown;
160
+ execute: (scope: TScope) => Promise<TPauseData | void> | TPauseData | void;
164
161
  /**
165
162
  * Resume phase. Called with the resume input when execution continues.
166
163
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "footprintjs",
3
- "version": "4.3.1",
3
+ "version": "4.4.0",
4
4
  "description": "Explainable backend flows — automatic causal traces, decision evidence, and MCP tool generation for AI agents",
5
5
  "license": "MIT",
6
6
  "author": "Sanjay Krishna Anbalagan",