jsfe 0.1.0 → 0.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.
package/README.md CHANGED
@@ -15,170 +15,190 @@ npm i jsfe
15
15
  *For detailed tutorials, step-by-step examples, and comprehensive workflow patterns, see the **[User Guide](JavaScript%20Flow%20Engine.md)**.*
16
16
 
17
17
  ## Usage
18
- \`\`\`ts
18
+
19
+ ```typescript
19
20
  import { WorkflowEngine } from "jsfe";
21
+
22
+ // 1. Create the engine
20
23
  const engine = new WorkflowEngine(
21
- hostLogger: Logger, // logger instance like winston - supporting .info/.debug/.warn/.error methods
22
- aiCallback: AiCallbackFunction, // host provided access to AI fetch function aiFetcher(systemInstructions, userMessage) -> response string
23
- flowsMenu: FlowDefinition[], // host defined available flows
24
- toolsRegistry: ToolDefinition[], // host defined tools registry
25
- APPROVED_FUNCTIONS: ApprovedFunctions, // Optional host provided safe functions map
26
- globalVariables?: Record<string, unknown> // Optional global variables shared across all new flows
27
- validateOnInit: boolean = true, // Optional validate all flows an enggine initialization
28
- language?: string, // Optional language code
29
- messageRegistry?: MessageRegistry, // Optional override all engine internationalized messages
30
- guidanceConfig?: GuidanceConfig, // Optional overide default internationalized guidance prompts
24
+ hostLogger, // Your logging instance
25
+ aiCallback, // Your AI communication function
26
+ flowsMenu, // Array of flow definitions
27
+ toolsRegistry, // Array of tool definitions
28
+ APPROVED_FUNCTIONS, // Pre-approved local functions
29
+ globalVariables, // Optional: Session-wide variables
30
+ validateOnInit, // Optional: Enable pre-flight validation (default: true)
31
+ language, // Optional: User's preferred language
32
+ messageRegistry, // Optional: Custom message templates
33
+ guidanceConfig // Optional: User assistance configuration
31
34
  );
32
35
 
33
- \`\`\`
36
+ // 2. Initialize a session for each user
37
+ const sessionContext = engine.initSession(yourLogger, 'user-123', 'session-456');
38
+
39
+ // 3. Process user input and assistant responses
40
+ const result = await engine.updateActivity(contextEntry, sessionContext);
41
+ ```
42
+
43
+ ### Session Management
44
+
45
+ - Each user requires a unique session context via `initSession(logger, userId, sessionId)`
46
+ - The `EngineSessionContext` object should be persisted by your application
47
+ - Pass the same session context to `updateActivity` for conversation continuity
48
+
49
+ ### Context Entry Types
50
+
51
+ - User input: `contextEntry.role = 'user'` - analyzed and may trigger flow execution
52
+ - Assistant response: `contextEntry.role = 'assistant'` - added to context for awareness
53
+
54
+ ### ContextEntry Structure
34
55
 
35
- /*
36
- ==========================================
37
- ENHANCED FLOW ENGINE ARCHITECTURE OVERVIEW
38
- ==========================================
56
+ ```typescript
57
+ interface ContextEntry {
58
+ role: 'user' | 'assistant' | 'system' | 'tool'; // Message role type
59
+ content: string | Record<string, unknown>; // Message content (text, object, etc.)
60
+ timestamp: number; // Unix timestamp in milliseconds
61
+ stepId?: string; // Optional: Associated flow step ID
62
+ toolName?: string; // Optional: Tool name for tool messages
63
+ metadata?: Record<string, unknown>; // Optional: Additional context data
64
+ }
65
+ ```
66
+
67
+ ### Example Usage
68
+
69
+ ```typescript
70
+ // User message
71
+ const userEntry = {
72
+ role: 'user',
73
+ content: 'I need help with my account',
74
+ timestamp: Date.now()
75
+ };
76
+ // Process the message
77
+ await engine.updateActivity(userEntry, sessionContext);
78
+
79
+ // Assistant response
80
+ const assistantEntry = {
81
+ role: 'assistant',
82
+ content: 'I can help you with your account. What specific issue are you experiencing?',
83
+ timestamp: Date.now(),
84
+ stepId: 'greeting-step'
85
+ };
86
+ // Process the message
87
+ await engine.updateActivity(assistantEntry, sessionContext);
88
+ ```
89
+
90
+ ## Architecture Overview
39
91
 
40
- MAJOR DESIGN ENHANCEMENT: Stack-of-Stacks Architecture for Flow Interruption/Resumption
92
+ ### Stack-of-Stacks Design
41
93
 
42
- This Flow Engine implements a sophisticated "stack-of-stacks" architecture that allows flows to be
43
- suspended and resumed, enabling users to naturally interrupt one workflow to handle another task,
44
- then return to their original workflow seamlessly.
94
+ The Flow Engine implements a sophisticated "stack-of-stacks" architecture that allows flows to be suspended and resumed, enabling users to naturally interrupt one workflow to handle another task, then return to their original workflow seamlessly.
45
95
 
46
- ==========================================
47
- CORE ARCHITECTURE COMPONENTS
48
- ==========================================
96
+ #### Core Components
49
97
 
50
- 1. STACK-OF-STACKS DESIGN:
51
- - Multiple independent flow execution stacks
98
+ 1. **Multiple Independent Flow Execution Stacks**
52
99
  - Active stack index tracks current execution context
53
100
  - Automatic stack switching for flow interruption/resumption
54
101
  - Proper isolation between different workflow contexts
55
102
 
56
- 2. FLOW FRAME STRUCTURE:
103
+ 2. **Flow Frame Structure**
57
104
  Each flow execution maintains a complete context frame:
58
- - flowName, flowId, flowVersion: Flow identity and versioning
59
- - flowStepsStack: Remaining steps (reversed for efficient pop operations)
60
- - contextStack: Complete history of inputs and responses
61
- - inputStack: Current input context for step execution
62
- - variables: Unified flat variable storage (shared across sub-flows)
63
- - transaction: Comprehensive transaction management and audit trail
64
- - userId, startTime: User context and timing metadata
65
-
66
- 3. HELPER FUNCTION ARCHITECTURE:
105
+ ```typescript
106
+ {
107
+ flowName: string, // Human-readable flow name
108
+ flowId: string, // Unique flow identifier
109
+ flowVersion: string, // Flow version for compatibility
110
+ flowStepsStack: [...], // Remaining steps (reversed)
111
+ contextStack: [...], // Complete interaction history
112
+ inputStack: [...], // Current input context
113
+ variables: {}, // Unified variable storage
114
+ transaction: TransactionObj, // Audit and transaction tracking
115
+ userId: string, // User identifier
116
+ startTime: number, // Flow start timestamp
117
+ pendingVariable: string, // Variable awaiting user input
118
+ lastSayMessage: string, // Last SAY step output
119
+ pendingInterruption: {} // Interruption state management
120
+ }
121
+ ```
122
+
123
+ 3. **Helper Function Architecture**
67
124
  All stack operations go through centralized helper functions:
68
- - initializeFlowStacks(engine): Ensures proper structure
69
- - getCurrentStack(engine): Gets currently active stack
70
- - getCurrentStackLength(engine): Safe length checking
71
- - pushToCurrentStack(engine, frame): Adds flow to active stack
72
- - popFromCurrentStack(engine): Removes flow from active stack
73
- - createNewStack(engine): Creates new stack for interruptions
74
- - switchToPreviousStack(engine): Returns to previous context
75
-
76
- ==========================================
77
- DATA STRUCTURES & PROPERTIES
78
- ==========================================
79
-
80
- FLOW FRAME PROPERTIES:
81
- {
82
- flowName: string, // Human-readable flow name
83
- flowId: string, // Unique flow identifier
84
- flowVersion: string, // Flow version for compatibility
85
- flowStepsStack: [...], // Remaining steps (reversed)
86
- contextStack: [...], // Complete interaction history
87
- inputStack: [...], // Current input context
88
- variables: {}, // Unified variable storage
89
- transaction: TransactionObj, // Audit and transaction tracking
90
- userId: string, // User identifier
91
- startTime: number, // Flow start timestamp
92
- pendingVariable: string, // Variable awaiting user input
93
- lastSayMessage: string, // Last SAY step output
94
- pendingInterruption: {} // Interruption state management
95
- }
125
+ - `initializeFlowStacks(engine)`: Ensures proper structure
126
+ - `getCurrentStack(engine)`: Gets currently active stack
127
+ - `pushToCurrentStack(engine, frame)`: Adds flow to active stack
128
+ - `popFromCurrentStack(engine)`: Removes flow from active stack
96
129
 
97
- ========================================
98
- SUPPORTED FEATURES & CAPABILITIES
99
- ========================================
100
-
101
- FLOW EXECUTION MODES:
102
- ✅ Linear Flow Execution - Sequential step processing
103
- ✅ Sub-Flow Calls - Nested workflow execution
104
- ✅ Flow Interruption - Suspend current flow for new task
105
- ✅ Flow Resumption - Return to previously suspended flows
106
- ✅ Flow Replacement - Replace current flow with new flow
107
- ✅ Flow Reboot - Nuclear option: clear all flows and restart
108
-
109
- CALL TYPE BEHAVIORS:
110
- ✅ "call" (default) - Normal sub-flow, preserves parent on stack
111
- ✅ "replace" - Replace current flow with new flow
112
- ✅ "reboot" - Clear entire stack and start fresh (emergency recovery)
113
-
114
- STEP TYPE SUPPORT:
115
- ✅ SAY - Non-blocking output messages (accumulated)
116
- ✅ SAY-GET - Blocking output with user input request
117
- ✅ SET - Variable assignment with interpolation support
118
- ✅ CALL-TOOL - External tool execution with error handling
119
- ✅ FLOW - Sub-flow execution with multiple call types
120
- ✅ SWITCH - Enhanced conditional branching with expressions
121
-
122
- ADVANCED SWITCH CONDITIONS:
123
- ✅ Exact Value Matching - Traditional switch behavior
124
- ✅ Expression Evaluation - Dynamic condition evaluation using safe JavaScript expressions
125
- ✅ Mixed Branches - Combine exact matches with conditions
126
- ✅ Secure Evaluation - No eval(), no code injection, safe expression parsing
127
- ✅ Expression Templates - {{variable + otherVar}} and {{complex.expression > threshold}} support
128
-
129
- EXPRESSION TEMPLATE SYSTEM:
130
- The engine supports safe JavaScript expressions within {{}} templates:
131
- - Simple variables: {{userName}}, {{account.balance}}
132
- - Arithmetic: {{amount + fee}}, {{price * quantity}}
133
- - Comparisons: {{age >= 18}}, {{status === 'active'}}
134
- - Logical: {{isAdmin && hasAccess}}, {{retryCount < maxRetries}}
135
- - Complex: {{user.permissions.includes('admin') && creditScore > 700}}
136
-
137
- SAFE METHOD CALLS:
138
- The engine includes comprehensive security controls that allow only pre-approved methods:
130
+ ## Features & Capabilities
139
131
 
140
- **String Methods:**
141
- Case conversion: toLowerCase(), toUpperCase()
142
- Whitespace: trim(), padStart(), padEnd()
143
- Access: charAt(), charCodeAt(), indexOf(), lastIndexOf()
144
- Extraction: substring(), substr(), slice(), split()
145
- Search: includes(), startsWith(), endsWith(), match(), search()
146
- Manipulation: replace(), repeat(), concat()
147
- ✅ Utility: toString(), valueOf(), length, localeCompare(), normalize()
132
+ ### Flow Execution Modes
133
+ - **Linear Flow Execution** - Sequential step processing
134
+ - **Sub-Flow Calls** - Nested workflow execution
135
+ - **Flow Interruption** - Suspend current flow for new task
136
+ - **Flow Resumption** - Return to previously suspended flows
137
+ - **Flow Replacement** - Replace current flow with new flow
138
+ - **Flow Reboot** - Nuclear option: clear all flows and restart
148
139
 
149
- **Array Methods:**
150
- Inspection: length, includes(), indexOf(), lastIndexOf()
151
- Extraction: slice(), join()
152
- Conversion: toString(), valueOf()
140
+ ### Step Types
141
+ - **SAY** - Non-blocking output messages (accumulated)
142
+ - **SAY-GET** - Blocking output with user input request
143
+ - **SET** - Variable assignment with interpolation support
144
+ - ✅ **CALL-TOOL** - External tool execution with error handling
145
+ - ✅ **FLOW** - Sub-flow execution with multiple call types
146
+ - ✅ **SWITCH** - Enhanced conditional branching with expressions
153
147
 
154
- **Math Methods:**
155
- ✅ Basic: abs(), ceil(), floor(), round()
156
- ✅ Comparison: max(), min()
157
- ✅ Advanced: pow(), sqrt(), random()
148
+ ### Expression Template System
158
149
 
159
- **Examples:**
150
+ The engine supports safe JavaScript expressions within `{{}}` templates:
151
+
152
+ ```javascript
153
+ // Simple variables
154
+ {{userName}}, {{account.balance}}
155
+
156
+ // Arithmetic
157
+ {{amount + fee}}, {{price * quantity}}
158
+
159
+ // Comparisons
160
+ {{age >= 18}}, {{status === 'active'}}
161
+
162
+ // Logical operations
163
+ {{isAdmin && hasAccess}}, {{retryCount < maxRetries}}
164
+
165
+ // Complex expressions
166
+ {{user.permissions.includes('admin') && creditScore > 700}}
167
+ ```
168
+
169
+ ### Safe Method Calls
170
+
171
+ **String Methods:**
160
172
  ```javascript
161
- // String processing
173
+ // Case conversion
162
174
  {{userInput.toLowerCase().trim()}}
175
+
176
+ // Email validation
163
177
  {{email.includes('@') && email.length > 5}}
178
+
179
+ // Text processing
164
180
  {{text.substring(0, 10).padEnd(15, '...')}}
181
+ ```
165
182
 
166
- // Array operations
183
+ **Array Methods:**
184
+ ```javascript
185
+ // Length and content checks
167
186
  {{items.length > 0 && items.includes('premium')}}
168
- {{categories.slice(0, 3).join(', ')}}
169
187
 
170
- // Mathematical operations
171
- {{Math.round(price * 1.08)}} // Tax calculation
172
- {{Math.max(balance, 0)}} // Ensure non-negative
188
+ // Array manipulation
189
+ {{categories.slice(0, 3).join(', ')}}
173
190
  ```
174
191
 
175
- SAFE FUNCTIONS:
176
- ✅ **Built-in Functions:** parseInt(), parseFloat(), isNaN(), isFinite()
177
- **Type Conversion:** String(), Number(), Boolean() (non-constructor forms)
178
- ✅ **URI Encoding:** encodeURIComponent(), decodeURIComponent(), encodeURI(), decodeURI()
179
- ✅ **User-Defined Functions:** Any functions registered in the APPROVED_FUNCTIONS registry
192
+ **Math Methods:**
193
+ ```javascript
194
+ // Tax calculation
195
+ {{Math.round(price * 1.08)}}
180
196
 
181
- **Examples:**
197
+ // Ensure non-negative
198
+ {{Math.max(balance, 0)}}
199
+ ```
200
+
201
+ **Safe Functions:**
182
202
  ```javascript
183
203
  // Type conversion and validation
184
204
  {{Number(input) > 0 && !isNaN(Number(input))}}
@@ -189,422 +209,51 @@ SAFE FUNCTIONS:
189
209
 
190
210
  // User-defined approved functions
191
211
  {{currentTime()}} // If registered as approved function
192
- {{extractCryptoFromInput(userMessage)}} // If registered as approved function to provide Custom business logic
212
+ {{extractCryptoFromInput(userMessage)}} // Custom business logic
193
213
  ```
194
214
 
195
- INTELLIGENT ERROR HANDLING:
196
- ✅ Smart Default OnFail - Context-aware error recovery
197
- ✅ Financial Operation Protection - Special handling for sensitive flows
198
- ✅ Network Error Recovery - Intelligent retry and messaging
199
- ✅ Graceful Degradation - Maintain user experience during failures
200
- ✅ Transaction Rollback - Proper cleanup on critical failures
201
-
202
- FLOW CONTROL COMMANDS:
203
- ✅ Universal Commands - Work in any flow context
204
- ✅ "cancel"/"abort" - Exit current flow
205
- ✅ "help" - Context-sensitive help messages
206
- ✅ "status" - Current flow state information
207
-
208
-
209
- INTENT INTERRUPTION SYSTEM:
210
- ✅ AI-Powered Intent Detection - Recognize new workflow requests (when `aiCallback` is provided)
211
- ✅ Fallback Flow Matching - If `aiCallback` is `null`, the engine will match the user input to a flow by id or name (case-insensitive), and if no exact match is found, will attempt a partial match. This allows demos and tests to run without requiring a real AI function.
212
- ✅ Three-Tier Intent Strength - Weak/Medium/Strong intent classification
213
- ✅ Financial Flow Protection - Require explicit confirmation
214
- ✅ Graceful Interruption - Preserve context while switching
215
- ✅ Smart Resume Logic - Automatic return to suspended flows
215
+ ## Demo/Test Mode: Flow Matching Without AI
216
216
 
217
- ---
218
-
219
- ## ⚡️ Demo/Test Mode: Flow Matching Without AI
220
-
221
- For demos, tests, or developer convenience, you can now set `aiCallback` to `null` when constructing the engine. In this mode, intent detection will:
217
+ For demos, tests, or developer convenience, you can set `aiCallback` to `null` when constructing the engine. In this mode, intent detection will:
222
218
 
223
219
  1. **Match by Flow Name or ID (case-insensitive):**
224
- - If the user input exactly matches a flow's `name` or `id`, that flow is activated.
220
+ - If the user input exactly matches a flow's `name` or `id`, that flow is activated.
225
221
  2. **Partial Match Fallback:**
226
- - If no exact match is found, the engine will look for a flow whose `name` or `id` contains the input (case-insensitive).
222
+ - If no exact match is found, the engine will look for a flow whose `name` or `id` contains the input (case-insensitive).
227
223
  3. **No Match:**
228
- - If no match is found, no flow is activated.
224
+ - If no match is found, no flow is activated.
229
225
 
230
226
  This makes it easy to run demos and tests without requiring a real AI intent detection function. In production, always provide a real `aiCallback` for robust intent detection.
231
227
 
232
- ========================================
233
- SECURITY & COMPLIANCE FEATURES
234
- ========================================
235
-
236
- EXPRESSION SECURITY:
237
- ✅ Safe Expression Evaluation - No eval(), no code injection, allowlist-based safe method calls
238
- ✅ Safe Method Allowlist - Only pre-approved string, array, and math methods allowed
239
- ✅ Safe Function Registry - Built-in safe functions + user-defined approved functions
240
- ✅ Pattern-Based Security - Block dangerous operations (constructors, eval, etc.)
241
- ✅ Variable Path Validation - Secure nested property access
242
- ✅ Input Sanitization - Clean and validate all user inputs
243
-
244
- TRANSACTION MANAGEMENT:
245
- ✅ Comprehensive Audit Trail - Every action logged
246
- ✅ Transaction State Tracking - Success/failure/pending states
247
- ✅ Error Recovery Logging - Detailed failure analysis
248
- ✅ User Context Isolation - Prevent cross-user data leaks
249
-
250
- RATE LIMITING & VALIDATION:
251
- ✅ Per-User Rate Limiting - Prevent abuse
252
- ✅ JSON Schema Validation - Type-safe parameter handling
253
- ✅ Input Size Limits - Prevent memory exhaustion
254
- ✅ Timeout Management - Prevent hanging operations
255
-
256
- ========================================
257
- INTEGRATION CAPABILITIES
258
- ========================================
259
-
260
- REST API SUPPORT:
261
- ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
262
- ✅ Content Types: JSON, Form-data, URL-encoded, XML/SOAP, Plain text, Multipart
263
- ✅ Authentication: Bearer tokens, Basic auth, API keys, HMAC signatures
264
- ✅ Parameter Handling: Path params, Query params, Request body, Headers
265
- ✅ Advanced Features: Retries with exponential backoff, Timeouts, Rate limiting
266
- ✅ Response Handling: JSON, XML, Text with automatic content-type detection
267
- ✅ DECLARATIVE RESPONSE MAPPING: Secure, generic transformation without code injection
268
- ✅ Error Handling: Status-based retry logic, Detailed error messages
269
- ✅ Security: Input sanitization, Credential management, Audit logging
270
-
271
- DECLARATIVE RESPONSE MAPPING SYSTEM:
272
- The engine supports completely generic response transformation through declarative
273
- JSON configuration, eliminating the need for users to inject code. This maintains
274
- complete engine security while supporting complex API response handling.
275
-
276
- MAPPING TYPES SUPPORTED:
277
-
278
- 1. JSONPATH MAPPING - Extract and transform specific fields:
279
- {
280
- responseMapping: {
281
- type: "jsonPath",
282
- mappings: {
283
- "output_field": {
284
- path: "api.response.field[0].value",
285
- transform: { type: "parseInt", fallback: 0 },
286
- fallback: "$args.inputField"
287
- }
288
- }
289
- }
290
- }
228
+ ## Security & Compliance
291
229
 
292
- 2. OBJECT MAPPING - Restructure response objects:
293
- {
294
- responseMapping: {
295
- type: "object",
296
- mappings: {
297
- "user_name": "name",
298
- "contact": {
299
- "email": "email",
300
- "phone": "phone"
301
- },
302
- "metadata": {
303
- "processed": true,
304
- "timestamp": "{{new Date().toISOString()}}"
305
- }
306
- }
307
- }
308
- }
230
+ ### Expression Security
231
+ - ✅ **Safe Expression Evaluation** - No eval(), no code injection
232
+ - ✅ **Safe Method Allowlist** - Only pre-approved methods allowed
233
+ - **Pattern-Based Security** - Block dangerous operations
234
+ - ✅ **Variable Path Validation** - Secure nested property access
309
235
 
310
- 3. ARRAY MAPPING - Filter and transform arrays:
311
- {
312
- responseMapping: {
313
- type: "array",
314
- source: "results",
315
- limit: 10,
316
- filter: { field: "status", operator: "equals", value: "active" },
317
- itemMapping: {
318
- type: "object",
319
- mappings: { "id": "id", "name": "name" }
320
- }
321
- }
322
- }
236
+ ### Transaction Management
237
+ - ✅ **Comprehensive Audit Trail** - Every action logged
238
+ - ✅ **Transaction State Tracking** - Success/failure/pending states
239
+ - ✅ **Error Recovery Logging** - Detailed failure analysis
240
+ - ✅ **User Context Isolation** - Prevent cross-user data leaks
323
241
 
324
- 4. TEMPLATE MAPPING - String interpolation:
325
- {
326
- responseMapping: {
327
- type: "template",
328
- template: "User {{name}} ({{email}}) from {$args.source}"
329
- }
330
- }
242
+ ## Integration Capabilities
331
243
 
332
- 5. CONDITIONAL MAPPING - Different mapping based on response structure:
333
- {
334
- responseMapping: {
335
- type: "conditional",
336
- conditions: [
337
- {
338
- if: { field: "status", operator: "equals", value: "success" },
339
- then: { type: "object", mappings: { "result": "data" } }
340
- }
341
- ],
342
- else: { type: "object", mappings: { "error": "message" } }
343
- }
344
- }
244
+ ### REST API Support
245
+ - ✅ **HTTP Methods:** GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
246
+ - ✅ **Content Types:** JSON, Form-data, URL-encoded, XML/SOAP, Plain text, Multipart
247
+ - ✅ **Authentication:** Bearer tokens, Basic auth, API keys, HMAC signatures
248
+ - ✅ **Parameter Handling:** Path params, Query params, Request body, Headers
249
+ - ✅ **Advanced Features:** Retries with exponential backoff, Timeouts, Rate limiting
345
250
 
346
- VALUE TRANSFORMATIONS SUPPORTED:
347
- - parseInt, parseFloat: Number conversion
348
- - toLowerCase, toUpperCase, trim: String manipulation
349
- - replace: Regex replacement
350
- - concat: Add prefix/suffix
351
- - regex: Extract with regex groups
352
- - date: Convert to ISO date string
353
- - default: Fallback values
354
-
355
- SECURITY & BEST PRACTICES:
356
- - No code injection possible - all transformations are declarative
357
- - Secure path traversal with validation
358
- - Fallback handling for missing data
359
- - Type coercion with validation
360
- - Error handling with graceful degradation
361
-
362
- ========================================
363
- IMPLEMENTATION NOTES & BEST PRACTICES
364
- ========================================
365
-
366
- PROPER USAGE PATTERNS:
367
- 1. Always use helper functions for stack operations
368
- 2. Never directly access flowStacks arrays
369
- 3. Maintain transaction state consistency
370
- 4. Use proper error handling with smart defaults
371
- 5. Implement comprehensive logging for debugging
372
-
373
- ========================================
374
- 🚀 ENHANCED TRANSFORMATION CAPABILITIES
375
- ========================================
376
-
377
- The JavaScript Flow Engine now includes a comprehensive suite of mathematical, temporal,
378
- and template processing enhancements that enable sophisticated data transformations
379
- without code injection risks.
380
-
381
- MATHEMATICAL OPERATIONS:
382
- ✅ `add` - Addition with precision control: `{ type: "add", addend: 10, precision: 2 }`
383
- ✅ `subtract` - Subtraction with precision control: `{ type: "subtract", subtrahend: 5, precision: 2 }`
384
- ✅ `multiply` - Multiplication: `{ type: "multiply", multiplier: 1.08, precision: 2 }`
385
- ✅ `divide` - Division with zero protection: `{ type: "divide", divisor: 100, precision: 2 }`
386
- ✅ `percentage` - Percentage calculation: `{ type: "percentage", divisor: 1000, precision: 1 }`
387
- ✅ `abs`, `round`, `floor`, `ceil` - Mathematical functions
388
-
389
- DATE-BASED CALCULATIONS:
390
- ✅ `currentYear` - Get current year: `{ type: "currentYear" }`
391
- ✅ `yearDifference` - Calculate age/duration: `{ type: "yearDifference" }` (current year - value)
392
- ✅ Dynamic age calculations, time-based transformations
393
-
394
- ARRAY AGGREGATIONS:
395
- ✅ `sum` - Sum array values: `{ type: "sum", field: "budget" }` (for object arrays)
396
- ✅ `average` - Calculate mean: `{ type: "average", field: "employees", precision: 1 }`
397
- ✅ `count` - Count non-null values: `{ type: "count", field: "active" }`
398
- ✅ `min` - Find minimum: `{ type: "min", field: "price" }`
399
- ✅ `max` - Find maximum: `{ type: "max", field: "score" }`
400
-
401
- ENHANCED TEMPLATE SYSTEM:
402
- ✅ **Array Length Access**: `{{array.length}}` automatically supported
403
- ✅ **Handlebars-Style Iteration**: `{{#each items}}...{{/each}}` with full nesting
404
- ✅ **Context Variables**: `{{@index}}` (current index), `{{@last}}` (is last item)
405
- ✅ **Conditional Rendering**: `{{#unless @last}}separator{{/unless}}`
406
- ✅ **Nested Property Access**: `{{item.nested.property}}`
407
-
408
- REAL-WORLD EXAMPLES:
409
-
410
- **Age Calculation:**
411
- ```json
412
- {
413
- "path": "user.birthYear",
414
- "transform": { "type": "yearDifference" }
415
- }
416
- ```
417
- Input: `2015` → Output: `10` (automatically calculated as 2025 - 2015)
418
-
419
- **Financial Aggregations:**
420
- ```json
421
- {
422
- "path": "departments",
423
- "transform": {
424
- "type": "sum",
425
- "field": "budget",
426
- "precision": 0
427
- }
428
- }
429
- ```
430
- Input: `[{budget: 8500000}, {budget: 3200000}]` → Output: `11700000`
251
+ ### Declarative Response Mapping
431
252
 
432
- **Complex Template with Arrays:**
433
- ```json
434
- {
435
- "type": "template",
436
- "template": "Operating in {{locations.length}} locations: {{#each locations}}{{city}}, {{country}} ({{employees}} employees){{#unless @last}}; {{/unless}}{{/each}}"
437
- }
438
- ```
439
- Input: Array of locations → Output: `"Operating in 3 locations: San Francisco, USA (150 employees); London, UK (60 employees); Toronto, Canada (40 employees)"`
253
+ The engine supports completely generic response transformation through declarative JSON configuration:
440
254
 
441
- **Percentage Calculations:**
442
- ```json
443
- {
444
- "path": "completedProjects",
445
- "transform": {
446
- "type": "percentage",
447
- "divisor": "{{totalProjects}}",
448
- "precision": 1
449
- }
450
- }
451
- ```
452
- Input: `19` completed, `30` total → Output: `63.3` (percentage)
453
-
454
- CONTRIBUTORS: Areas for Future Enhancement
455
- ✅ **Current Coverage**: Mathematical, temporal, aggregation, template processing
456
- ⚠️ **Missing Operations**: Trigonometric functions (sin, cos, tan)
457
- ⚠️ **Missing Date Functions**: Date formatting, timezone conversions, date arithmetic
458
- ⚠️ **Missing String Functions**: Advanced regex operations, locale-specific formatting
459
- ⚠️ **Missing Array Functions**: Complex filtering, sorting, grouping operations
460
- ⚠️ **Missing Template Features**: Nested loops, advanced conditionals, custom helpers
461
-
462
- ========================================
463
- 📋 COMPREHENSIVE FEATURE MATRIX FOR CONTRIBUTORS
464
- ========================================
465
-
466
- This section provides a complete overview of implemented features and identifies
467
- areas where contributors can add value. All features maintain the engine's security
468
- model (no code injection, declarative-only transformations).
469
-
470
- FLOW EXECUTION ENGINE:
471
- ✅ **Stack-of-stacks architecture** - Complete with interruption/resumption
472
- ✅ **Flow frame management** - Variables, context, transaction tracking
473
- ✅ **Step types** - SAY, SAY-GET, SET, CALL-TOOL, FLOW, SWITCH
474
- ✅ **Expression evaluation** - Safe JavaScript expressions with allowlist
475
- ✅ **Error handling** - Smart defaults, financial protection, graceful degradation
476
- ✅ **Intent detection** - AI-powered + fallback flow matching
477
- ✅ **Universal commands** - help, status, cancel, exit
478
-
479
- TRANSFORMATION SYSTEM:
480
- ✅ **Basic types** - parseInt, parseFloat, toLowerCase, toUpperCase, trim
481
- ✅ **String operations** - replace, concat, regex, substring, split, join
482
- ✅ **Mathematical** - add, subtract, multiply, divide, percentage, abs, round, floor, ceil
483
- ✅ **Date/Time** - currentYear, yearDifference, ISO date conversion
484
- ✅ **Array aggregations** - sum, average, count, min, max (with field targeting)
485
- ✅ **Conditional logic** - Multi-branch conditions with operators
486
- ✅ **Template processing** - Simple placeholders + Handlebars-style iteration
487
- ✅ **Default/fallback** - Robust null handling
488
-
489
- RESPONSE MAPPING SYSTEM:
490
- ✅ **JSONPath mapping** - Deep object extraction with transformations
491
- ✅ **Object mapping** - Restructuring and field remapping
492
- ✅ **Array mapping** - Filtering, limiting, item transformation
493
- ✅ **Template mapping** - String interpolation with complex iteration
494
- ✅ **Conditional mapping** - Response-structure-based branching
495
-
496
- REST API INTEGRATION:
497
- ✅ **HTTP methods** - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
498
- ✅ **Content types** - JSON, form-data, URL-encoded, XML/SOAP, text, multipart
499
- ✅ **Authentication** - Bearer, Basic, API keys, HMAC signatures
500
- ✅ **Parameters** - Path params, query params, body, headers
501
- ✅ **Advanced features** - Retries, timeouts, rate limiting
502
- ✅ **Response handling** - Auto content-type detection, declarative mapping
503
-
504
- SECURITY & COMPLIANCE:
505
- ✅ **Expression security** - Safe evaluation, method allowlist, no eval()
506
- ✅ **Transaction management** - Audit trails, state tracking, recovery
507
- ✅ **Rate limiting** - Per-user controls, abuse prevention
508
- ✅ **Input validation** - JSON Schema, size limits, sanitization
509
- ✅ **Credential management** - Secure token handling, audit logging
510
-
511
- AREAS FOR CONTRIBUTOR ENHANCEMENT (very liberal AI based 🫣 ):
512
-
513
- 🔢 **MATHEMATICAL EXTENSIONS:**
514
- ⚠️ Trigonometric functions (sin, cos, tan, asin, acos, atan)
515
- ⚠️ Logarithmic functions (log, log10, ln)
516
- ⚠️ Statistical functions (median, mode, standard deviation)
517
- ⚠️ Financial functions (compound interest, NPV, IRR)
518
-
519
- 📅 **DATE/TIME ENHANCEMENTS:**
520
- ⚠️ Date formatting with locale support (MM/DD/YYYY, DD-MM-YYYY)
521
- ⚠️ Timezone conversions and handling
522
- ⚠️ Date arithmetic (add days, subtract months, etc.)
523
- ⚠️ Relative date calculations (next Monday, last quarter)
524
- ⚠️ Duration calculations (time between dates)
525
-
526
- 🔤 **STRING PROCESSING EXPANSIONS:**
527
- ⚠️ Advanced regex operations (lookahead, lookbehind)
528
- ⚠️ Locale-specific formatting (currency, numbers)
529
- ⚠️ String similarity and distance algorithms
530
- ⚠️ Text normalization and cleaning utilities
531
- ⚠️ Encoding/decoding beyond URI (Base64, hex)
532
-
533
- 🔗 **ARRAY OPERATION ENHANCEMENTS:**
534
- ⚠️ Complex filtering with multiple conditions
535
- ⚠️ Sorting with custom comparators
536
- ⚠️ Grouping and partitioning operations
537
- ⚠️ Set operations (union, intersection, difference)
538
- ⚠️ Array flattening and nested operations
539
-
540
- 🎨 **TEMPLATE SYSTEM EXTENSIONS:**
541
- ⚠️ Nested loop support (each within each)
542
- ⚠️ Advanced conditionals (if/else if/else blocks)
543
- ⚠️ Custom helper functions (user-defined template functions)
544
- ⚠️ Template caching and optimization
545
- ⚠️ Internationalization and localization support
546
-
547
- 🔧 **INTEGRATION CAPABILITIES:**
548
- ⚠️ Database connectivity (with secure query building)
549
- ⚠️ File system operations (secure read/write)
550
- ⚠️ Message queue integration (Kafka, RabbitMQ, SQS)
551
- ⚠️ Real-time capabilities (WebSocket, Server-Sent Events)
552
- ⚠️ Monitoring and metrics collection
553
-
554
- ⚡ **PERFORMANCE OPTIMIZATIONS:**
555
- ⚠️ Expression caching and compilation
556
- ⚠️ Lazy evaluation for expensive operations
557
- ⚠️ Memory usage optimization for large datasets
558
- ⚠️ Parallel processing for independent operations
559
- ⚠️ Streaming processing for large arrays
560
-
561
- IMPLEMENTATION GUIDELINES FOR CONTRIBUTORS:
562
- 1. **Security First**: All new features must maintain no-code-injection principle
563
- 2. **Declarative Design**: Use JSON configuration, not executable code
564
- 3. **Error Handling**: Implement comprehensive fallbacks and validation
565
- 4. **Testing**: Add to the 40+ test comprehensive test suite
566
- 5. **Documentation**: Update both README.md and User Guide
567
- 6. **Type Safety**: Maintain TypeScript compliance with proper interfaces
568
- 7. **Performance**: Consider memory and computational impact
569
-
570
- CURRENT TEST COVERAGE:
571
- ✅ **40 Comprehensive Test Scenarios** - 100% pass rate validated
572
- ✅ **Flow execution patterns** - Linear, nested, interrupted, resumed
573
- ✅ **Mathematical transformations** - All operations with edge cases
574
- ✅ **Template processing** - Simple and complex Handlebars-style
575
- ✅ **API integrations** - HTTP methods, auth, error handling
576
- ✅ **Error scenarios** - Network failures, invalid data, timeouts
577
- ✅ **Security validation** - Expression safety, input sanitization
578
-
579
- ========================================
580
-
581
- - OpenAI Function Calling Standard schemas
582
- - JSON Schema validation with ajv
583
- - Secure function registry
584
- - Comprehensive error handling & transaction management
585
- - Audit logging for compliance
586
- - Rate limiting and input validation
587
- - COMPREHENSIVE REST API SUPPORT with all common conventions:
588
-
589
- REST API FEATURES SUPPORTED:
590
- ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
591
- ✅ Content Types: JSON, Form-data, URL-encoded, XML/SOAP, Plain text, Multipart
592
- ✅ Authentication: Bearer tokens, Basic auth, API keys, HMAC signatures
593
- ✅ Parameter Handling: Path params, Query params, Request body, Headers
594
- ✅ Advanced Features: Retries with exponential backoff, Timeouts, Rate limiting
595
- ✅ Response Handling: JSON, XML, Text with automatic content-type detection
596
- ✅ DECLARATIVE RESPONSE MAPPING: Secure, generic transformation without code injection
597
- ✅ Error Handling: Status-based retry logic, Detailed error messages
598
- ✅ Security: Input sanitization, Credential management, Audit logging
599
-
600
- DECLARATIVE RESPONSE MAPPING SYSTEM:
601
- The engine now supports completely generic response transformation through declarative
602
- JSON configuration, eliminating the need for users to inject code. This maintains
603
- complete engine security while supporting complex API response handling.
604
-
605
- MAPPING TYPES SUPPORTED:
606
-
607
- 1. JSONPATH MAPPING - Extract and transform specific fields:
255
+ #### JSONPath Mapping
256
+ ```javascript
608
257
  {
609
258
  responseMapping: {
610
259
  type: "jsonPath",
@@ -617,8 +266,10 @@ MAPPING TYPES SUPPORTED:
617
266
  }
618
267
  }
619
268
  }
269
+ ```
620
270
 
621
- 2. OBJECT MAPPING - Restructure response objects:
271
+ #### Object Mapping
272
+ ```javascript
622
273
  {
623
274
  responseMapping: {
624
275
  type: "object",
@@ -635,62 +286,47 @@ MAPPING TYPES SUPPORTED:
635
286
  }
636
287
  }
637
288
  }
289
+ ```
638
290
 
639
- 3. ARRAY MAPPING - Filter and transform arrays:
640
- {
641
- responseMapping: {
642
- type: "array",
643
- source: "results",
644
- limit: 10,
645
- filter: { field: "status", operator: "equals", value: "active" },
646
- itemMapping: {
647
- type: "object",
648
- mappings: { "id": "id", "name": "name" }
649
- }
650
- }
651
- }
652
-
653
- 4. TEMPLATE MAPPING - String interpolation:
291
+ #### Template Mapping
292
+ ```javascript
654
293
  {
655
294
  responseMapping: {
656
295
  type: "template",
657
- template: "User {{name}} ({{email}}) from {$args.source}"
296
+ template: "User {{name}} ({{email}}) from {{$args.source}}"
658
297
  }
659
298
  }
299
+ ```
660
300
 
661
- 5. CONDITIONAL MAPPING - Different mapping based on response structure:
662
- {
663
- responseMapping: {
664
- type: "conditional",
665
- conditions: [
666
- {
667
- if: { field: "status", operator: "equals", value: "success" },
668
- then: { type: "object", mappings: { "result": "data" } }
669
- }
670
- ],
671
- else: { type: "object", mappings: { "error": "message" } }
672
- }
673
- }
301
+ ## Core Features
302
+
303
+ - **OpenAI Function Calling Standard** schemas
304
+ - **JSON Schema validation** with ajv
305
+ - **Secure function registry**
306
+ - **Comprehensive error handling** & transaction management
307
+ - **Audit logging** for compliance
308
+ - **Rate limiting** and input validation
309
+
310
+ ## Value Transformations
674
311
 
675
- VALUE TRANSFORMATIONS SUPPORTED:
676
- - parseInt, parseFloat: Number conversion
677
- - toLowerCase, toUpperCase, trim: String manipulation
678
- - replace: Regex replacement
679
- - concat: Add prefix/suffix
680
- - regex: Extract with regex groups
681
- - date: Convert to ISO date string
682
- - default: Fallback values
683
-
684
- SECURITY & BEST PRACTICES:
685
- - No code injection possible - all transformations are declarative
686
- - Secure path traversal with validation
687
- - Fallback handling for missing data
688
- - Type coercion with validation
689
- - Error handling with graceful degradation
690
-
691
- EXAMPLE TOOL CONFIGURATIONS:
692
-
693
- 1. SIMPLE GET REQUEST:
312
+ ### Supported Transforms
313
+ - **Number conversion:** parseInt, parseFloat
314
+ - **String manipulation:** toLowerCase, toUpperCase, trim
315
+ - **Text processing:** replace (regex), concat (prefix/suffix)
316
+ - **Date handling:** Convert to ISO date string
317
+ - **Fallback values:** Default handling for missing data
318
+
319
+ ### Security & Best Practices
320
+ - ✅ No code injection possible - all transformations are declarative
321
+ - Secure path traversal with validation
322
+ - Fallback handling for missing data
323
+ - Type coercion with validation
324
+ - Error handling with graceful degradation
325
+
326
+ ## Example Tool Configurations
327
+
328
+ ### Simple GET Request
329
+ ```javascript
694
330
  {
695
331
  implementation: {
696
332
  type: "http",
@@ -698,8 +334,10 @@ EXAMPLE TOOL CONFIGURATIONS:
698
334
  method: "GET"
699
335
  }
700
336
  }
337
+ ```
701
338
 
702
- 2. AUTHENTICATED POST WITH JSON:
339
+ ### Authenticated POST with JSON
340
+ ```javascript
703
341
  {
704
342
  implementation: {
705
343
  type: "http",
@@ -709,8 +347,10 @@ EXAMPLE TOOL CONFIGURATIONS:
709
347
  },
710
348
  apiKey: "your-bearer-token"
711
349
  }
350
+ ```
712
351
 
713
- 3. PATH PARAMETERS WITH RESPONSE MAPPING:
352
+ ### Path Parameters with Response Mapping
353
+ ```javascript
714
354
  {
715
355
  implementation: {
716
356
  type: "http",
@@ -727,57 +367,4 @@ EXAMPLE TOOL CONFIGURATIONS:
727
367
  }
728
368
  }
729
369
  }
730
-
731
- 4. COMPLEX API WITH ARRAY PROCESSING:
732
- {
733
- implementation: {
734
- type: "http",
735
- url: "https://api.example.com/search",
736
- method: "GET",
737
- responseMapping: {
738
- type: "array",
739
- source: "results",
740
- limit: 5,
741
- filter: { field: "active", operator: "equals", value: true },
742
- itemMapping: {
743
- type: "object",
744
- mappings: {
745
- "id": "id",
746
- "title": "name",
747
- "snippet": {
748
- path: "description",
749
- transform: { type: "regex", pattern: "^(.{100})", group: 1 }
750
- }
751
- }
752
- }
753
- }
754
- }
755
- }
756
-
757
- 5. WEATHER API WITH DECLARATIVE MAPPING:
758
- {
759
- implementation: {
760
- type: "http",
761
- url: "https://wttr.in/{city}",
762
- pathParams: ["city"],
763
- customQuery: "format=j1",
764
- responseMapping: {
765
- type: "jsonPath",
766
- mappings: {
767
- "location.name": {
768
- path: "nearest_area[0].areaName[0].value",
769
- fallback: "$args.city"
770
- },
771
- "current.temp_c": {
772
- path: "current_condition[0].temp_C",
773
- transform: { type: "parseInt", fallback: 0 }
774
- },
775
- "current.condition": {
776
- path: "current_condition[0].weatherDesc[0].value",
777
- fallback: "Unknown"
778
- }
779
- }
780
- }
781
- }
782
- }
783
- */
370
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAoDH;;;;GAIG;AACH,wBAAgB,UAAU,CA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,sBAAsB;IA2D9B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA+B9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoDzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmCxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmBxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAwC3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA4CzB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAmC7B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA6B5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmChC;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,GAAE,GAAQ,GAAG,GAAG;IA6GxC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA+C5B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA2BhC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAiC9B;;OAEG;IACH,OAAO,CAAC,2BAA2B;IA0FnC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA6BhC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,2BAA2B;CAKrC"}
package/dist/index.js CHANGED
@@ -17,48 +17,132 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
17
17
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
18
  **/
19
19
  /**
20
- * Flows Engine for any conversational platform
21
- * ============================================
20
+ * JavaScript Flow Engine for Conversational Platforms
21
+ * ==================================================
22
22
  *
23
23
  * Overview:
24
24
  * ---------
25
- * This module implements a robust, extensible, and secure workflow orchestration engine
26
- * for conversational and automation platforms. It is designed to power production-grade,
27
- * multi-flow, multi-step user journeys with advanced interruption, resumption, and tool
28
- * integration capabilities.
25
+ * The JavaScript Flow Engine is a sophisticated, host-agnostic workflow orchestration system
26
+ * designed to serve as a pluggable intent detector and workflows orchestrator for any
27
+ * conversational platform. Whether integrated with AI chat assistants, live agent systems,
28
+ * customer service platforms, or any other conversational interface, the engine provides
29
+ * reliable, secure, and intelligent workflow automation.
29
30
  *
30
31
  * Key Features:
31
32
  * -------------
32
- * - Stack-of-stacks model for flow frames, enabling nested flows, interruptions, and resumptions.
33
- * - Modular step handlers for SAY, SAY-GET, SET, SWITCH, TOOL, and SUBFLOW steps.
34
- * - Secure, pattern-based expression evaluation for variable interpolation and flow logic.
35
- * - AI-powered intent detection, argument extraction, and flow activation, with robust fallbacks.
36
- * - Universal flow control commands (help, status, cancel, exit) available at any point in a flow.
37
- * - Comprehensive error handling, logging, and audit support for production reliability.
38
- * - Flexible tool integration: supports local functions, HTTP APIs, and mock/test tools withvalidation and authentication.
39
- * - Metadata-driven flow definitions (risk, auth, category) for security and analytics.
33
+ * - Advanced response mapping with 25+ transform types including mathematical operations,
34
+ * statistical aggregations, date/time processing, and Handlebars-style templates
35
+ * - Stack-of-stacks architecture for flow frames, enabling nested flows, interruptions, and resumptions
36
+ * - Comprehensive step handlers: SAY, SAY-GET, SET, SWITCH, CASE, CALL-TOOL, and CALL-FLOW
37
+ * - Secure, pattern-based expression evaluation for variable interpolation and flow logic
38
+ * - AI-powered intent detection, argument extraction, and flow activation with robust fallbacks
39
+ * - Universal flow control commands (help, status, cancel, exit) available at any point in a flow
40
+ * - Enterprise-grade error handling, logging, and audit support for production reliability
41
+ * - Flexible tool integration: HTTP APIs, local functions, and mock/test tools with validation
42
+ * - Comprehensive internationalization (i18n) support with language-specific properties
43
+ * - Metadata-driven flow definitions (risk, auth, category) for security and analytics
44
+ *
45
+ * Enhanced Transformation System:
46
+ * ------------------------------
47
+ * - Mathematical Operations: add, subtract, multiply, divide, percentage, abs, round, floor, ceil
48
+ * - Statistical Functions: sum, average, count, min, max for array aggregations
49
+ * - Date/Time Processing: currentYear, yearDifference for dynamic temporal calculations
50
+ * - Advanced Templates: Handlebars-style iteration with {{#each}}, @index, @last context
51
+ * - Enhanced Path Resolution: Support for array.length and complex object navigation
40
52
  *
41
53
  * Security Model:
42
54
  * --------------
43
- * - All user-supplied expressions are evaluated with strict pattern checks to prevent code injection or unsafe operations.
44
- * - No arbitrary code execution is allowed in variable interpolation or flow logic.
45
- * - Tool calls support secure authentication (Bearer, Basic, HMAC/hash) and header management.
55
+ * - All user-supplied expressions are evaluated with strict pattern checks to prevent code injection
56
+ * - No arbitrary code execution is allowed in variable interpolation or flow logic
57
+ * - Tool calls support secure authentication (Bearer, Basic, API Key) and header management
58
+ * - Comprehensive input validation with JSON Schema for all tool parameters
46
59
  *
47
60
  * Usage:
48
61
  * ------
49
- * - Instantiate the WorkflowEngine with a flows menu, tools registry, and approved local functions.
50
- * - Use `updateActivity(contextEntry, userId)` to share user input before your processing and assistant responses after processing.
51
- * - For user inputs: contextEntry.role = 'user' - analyzed and optionally triggers full flow logic
52
- * - For assistant responses: contextEntry.role = 'assistant' - adds to context stack only
53
- * - Extend with new step handlers or tool integrations as needed for your platform.
62
+ * ```javascript
63
+ * // 1. Create the engine
64
+ * const engine = new WorkflowEngine(
65
+ * hostLogger, // Your logging instance
66
+ * aiCallback, // Your AI communication function
67
+ * flowsMenu, // Array of flow definitions
68
+ * toolsRegistry, // Array of tool definitions
69
+ * APPROVED_FUNCTIONS, // Pre-approved local functions
70
+ * globalVariables, // Optional: Session-wide variables
71
+ * validateOnInit, // Optional: Enable pre-flight validation (default: true)
72
+ * language, // Optional: User's preferred language
73
+ * messageRegistry, // Optional: Custom message templates
74
+ * guidanceConfig // Optional: User assistance configuration
75
+ * );
76
+ *
77
+ * // 2. Initialize a session for each user
78
+ * const sessionContext = engine.initSession(yourLogger, 'user-123', 'session-456');
79
+ *
80
+ * // 3. Process user input and assistant responses
81
+ * const result = await engine.updateActivity(contextEntry, sessionContext);
82
+ * ```
83
+ *
84
+ * Session Management:
85
+ * ------------------
86
+ * - Each user requires a unique session context via `initSession(logger, userId, sessionId)`
87
+ * - The `EngineSessionContext` object should be persisted by your application
88
+ * - Pass the same session context to `updateActivity` for conversation continuity
89
+ *
90
+ * Context Entry Types:
91
+ * -------------------
92
+ * - User input: contextEntry.role = 'user' - analyzed and may trigger flow execution
93
+ * - Assistant response: contextEntry.role = 'assistant' - added to context for awareness
94
+ *
95
+ * ContextEntry Structure:
96
+ * ----------------------
97
+ * ```typescript
98
+ * interface ContextEntry {
99
+ * role: 'user' | 'assistant' | 'system' | 'tool'; // Message role type
100
+ * content: string | Record<string, unknown>; // Message content (text, object, etc.)
101
+ * timestamp: number; // Unix timestamp in milliseconds
102
+ * stepId?: string; // Optional: Associated flow step ID
103
+ * toolName?: string; // Optional: Tool name for tool messages
104
+ * metadata?: Record<string, unknown>; // Optional: Additional context data
105
+ * }
106
+ * ```
54
107
  *
55
- * Maintenance:
56
- * ------------
57
- * - Review and update security patterns regularly.
58
- * - Ensure comprehensive test coverage for all step handlers and flow control logic.
59
- * - Monitor logs and audit trails for production issues and user behavior analytics.
108
+ * Example Usage:
109
+ * ```javascript
110
+ * // User message
111
+ * const userEntry = {
112
+ * role: 'user',
113
+ * content: 'I need help with my account',
114
+ * timestamp: Date.now()
115
+ * };
116
+ * // Process the message
117
+ * await engine.updateActivity(userEntry, sessionContext);
118
+ *
119
+ *
120
+ * // Assistant response
121
+ * const assistantEntry = {
122
+ * role: 'assistant',
123
+ * content: 'I can help you with your account. What specific issue are you experiencing?',
124
+ * timestamp: Date.now(),
125
+ * stepId: 'greeting-step'
126
+ * };
127
+ * // Process the message
128
+ * await engine.updateActivity(assistantEntry, sessionContext);
129
+ * ```
130
+ *
131
+ * Production Deployment:
132
+ * ---------------------
133
+ * - Comprehensive test coverage with 40+ validation scenarios
134
+ * - Built-in monitoring and metrics collection
135
+ * - Containerization support with Docker and Kubernetes
136
+ * - Horizontal scaling capabilities
137
+ * - Enterprise security and compliance features
138
+ *
139
+ * Documentation:
140
+ * --------------
141
+ * - Complete User Guide: JavaScript Flow Engine.md
142
+ * - API Reference: README.md
143
+ * - Examples: Comprehensive test scenarios and real-world implementations
60
144
  *
61
- * Author: instantAIguru.com Team
145
+ * Author: InstantAIGuru.com Team
62
146
  * Last updated: August 2025
63
147
  **/
64
148
  import * as crypto from "crypto";
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript workflow engine for conversational/automation apps: multi-flow orchestration, interrupt/resume, stack-based control, robust errors, and flexible tool/REST integration.",
5
5
  "license": "MIT",
6
6
  "author": "Ron Pinkas",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/ronpinkas/jsfe.git"
9
+ "url": "git+https://github.com/ronpinkas/jsfe.git"
10
10
  },
11
11
  "type": "module",
12
12
  "sideEffects": false,
@@ -46,5 +46,9 @@
46
46
  "ajv": "^8.17.1",
47
47
  "ajv-formats": "^3.0.1",
48
48
  "winston": "^3.17.0"
49
+ },
50
+ "homepage": "https://github.com/ronpinkas/jsfe#readme",
51
+ "bugs": {
52
+ "url": "https://github.com/ronpinkas/jsfe/issues"
49
53
  }
50
54
  }