2025-11-04 23:11:33 -03:00
|
|
|
use crate::basic::keywords::add_suggestion::clear_suggestions_keyword;
|
2025-11-01 20:53:45 -03:00
|
|
|
use crate::basic::keywords::set_user::set_user_keyword;
|
2025-10-12 20:12:49 -03:00
|
|
|
use crate::shared::models::UserSession;
|
|
|
|
|
use crate::shared::state::AppState;
|
|
|
|
|
use log::info;
|
|
|
|
|
use rhai::{Dynamic, Engine, EvalAltResult};
|
|
|
|
|
use std::sync::Arc;
|
2025-10-18 18:19:08 -03:00
|
|
|
pub mod compiler;
|
2025-10-12 20:12:49 -03:00
|
|
|
pub mod keywords;
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
use self::keywords::add_suggestion::add_suggestion_keyword;
|
2025-10-18 18:19:08 -03:00
|
|
|
use self::keywords::add_website::add_website_keyword;
|
2025-10-16 14:22:28 -03:00
|
|
|
use self::keywords::bot_memory::{get_bot_memory_keyword, set_bot_memory_keyword};
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
use self::keywords::clear_kb::register_clear_kb_keyword;
|
2025-10-18 18:19:08 -03:00
|
|
|
use self::keywords::clear_tools::clear_tools_keyword;
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
#[cfg(feature = "email")]
|
|
|
|
|
use self::keywords::create_draft_keyword;
|
2025-10-06 10:30:17 -03:00
|
|
|
use self::keywords::create_site::create_site_keyword;
|
|
|
|
|
use self::keywords::find::find_keyword;
|
|
|
|
|
use self::keywords::first::first_keyword;
|
|
|
|
|
use self::keywords::for_next::for_keyword;
|
|
|
|
|
use self::keywords::format::format_keyword;
|
|
|
|
|
use self::keywords::get::get_keyword;
|
2025-11-01 20:53:45 -03:00
|
|
|
use self::keywords::hear_talk::{hear_keyword, talk_keyword};
|
2025-10-06 10:30:17 -03:00
|
|
|
use self::keywords::last::last_keyword;
|
2025-11-21 23:23:53 -03:00
|
|
|
use self::keywords::use_kb::register_use_kb_keyword;
|
|
|
|
|
use self::keywords::use_tool::use_tool_keyword;
|
|
|
|
|
|
2025-10-06 10:30:17 -03:00
|
|
|
use self::keywords::llm_keyword::llm_keyword;
|
|
|
|
|
use self::keywords::on::on_keyword;
|
|
|
|
|
use self::keywords::print::print_keyword;
|
|
|
|
|
use self::keywords::set::set_keyword;
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
use self::keywords::set_context::set_context_keyword;
|
2025-11-21 23:23:53 -03:00
|
|
|
|
2025-10-06 10:30:17 -03:00
|
|
|
use self::keywords::wait::wait_keyword;
|
|
|
|
|
pub struct ScriptService {
|
2025-10-13 17:43:03 -03:00
|
|
|
pub engine: Engine,
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
}
|
2025-10-06 10:30:17 -03:00
|
|
|
impl ScriptService {
|
2025-10-12 20:12:49 -03:00
|
|
|
pub fn new(state: Arc<AppState>, user: UserSession) -> Self {
|
2025-10-06 10:30:17 -03:00
|
|
|
let mut engine = Engine::new();
|
|
|
|
|
engine.set_allow_anonymous_fn(true);
|
|
|
|
|
engine.set_allow_looping(true);
|
2025-10-07 10:53:09 -03:00
|
|
|
#[cfg(feature = "email")]
|
2025-10-12 20:12:49 -03:00
|
|
|
create_draft_keyword(&state, user.clone(), &mut engine);
|
2025-10-16 14:22:28 -03:00
|
|
|
set_bot_memory_keyword(state.clone(), user.clone(), &mut engine);
|
|
|
|
|
get_bot_memory_keyword(state.clone(), user.clone(), &mut engine);
|
2025-10-12 20:12:49 -03:00
|
|
|
create_site_keyword(&state, user.clone(), &mut engine);
|
|
|
|
|
find_keyword(&state, user.clone(), &mut engine);
|
|
|
|
|
for_keyword(&state, user.clone(), &mut engine);
|
2025-11-21 23:23:53 -03:00
|
|
|
let _ = register_use_kb_keyword(&mut engine, state.clone(), Arc::new(user.clone()));
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
let _ = register_clear_kb_keyword(&mut engine, state.clone(), Arc::new(user.clone()));
|
2025-10-06 10:30:17 -03:00
|
|
|
first_keyword(&mut engine);
|
|
|
|
|
last_keyword(&mut engine);
|
|
|
|
|
format_keyword(&mut engine);
|
2025-10-15 21:18:01 -03:00
|
|
|
llm_keyword(state.clone(), user.clone(), &mut engine);
|
2025-10-15 12:45:15 -03:00
|
|
|
get_keyword(state.clone(), user.clone(), &mut engine);
|
2025-10-12 20:12:49 -03:00
|
|
|
set_keyword(&state, user.clone(), &mut engine);
|
|
|
|
|
wait_keyword(&state, user.clone(), &mut engine);
|
|
|
|
|
print_keyword(&state, user.clone(), &mut engine);
|
|
|
|
|
on_keyword(&state, user.clone(), &mut engine);
|
2025-10-13 17:43:03 -03:00
|
|
|
hear_keyword(state.clone(), user.clone(), &mut engine);
|
|
|
|
|
talk_keyword(state.clone(), user.clone(), &mut engine);
|
2025-10-31 20:55:13 -03:00
|
|
|
set_context_keyword(state.clone(), user.clone(), &mut engine);
|
2025-10-13 18:11:03 -03:00
|
|
|
set_user_keyword(state.clone(), user.clone(), &mut engine);
|
2025-11-04 23:11:33 -03:00
|
|
|
clear_suggestions_keyword(state.clone(), user.clone(), &mut engine);
|
2025-11-21 23:23:53 -03:00
|
|
|
|
|
|
|
|
use_tool_keyword(state.clone(), user.clone(), &mut engine);
|
2025-10-18 18:19:08 -03:00
|
|
|
clear_tools_keyword(state.clone(), user.clone(), &mut engine);
|
2025-11-21 23:23:53 -03:00
|
|
|
|
2025-10-18 18:19:08 -03:00
|
|
|
add_website_keyword(state.clone(), user.clone(), &mut engine);
|
2025-10-30 09:09:15 -03:00
|
|
|
add_suggestion_keyword(state.clone(), user.clone(), &mut engine);
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
ScriptService { engine }
|
2025-10-06 10:30:17 -03:00
|
|
|
}
|
|
|
|
|
fn preprocess_basic_script(&self, script: &str) -> String {
|
|
|
|
|
let mut result = String::new();
|
|
|
|
|
let mut for_stack: Vec<usize> = Vec::new();
|
|
|
|
|
let mut current_indent = 0;
|
|
|
|
|
for line in script.lines() {
|
|
|
|
|
let trimmed = line.trim();
|
`@media (prefers-color-scheme: dark)`
- ✅ Enhanced accessibility features (focus states, reduced motion)
- ✅ Added connection status component styles
- ✅ Improved responsive design
- ✅ Added utility classes for common patterns
- ✅ Added semantic HTML5 elements (`<header>`, `<main>`, `<nav>`)
- ✅ Comprehensive ARIA labels and roles for accessibility
- ✅ Keyboard navigation support (Alt+1-4 for sections, Esc for menus)
- ✅ Better event handling and state management
- ✅ Theme change subscriber with meta theme-color sync
- ✅ Online/offline connection monitoring
- ✅ Enhanced console logging with app info
- ✅ `THEMES.md` (400+ lines) - Complete theme system guide
- ✅ `README.md` (433+ lines) - Main application documentation
- ✅ `COMPONENTS.md` (773+ lines) - UI component library reference
- ✅ `QUICKSTART.md` (359+ lines) - Quick start guide for developers
- ✅ `REBUILD_NOTES.md` - This summary document
**Theme files define base colors:** ```css :root { --primary: 217 91%
60%; /* HSL: blue */ --background: 0 0% 100%; /* HSL: white */ } ```
**App.css bridges to working variables:** ```css :root { --accent-color:
hsl(var(--primary)); --primary-bg: hsl(var(--background));
--accent-light: hsla(var(--primary) / 0.1); } ```
**Components use working variables:** ```css .button { background:
var(--accent-color); color: hsl(var(--primary-foreground)); } ```
- ✅ Keyboard shortcuts (Alt+1-4, Esc)
- ✅ System dark mode detection
- ✅ Theme change event subscription
- ✅ Automatic document title updates
- ✅ Meta theme-color synchronization
- ✅ Enhanced console logging
- ✅ Better error handling
- ✅ Improved accessibility
- ✅ Theme switching via dropdown
- ✅ Theme persistence to localStorage
- ✅ Apps menu with section switching
- ✅ Dynamic section loading (Chat, Drive, Tasks, Mail)
- ✅ WebSocket chat functionality
- ✅ Alpine.js integration for other modules
- ✅ Responsive design
- ✅ Loading states
- [x] Theme switching works across all 19 themes
- [x] All sections load correctly
- [x] Keyboard shortcuts functional
- [x] Responsive on mobile/tablet/desktop
- [x] Accessibility features working
- [x] No console errors
- [x] Theme persistence works
- [x] Dark mode detection works
``` documentation/ ├── README.md # Main docs - start here ├──
QUICKSTART.md # 5-minute guide ├── THEMES.md # Theme system details ├──
COMPONENTS.md # UI component library └── REBUILD_NOTES.md # This summary
```
1. **HSL Bridge System**: Allows theme files to use shadcn-style HSL
variables while the app automatically derives working CSS properties
2. **No Breaking Changes**: All existing functionality preserved and
enhanced
3. **Developer-Friendly**: Comprehensive documentation for customization
4. **Accessibility First**: ARIA labels, keyboard navigation, focus
management
5. **Performance Optimized**: Instant theme switching, minimal reflows
- **Rebuild**: ✅ Complete
- **Testing**: ✅ Passed
- **Documentation**: ✅ Complete
- **Production Ready**: ✅ Yes
The rebuild successfully integrates the theme system throughout the UI
while maintaining all functionality and adding comprehensive
documentation for future development.
2025-11-21 09:28:02 -03:00
|
|
|
if trimmed.is_empty() || trimmed.starts_with("//") {
|
2025-10-06 10:30:17 -03:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if trimmed.starts_with("FOR EACH") {
|
|
|
|
|
for_stack.push(current_indent);
|
|
|
|
|
result.push_str(&" ".repeat(current_indent));
|
|
|
|
|
result.push_str(trimmed);
|
|
|
|
|
result.push_str("{\n");
|
|
|
|
|
current_indent += 4;
|
|
|
|
|
result.push_str(&" ".repeat(current_indent));
|
|
|
|
|
result.push('\n');
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if trimmed.starts_with("NEXT") {
|
|
|
|
|
if let Some(expected_indent) = for_stack.pop() {
|
|
|
|
|
if (current_indent - 4) != expected_indent {
|
|
|
|
|
panic!("NEXT without matching FOR EACH");
|
|
|
|
|
}
|
|
|
|
|
current_indent = current_indent - 4;
|
|
|
|
|
result.push_str(&" ".repeat(current_indent));
|
|
|
|
|
result.push_str("}\n");
|
|
|
|
|
result.push_str(&" ".repeat(current_indent));
|
|
|
|
|
result.push_str(trimmed);
|
|
|
|
|
result.push(';');
|
|
|
|
|
result.push('\n');
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
panic!("NEXT without matching FOR EACH");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if trimmed == "EXIT FOR" {
|
|
|
|
|
result.push_str(&" ".repeat(current_indent));
|
|
|
|
|
result.push_str(trimmed);
|
|
|
|
|
result.push('\n');
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
result.push_str(&" ".repeat(current_indent));
|
|
|
|
|
let basic_commands = [
|
2025-10-11 12:29:03 -03:00
|
|
|
"SET",
|
|
|
|
|
"CREATE",
|
|
|
|
|
"PRINT",
|
|
|
|
|
"FOR",
|
|
|
|
|
"FIND",
|
|
|
|
|
"GET",
|
|
|
|
|
"EXIT",
|
|
|
|
|
"IF",
|
|
|
|
|
"THEN",
|
|
|
|
|
"ELSE",
|
|
|
|
|
"END IF",
|
|
|
|
|
"WHILE",
|
|
|
|
|
"WEND",
|
|
|
|
|
"DO",
|
|
|
|
|
"LOOP",
|
|
|
|
|
"HEAR",
|
|
|
|
|
"TALK",
|
|
|
|
|
"SET CONTEXT",
|
2025-10-13 17:43:03 -03:00
|
|
|
"SET USER",
|
2025-10-16 14:22:28 -03:00
|
|
|
"GET BOT MEMORY",
|
|
|
|
|
"SET BOT MEMORY",
|
2025-10-06 10:30:17 -03:00
|
|
|
];
|
|
|
|
|
let is_basic_command = basic_commands.iter().any(|&cmd| trimmed.starts_with(cmd));
|
|
|
|
|
let is_control_flow = trimmed.starts_with("IF")
|
|
|
|
|
|| trimmed.starts_with("ELSE")
|
|
|
|
|
|| trimmed.starts_with("END IF");
|
|
|
|
|
if is_basic_command || !for_stack.is_empty() || is_control_flow {
|
|
|
|
|
result.push_str(trimmed);
|
|
|
|
|
result.push(';');
|
|
|
|
|
} else {
|
|
|
|
|
result.push_str(trimmed);
|
|
|
|
|
if !trimmed.ends_with(';') && !trimmed.ends_with('{') && !trimmed.ends_with('}') {
|
|
|
|
|
result.push(';');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.push('\n');
|
|
|
|
|
}
|
|
|
|
|
if !for_stack.is_empty() {
|
|
|
|
|
panic!("Unclosed FOR EACH loop");
|
|
|
|
|
}
|
|
|
|
|
result
|
|
|
|
|
}
|
|
|
|
|
pub fn compile(&self, script: &str) -> Result<rhai::AST, Box<EvalAltResult>> {
|
|
|
|
|
let processed_script = self.preprocess_basic_script(script);
|
|
|
|
|
info!("Processed Script:\n{}", processed_script);
|
|
|
|
|
match self.engine.compile(&processed_script) {
|
|
|
|
|
Ok(ast) => Ok(ast),
|
2025-10-11 20:02:14 -03:00
|
|
|
Err(parse_error) => Err(Box::new(parse_error.into())),
|
2025-10-06 10:30:17 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pub fn run(&self, ast: &rhai::AST) -> Result<Dynamic, Box<EvalAltResult>> {
|
|
|
|
|
self.engine.eval_ast(ast)
|
|
|
|
|
}
|
|
|
|
|
}
|