@runflow-ai/cli 0.2.6 โ 0.2.7
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/package.json +3 -1
- package/scenarios/README.md +71 -0
- package/scenarios/memory-conversation.json +23 -0
- package/scenarios/test-messages-array.json +19 -0
- package/scenarios/test-metadata-custom.json +22 -0
- package/scenarios/webhook-hubspot-contact.json +40 -0
- package/scenarios/webhook-meta-messenger.json +33 -0
- package/scenarios/webhook-shopify.json +24 -0
- package/scenarios/webhook-slack-message.json +21 -0
- package/scenarios/webhook-stripe.json +22 -0
- package/scenarios/webhook-twilio-sms.json +21 -0
- package/scenarios/webhook-twilio-whatsapp.json +22 -0
- package/scenarios/webhook-zendesk-ticket.json +25 -0
- package/static/README.md +221 -0
- package/static/app.js +1381 -0
- package/static/frontend-server-template.js +24 -0
- package/static/index.html +340 -0
- package/static/runflow-logo.png +0 -0
- package/static/style.css +1354 -0
- package/static/test-server-template.js +561 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runflow-ai/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Official CLI for RunFlow AI platform - manage agents, deploy code, and interact with AI workflows from your terminal",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,6 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
52
|
"dist/**/*",
|
|
53
|
+
"static/**/*",
|
|
54
|
+
"scenarios/**/*",
|
|
53
55
|
"README.md",
|
|
54
56
|
"CLI-DOCS.md"
|
|
55
57
|
],
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# ๐งช Test Scenarios
|
|
2
|
+
|
|
3
|
+
Default test scenarios for Runflow CLI test interface.
|
|
4
|
+
|
|
5
|
+
## ๐ Structure
|
|
6
|
+
|
|
7
|
+
Each scenario is a JSON file with:
|
|
8
|
+
- **name**: Display name
|
|
9
|
+
- **description**: What this scenario tests
|
|
10
|
+
- **category**: Group (E-commerce, Payments, Testing, etc.)
|
|
11
|
+
- **variables**: Customizable values
|
|
12
|
+
- **payload**: The actual JSON sent to your agent
|
|
13
|
+
|
|
14
|
+
## ๐ฏ How It Works
|
|
15
|
+
|
|
16
|
+
### CLI Default Scenarios
|
|
17
|
+
Located in `core/runflow-cli/scenarios/`:
|
|
18
|
+
- Always available
|
|
19
|
+
- Provided by Runflow
|
|
20
|
+
- Cover common integrations
|
|
21
|
+
|
|
22
|
+
### Project Custom Scenarios
|
|
23
|
+
Located in your project `test-scenarios/`:
|
|
24
|
+
- Project-specific
|
|
25
|
+
- Custom webhooks
|
|
26
|
+
- Your own test cases
|
|
27
|
+
|
|
28
|
+
## ๐ Creating Custom Scenarios
|
|
29
|
+
|
|
30
|
+
In your project root, create `test-scenarios/my-scenario.json`:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"name": "My Custom Webhook",
|
|
35
|
+
"description": "Tests my specific integration",
|
|
36
|
+
"category": "Custom",
|
|
37
|
+
"variables": {
|
|
38
|
+
"userId": "user-123",
|
|
39
|
+
"action": "signup"
|
|
40
|
+
},
|
|
41
|
+
"payload": {
|
|
42
|
+
"event": "{{action}}",
|
|
43
|
+
"user": {
|
|
44
|
+
"id": "{{userId}}"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## ๐ง Variable Interpolation
|
|
51
|
+
|
|
52
|
+
Use `{{variableName}}` in payload:
|
|
53
|
+
- String values: `"{{userName}}"` โ `"John"`
|
|
54
|
+
- Numeric values: `{{amount}}` โ `99.99`
|
|
55
|
+
- Nested objects: Supported
|
|
56
|
+
|
|
57
|
+
## ๐ Using in Test Interface
|
|
58
|
+
|
|
59
|
+
1. Run `rf test`
|
|
60
|
+
2. Select "Custom JSON payload" mode
|
|
61
|
+
3. Choose scenario from dropdown
|
|
62
|
+
4. Edit variables if needed
|
|
63
|
+
5. Send test
|
|
64
|
+
|
|
65
|
+
## ๐ Examples Included
|
|
66
|
+
|
|
67
|
+
- `webhook-shopify.json` - E-commerce webhooks
|
|
68
|
+
- `webhook-stripe.json` - Payment webhooks
|
|
69
|
+
- `memory-conversation.json` - Memory testing with messages[]
|
|
70
|
+
|
|
71
|
+
Create your own in `test-scenarios/` directory!
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Memory - Conversation Test",
|
|
3
|
+
"description": "Test conversation memory with context",
|
|
4
|
+
"category": "Testing",
|
|
5
|
+
"variables": {
|
|
6
|
+
"userName": "Joรฃo",
|
|
7
|
+
"userRole": "developer"
|
|
8
|
+
},
|
|
9
|
+
"payload": {
|
|
10
|
+
"message": "What's my name and role?",
|
|
11
|
+
"messages": [
|
|
12
|
+
{
|
|
13
|
+
"role": "user",
|
|
14
|
+
"content": "My name is {{userName}} and I work as a {{userRole}}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"role": "assistant",
|
|
18
|
+
"content": "Hello {{userName}}! Nice to meet a {{userRole}}!"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"sessionId": "memory-test-session"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Messages Array Test",
|
|
3
|
+
"description": "Test with conversation history using messages[]",
|
|
4
|
+
"category": "Testing",
|
|
5
|
+
"variables": {
|
|
6
|
+
"userName": "Alice",
|
|
7
|
+
"userQuestion": "What did I tell you about myself?"
|
|
8
|
+
},
|
|
9
|
+
"payload": {
|
|
10
|
+
"message": "{{userQuestion}}",
|
|
11
|
+
"messages": [
|
|
12
|
+
{"role": "user", "content": "Hi! My name is {{userName}} and I love coding."},
|
|
13
|
+
{"role": "assistant", "content": "Hello {{userName}}! That's great that you enjoy coding!"},
|
|
14
|
+
{"role": "user", "content": "I also work with Python and TypeScript."},
|
|
15
|
+
{"role": "assistant", "content": "Nice! Python and TypeScript are excellent choices."}
|
|
16
|
+
],
|
|
17
|
+
"sessionId": "messages-test-session"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Custom Metadata Test",
|
|
3
|
+
"description": "Test with custom metadata fields",
|
|
4
|
+
"category": "Testing",
|
|
5
|
+
"variables": {
|
|
6
|
+
"userId": "user-12345",
|
|
7
|
+
"companyId": "company-67890",
|
|
8
|
+
"priority": "high",
|
|
9
|
+
"tags": "urgent,sales"
|
|
10
|
+
},
|
|
11
|
+
"payload": {
|
|
12
|
+
"message": "Process this request",
|
|
13
|
+
"userId": "{{userId}}",
|
|
14
|
+
"companyId": "{{companyId}}",
|
|
15
|
+
"metadata": {
|
|
16
|
+
"priority": "{{priority}}",
|
|
17
|
+
"tags": "{{tags}}",
|
|
18
|
+
"source": "api",
|
|
19
|
+
"timestamp": "2024-01-01T12:00:00Z"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "HubSpot - Contact Created",
|
|
3
|
+
"description": "Simulates HubSpot webhook for new contact",
|
|
4
|
+
"category": "CRM",
|
|
5
|
+
"variables": {
|
|
6
|
+
"contactId": "12345",
|
|
7
|
+
"email": "john.doe@example.com",
|
|
8
|
+
"firstName": "John",
|
|
9
|
+
"lastName": "Doe",
|
|
10
|
+
"phone": "+5511999887766"
|
|
11
|
+
},
|
|
12
|
+
"payload": {
|
|
13
|
+
"subscriptionType": "contact.creation",
|
|
14
|
+
"portalId": 62515,
|
|
15
|
+
"objectId": {{contactId}},
|
|
16
|
+
"propertyName": "email",
|
|
17
|
+
"propertyValue": "{{email}}",
|
|
18
|
+
"changeSource": "CRM_UI",
|
|
19
|
+
"eventId": 3816279340,
|
|
20
|
+
"subscriptionId": 25,
|
|
21
|
+
"attemptNumber": 0,
|
|
22
|
+
"contact": {
|
|
23
|
+
"vid": {{contactId}},
|
|
24
|
+
"properties": {
|
|
25
|
+
"email": {
|
|
26
|
+
"value": "{{email}}"
|
|
27
|
+
},
|
|
28
|
+
"firstname": {
|
|
29
|
+
"value": "{{firstName}}"
|
|
30
|
+
},
|
|
31
|
+
"lastname": {
|
|
32
|
+
"value": "{{lastName}}"
|
|
33
|
+
},
|
|
34
|
+
"phone": {
|
|
35
|
+
"value": "{{phone}}"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Meta - Messenger Message",
|
|
3
|
+
"description": "Simulates Meta/Facebook Messenger webhook",
|
|
4
|
+
"category": "Messaging",
|
|
5
|
+
"variables": {
|
|
6
|
+
"senderId": "1234567890",
|
|
7
|
+
"recipientId": "0987654321",
|
|
8
|
+
"messageText": "Hey, can you help me?",
|
|
9
|
+
"timestamp": "1234567890"
|
|
10
|
+
},
|
|
11
|
+
"payload": {
|
|
12
|
+
"object": "page",
|
|
13
|
+
"entry": [
|
|
14
|
+
{
|
|
15
|
+
"messaging": [
|
|
16
|
+
{
|
|
17
|
+
"sender": {
|
|
18
|
+
"id": "{{senderId}}"
|
|
19
|
+
},
|
|
20
|
+
"recipient": {
|
|
21
|
+
"id": "{{recipientId}}"
|
|
22
|
+
},
|
|
23
|
+
"timestamp": {{timestamp}},
|
|
24
|
+
"message": {
|
|
25
|
+
"mid": "mid.1234567890",
|
|
26
|
+
"text": "{{messageText}}"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Shopify - Order Created",
|
|
3
|
+
"description": "Simulates Shopify webhook when order is created",
|
|
4
|
+
"category": "E-commerce",
|
|
5
|
+
"variables": {
|
|
6
|
+
"orderId": "12345",
|
|
7
|
+
"customerName": "John Doe",
|
|
8
|
+
"total": "299.99",
|
|
9
|
+
"currency": "USD"
|
|
10
|
+
},
|
|
11
|
+
"payload": {
|
|
12
|
+
"event": "orders/create",
|
|
13
|
+
"data": {
|
|
14
|
+
"order": {
|
|
15
|
+
"id": "{{orderId}}",
|
|
16
|
+
"customer": {
|
|
17
|
+
"name": "{{customerName}}"
|
|
18
|
+
},
|
|
19
|
+
"total_price": "{{total}}",
|
|
20
|
+
"currency": "{{currency}}"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Slack - Message Posted",
|
|
3
|
+
"description": "Simulates Slack webhook when message is posted",
|
|
4
|
+
"category": "Messaging",
|
|
5
|
+
"variables": {
|
|
6
|
+
"userId": "U1234567890",
|
|
7
|
+
"channelId": "C0987654321",
|
|
8
|
+
"text": "Hey team, can someone help?",
|
|
9
|
+
"timestamp": "1234567890.123456"
|
|
10
|
+
},
|
|
11
|
+
"payload": {
|
|
12
|
+
"type": "event_callback",
|
|
13
|
+
"event": {
|
|
14
|
+
"type": "message",
|
|
15
|
+
"user": "{{userId}}",
|
|
16
|
+
"channel": "{{channelId}}",
|
|
17
|
+
"text": "{{text}}",
|
|
18
|
+
"ts": "{{timestamp}}"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Stripe - Payment Success",
|
|
3
|
+
"description": "Simulates Stripe webhook for successful payment",
|
|
4
|
+
"category": "Payments",
|
|
5
|
+
"variables": {
|
|
6
|
+
"paymentIntentId": "pi_123456",
|
|
7
|
+
"amount": "29999",
|
|
8
|
+
"currency": "usd",
|
|
9
|
+
"customerEmail": "john@example.com"
|
|
10
|
+
},
|
|
11
|
+
"payload": {
|
|
12
|
+
"type": "payment_intent.succeeded",
|
|
13
|
+
"data": {
|
|
14
|
+
"object": {
|
|
15
|
+
"id": "{{paymentIntentId}}",
|
|
16
|
+
"amount": {{amount}},
|
|
17
|
+
"currency": "{{currency}}",
|
|
18
|
+
"receipt_email": "{{customerEmail}}"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Twilio - SMS Received",
|
|
3
|
+
"description": "Simulates Twilio webhook when SMS is received",
|
|
4
|
+
"category": "Messaging",
|
|
5
|
+
"variables": {
|
|
6
|
+
"from": "+5511999887766",
|
|
7
|
+
"to": "+5511888776655",
|
|
8
|
+
"body": "Hello, I need help!",
|
|
9
|
+
"messageSid": "SM1234567890abcdef"
|
|
10
|
+
},
|
|
11
|
+
"payload": {
|
|
12
|
+
"MessageSid": "{{messageSid}}",
|
|
13
|
+
"From": "{{from}}",
|
|
14
|
+
"To": "{{to}}",
|
|
15
|
+
"Body": "{{body}}",
|
|
16
|
+
"FromCountry": "BR",
|
|
17
|
+
"ToCountry": "BR",
|
|
18
|
+
"FromState": "SP",
|
|
19
|
+
"ToState": "SP"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Twilio - WhatsApp Message",
|
|
3
|
+
"description": "Simulates Twilio WhatsApp webhook",
|
|
4
|
+
"category": "Messaging",
|
|
5
|
+
"variables": {
|
|
6
|
+
"from": "whatsapp:+5511999887766",
|
|
7
|
+
"to": "whatsapp:+5511888776655",
|
|
8
|
+
"body": "Oi! Preciso de ajuda",
|
|
9
|
+
"profileName": "Joรฃo Silva",
|
|
10
|
+
"messageSid": "SM9876543210fedcba"
|
|
11
|
+
},
|
|
12
|
+
"payload": {
|
|
13
|
+
"MessageSid": "{{messageSid}}",
|
|
14
|
+
"From": "{{from}}",
|
|
15
|
+
"To": "{{to}}",
|
|
16
|
+
"Body": "{{body}}",
|
|
17
|
+
"ProfileName": "{{profileName}}",
|
|
18
|
+
"WaId": "5511999887766",
|
|
19
|
+
"FromCountry": "BR",
|
|
20
|
+
"ToCountry": "BR"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Zendesk - Ticket Created",
|
|
3
|
+
"description": "Simulates Zendesk webhook for new support ticket",
|
|
4
|
+
"category": "Support",
|
|
5
|
+
"variables": {
|
|
6
|
+
"ticketId": "12345",
|
|
7
|
+
"subject": "Need help with integration",
|
|
8
|
+
"description": "I'm having trouble setting up the API",
|
|
9
|
+
"requesterEmail": "customer@example.com",
|
|
10
|
+
"priority": "high"
|
|
11
|
+
},
|
|
12
|
+
"payload": {
|
|
13
|
+
"type": "ticket_created",
|
|
14
|
+
"ticket": {
|
|
15
|
+
"id": {{ticketId}},
|
|
16
|
+
"subject": "{{subject}}",
|
|
17
|
+
"description": "{{description}}",
|
|
18
|
+
"priority": "{{priority}}",
|
|
19
|
+
"status": "new",
|
|
20
|
+
"requester": {
|
|
21
|
+
"email": "{{requesterEmail}}"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/static/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Runflow Test Interface - Frontend Architecture
|
|
2
|
+
|
|
3
|
+
## ๐ Overview
|
|
4
|
+
|
|
5
|
+
The Runflow Test Interface is a professional, modular frontend for testing AI agents. Built with vanilla JavaScript for simplicity and served as static files by the CLI `test` command.
|
|
6
|
+
|
|
7
|
+
## ๐๏ธ Architecture
|
|
8
|
+
|
|
9
|
+
### Module System
|
|
10
|
+
```javascript
|
|
11
|
+
// Simple but effective module pattern
|
|
12
|
+
Runflow.define('ModuleName', ['Dependency1'], (Dep1) => {
|
|
13
|
+
// Module implementation
|
|
14
|
+
return { /* public API */ };
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Core Modules
|
|
19
|
+
|
|
20
|
+
#### 1. **Config**
|
|
21
|
+
- Centralized configuration management
|
|
22
|
+
- API endpoints, UI settings, feature flags
|
|
23
|
+
|
|
24
|
+
#### 2. **EventBus**
|
|
25
|
+
- Central communication hub
|
|
26
|
+
- Decoupled component interaction
|
|
27
|
+
- Event-driven architecture
|
|
28
|
+
|
|
29
|
+
#### 3. **StateManager**
|
|
30
|
+
- Centralized state management
|
|
31
|
+
- Subscription-based updates
|
|
32
|
+
- Path-based state access
|
|
33
|
+
|
|
34
|
+
#### 4. **APIClient**
|
|
35
|
+
- Clean HTTP communication layer
|
|
36
|
+
- Error handling and retries
|
|
37
|
+
- Health check monitoring
|
|
38
|
+
|
|
39
|
+
#### 5. **UIComponents**
|
|
40
|
+
- Reusable UI elements
|
|
41
|
+
- Message formatting
|
|
42
|
+
- Toast notifications
|
|
43
|
+
- Status indicators
|
|
44
|
+
|
|
45
|
+
#### 6. **ChatManager**
|
|
46
|
+
- Message handling logic
|
|
47
|
+
- Chat export functionality
|
|
48
|
+
- Message history management
|
|
49
|
+
|
|
50
|
+
#### 7. **ScenarioManager**
|
|
51
|
+
- Test scenario loading
|
|
52
|
+
- Variable substitution
|
|
53
|
+
- Payload preview
|
|
54
|
+
|
|
55
|
+
#### 8. **ConnectionMonitor**
|
|
56
|
+
- Health check service
|
|
57
|
+
- Connection status management
|
|
58
|
+
- Auto-reconnection logic
|
|
59
|
+
|
|
60
|
+
## ๐จ Design System
|
|
61
|
+
|
|
62
|
+
### Color Palette
|
|
63
|
+
- **Primary**: Brand colors (#4f46e5)
|
|
64
|
+
- **Semantic**: Success, Warning, Error, Info
|
|
65
|
+
- **Neutrals**: Gray scale for UI elements
|
|
66
|
+
|
|
67
|
+
### Typography
|
|
68
|
+
- **Sans**: Inter for UI text
|
|
69
|
+
- **Mono**: SF Mono for code
|
|
70
|
+
|
|
71
|
+
### Spacing Scale
|
|
72
|
+
- Consistent spacing system (4px base)
|
|
73
|
+
- Variables from `--space-1` to `--space-10`
|
|
74
|
+
|
|
75
|
+
### Components
|
|
76
|
+
- **Panels**: Information cards with hover effects
|
|
77
|
+
- **Messages**: Typed message bubbles with animations
|
|
78
|
+
- **Buttons**: Consistent button styles with states
|
|
79
|
+
- **Forms**: Clean input fields with focus states
|
|
80
|
+
|
|
81
|
+
## ๐ Features
|
|
82
|
+
|
|
83
|
+
### Developer Experience
|
|
84
|
+
1. **Modular Architecture**: Clean separation of concerns
|
|
85
|
+
2. **Event-Driven**: Decoupled components via EventBus
|
|
86
|
+
3. **State Management**: Centralized state with subscriptions
|
|
87
|
+
4. **Error Handling**: Comprehensive error management
|
|
88
|
+
5. **Debug Tools**: Available in development mode
|
|
89
|
+
|
|
90
|
+
### User Experience
|
|
91
|
+
1. **Real-time Updates**: Live connection status
|
|
92
|
+
2. **Keyboard Shortcuts**: Productivity shortcuts
|
|
93
|
+
3. **Export Functionality**: Save chat history
|
|
94
|
+
4. **Test Scenarios**: Pre-configured test cases
|
|
95
|
+
5. **Responsive Design**: Works on all screen sizes
|
|
96
|
+
|
|
97
|
+
## ๐ File Structure
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
static/
|
|
101
|
+
โโโ app.js # Main application logic (modular)
|
|
102
|
+
โโโ style.css # Professional styling
|
|
103
|
+
โโโ index.html # Semantic HTML structure
|
|
104
|
+
โโโ README.md # This file
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## ๐ ๏ธ Development
|
|
108
|
+
|
|
109
|
+
### Adding New Modules
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
Runflow.define('NewModule', ['Dependency'], (Dep) => {
|
|
113
|
+
// Private variables
|
|
114
|
+
let privateVar = 'value';
|
|
115
|
+
|
|
116
|
+
// Private functions
|
|
117
|
+
function privateFunc() {}
|
|
118
|
+
|
|
119
|
+
// Public API
|
|
120
|
+
return {
|
|
121
|
+
publicMethod() {
|
|
122
|
+
// Implementation
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Event Communication
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
// Emit events
|
|
132
|
+
EventBus.emit('event:name', { data });
|
|
133
|
+
|
|
134
|
+
// Listen to events
|
|
135
|
+
EventBus.on('event:name', (data) => {
|
|
136
|
+
// Handle event
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### State Management
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
// Get state
|
|
144
|
+
const value = StateManager.get('path.to.value');
|
|
145
|
+
|
|
146
|
+
// Set state
|
|
147
|
+
StateManager.set('path.to.value', newValue);
|
|
148
|
+
|
|
149
|
+
// Subscribe to changes
|
|
150
|
+
StateManager.subscribe('path.to.value', (newValue) => {
|
|
151
|
+
// React to change
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## ๐ง Configuration
|
|
156
|
+
|
|
157
|
+
The interface automatically configures itself based on:
|
|
158
|
+
- URL parameters (e.g., `?backend=8547`)
|
|
159
|
+
- Default values in the Config module
|
|
160
|
+
- Runtime detection
|
|
161
|
+
|
|
162
|
+
## ๐ฏ Best Practices
|
|
163
|
+
|
|
164
|
+
1. **Module Independence**: Each module should be self-contained
|
|
165
|
+
2. **Event-Driven**: Use EventBus for cross-module communication
|
|
166
|
+
3. **State Management**: Use StateManager for shared state
|
|
167
|
+
4. **Error Handling**: Always handle errors gracefully
|
|
168
|
+
5. **User Feedback**: Provide clear feedback for all actions
|
|
169
|
+
|
|
170
|
+
## ๐ Performance
|
|
171
|
+
|
|
172
|
+
- **Lazy Loading**: Components initialize only when needed
|
|
173
|
+
- **Event Delegation**: Efficient event handling
|
|
174
|
+
- **Animation Optimization**: CSS animations for smooth UI
|
|
175
|
+
- **Message Limiting**: Auto-cleanup of old messages
|
|
176
|
+
|
|
177
|
+
## ๐ Security
|
|
178
|
+
|
|
179
|
+
- **Input Validation**: All user inputs are validated
|
|
180
|
+
- **XSS Protection**: Content is properly escaped
|
|
181
|
+
- **CORS Handling**: Proper CORS configuration
|
|
182
|
+
|
|
183
|
+
## ๐ฑ Responsive Design
|
|
184
|
+
|
|
185
|
+
- **Desktop**: Full sidebar layout
|
|
186
|
+
- **Tablet**: Grid-based sidebar
|
|
187
|
+
- **Mobile**: Stacked layout
|
|
188
|
+
|
|
189
|
+
## โจ๏ธ Keyboard Shortcuts
|
|
190
|
+
|
|
191
|
+
| Shortcut | Action |
|
|
192
|
+
|----------|--------|
|
|
193
|
+
| `Enter` | Send message |
|
|
194
|
+
| `Ctrl+L` | Clear chat |
|
|
195
|
+
| `Esc` | Clear input |
|
|
196
|
+
| `Ctrl+E` | Export chat |
|
|
197
|
+
| `Ctrl+K` | Focus input |
|
|
198
|
+
|
|
199
|
+
## ๐ Debug Mode
|
|
200
|
+
|
|
201
|
+
When running on localhost, debug tools are available:
|
|
202
|
+
|
|
203
|
+
```javascript
|
|
204
|
+
window.RunflowDebug = {
|
|
205
|
+
state: StateManager,
|
|
206
|
+
events: EventBus,
|
|
207
|
+
modules: Runflow
|
|
208
|
+
};
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## ๐ Future Improvements
|
|
212
|
+
|
|
213
|
+
- [ ] Theme switcher (dark mode)
|
|
214
|
+
- [ ] Message search functionality
|
|
215
|
+
- [ ] Advanced filtering options
|
|
216
|
+
- [ ] Performance metrics display
|
|
217
|
+
- [ ] WebSocket support for real-time updates
|
|
218
|
+
|
|
219
|
+
## ๐ License
|
|
220
|
+
|
|
221
|
+
Part of the Runflow Platform - Built for developers, by developers.
|