Compare commits

...

28 commits

Author SHA1 Message Date
66f54677bf chore: Update submodules
Some checks failed
BotServer CI / build (push) Failing after 15s
- botui: Fix theme switching to apply immediately without refresh
- botserver: Load session tools in WebSocket connection

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
63c2e17818 fix: Extract Valkey to cache/bin/ with correct paths
- Binaries at cache/bin/valkey-server
- exec_cmd and check_cmd updated to use bin/ subdirectory

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
f695cad94f fix: Extract Valkey binaries to correct cache/ path
- Binaries at cache/valkey-server (not cache/bin/)
- Uses --strip-components=2 to flatten structure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
e7b5718469 fix: Use Valkey 8.1.5-jammy for GLIBC compatibility
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
a01c229d71 fix: Downgrade Valkey to 8.1.5 for stability
- Using valkey-8.1.5-noble-x86_64.tar.gz

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
be19d9e06b feat: Update botserver with 5s cache retry delay
- 5 seconds between retry attempts
- 12 attempts max (60s total)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
60f2a87955 feat: Update botserver with cache retry logic
- Wait up to 30 seconds for Valkey to be ready
- Prevents race condition during startup

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
7d2b4fbab2 fix: Update botserver submodule with precompiled Valkey binary
- Uses valkey-9.0.2-jammy-x86_64.tar.gz from download.valkey.io
- No source compilation required

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
8619b1b09d fix: Update botserver submodule with cache and LLM improvements
- Cache connection verification with PING test
- Environment variable support for cache URL (CACHE_URL, REDIS_URL, VALKEY_URL)
- Environment variable support for LLM config (LLM_URL, LLM_MODEL, LLM_KEY)
- Better fallback to local LLM when no bot config exists

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
647f3f1c6c fix: Update botserver submodule after compilation fixes
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
41adbc2cca chore: Update botserver submodule reference
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
c865017561 feat: Add local bot data documentation and update submodule
- Document /opt/gbo/data/ directory for local bot packages
- Document auto-loading, compilation, and hot-reload features
- Update botserver submodule with latest changes
- Add console and network config files

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
5ffa0d71af fix(i18n): Update botui with cache invalidation
- Increments i18n cache version to v2
- Forces fresh translation fetch from all users
- Resolves placeholder translation issue

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
0057ca3612 chore: Update botui submodule
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
504bb66a82 fix(i18n): Update botlib submodule with debug-embed support
- botlib now embeds i18n translations in both debug and release builds
- Uses debug-embed feature from rust-embed

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
1e6289b223 feat(i18n): Update botlib submodule with embedded i18n by default
- botlib now uses embedded assets via rust-embed by default
- i18n feature is now part of default features
- Fixes placeholder translations issue

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
8c3f51a49d Update botserver submodule to latest commit
- Adds local Vault bootstrap .env file creation
- Fixes Vault initialization for local installations
- Generates TLS certificates during Vault install
- Creates .env with VAULT_ADDR, VAULT_TOKEN, VAULT_CACERT

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
cf0d94873d Debug: Add translation lookup logging 2026-02-15 23:21:30 +00:00
8eef47058d Debug: Add i18n logging to find missing translations 2026-02-15 23:21:30 +00:00
dcaf90d39f feat(i18n): Update botui with cache versioning
This adds cache versioning (v1) to prevent stale translation issues.
Old caches will be auto-invalidated when version is incremented.
2026-02-15 23:21:30 +00:00
a8e107059a fix(i18n): Update botui with cache logging 2026-02-15 23:21:30 +00:00
ea4cb78646 fix(i18n): Update botui submodule with logging 2026-02-15 23:21:30 +00:00
eda45af678 fix(i18n): Update botlib submodule with locale logging 2026-02-15 23:21:30 +00:00
fc994375b1 Update botui submodule 2026-02-15 23:21:30 +00:00
3fe4f7ece7 Update botserver submodule 2026-02-15 23:21:30 +00:00
4202f0dcf9 CI: Trigger pipeline 2026-02-15 23:21:30 +00:00
fad4e1457b CI: Bust cache to fix notify dependency build
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:30 +00:00
b798123f14 Update submodule references
- botserver: Fix notify dependency and source files
- botbook: Update PROMPT.md
- botui: Update UI components and themes

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 23:21:25 +00:00
14 changed files with 165 additions and 32 deletions

1
.gitignore vendored
View file

@ -49,3 +49,4 @@ node_modules/
/playwright/.cache/
/playwright/.auth/
config/directory_config.json
# CI cache bust: Fri Feb 13 22:33:51 UTC 2026

View file

@ -35,6 +35,35 @@ For comprehensive documentation, see **[docs.pragmatismo.com.br](https://docs.pr
- **Env file:** `botserver/.env`
- **Stack:** `botserver-stack/`
- **UI Files:** `botui/ui/suite/`
- **Local Bot Data:** `/opt/gbo/data/` (place `.gbai` packages here)
### Local Bot Data Directory
Place local bot packages in `/opt/gbo/data/` for automatic loading and monitoring:
**Directory Structure:**
```
/opt/gbo/data/
└── mybot.gbai/
├── mybot.gbdialog/
│ ├── start.bas
│ └── main.bas
└── mybot.gbot/
└── config.csv
```
**Features:**
- **Auto-loading:** Bots automatically mounted on server startup
- **Auto-compilation:** `.bas` files compiled to `.ast` on change
- **Auto-creation:** New bots automatically added to database
- **Hot-reload:** Changes trigger immediate recompilation
- **Monitored by:** LocalFileMonitor and ConfigWatcher services
**Usage:**
1. Create bot directory structure in `/opt/gbo/data/`
2. Add `.bas` files to `<bot_name>.gbai/<bot_name>.gbdialog/`
3. Server automatically detects and loads the bot
4. Optional: Add `config.csv` for bot configuration
---
@ -439,6 +468,64 @@ cargo test -p bottest
3. Run [Weekly Maintenance Tasks](#-weekly-maintenance-tasks) to keep codebase healthy
4. Read project-specific READMEs in [Project-Specific Guidelines](#-project-specific-guidelines)
## 🎭 Playwright Browser Testing - YOLO Mode
### YOLO Mode Instructions for LLMs
**When user requests to start YOLO mode with Playwright:**
1. **Start the browser** - Use `mcp__playwright__browser_navigate` to open http://localhost:3000
2. **Take snapshot** - Use `mcp__playwright__browser_snapshot` to see current page state
3. **Test user flows** - Use click, type, fill_form, etc. to interact with UI
4. **Verify results** - Check for expected content, errors in console, network requests
5. **Report findings** - Always include screenshot evidence with `browser_take_screenshot`
**Available Playwright MCP Tools:**
- `browser_navigate` - Navigate to URL
- `browser_snapshot` - Get accessibility tree (better than screenshots for analysis)
- `browser_take_screenshot` - Capture visual state
- `browser_click` - Click elements (provide ref from snapshot)
- `browser_type` - Type text into inputs
- `browser_fill_form` - Fill multiple form fields at once
- `browser_console_messages` - Check for JavaScript errors
- `browser_network_requests` - Inspect API calls
- `browser_close` - Close browser when done
**YOLO Testing Workflow:**
```
1. Navigate → http://localhost:3000
2. Snapshot → Analyze page structure
3. Click → Target element using ref from snapshot
4. Wait → For navigation/updates (browser_wait_for)
5. Verify → Console messages, network status
6. Screenshot → Document test results
```
**Testing Checklist:**
- ✅ UI loads without errors
- ✅ Navigation works between sections
- ✅ Forms submit correctly
- ✅ WebSocket connections establish
- ✅ Console shows no JavaScript errors
- ✅ Network requests return 200/201/204
**Critical Test Flows:**
- **Login/Authentication** → Navigate, enter credentials, verify session
- **Bot Creation** → Click "New Bot", fill form, verify creation
- **Chat Interface** → Send message, verify WebSocket response
- **File Upload** → Upload .bas file, verify compilation
- **Drive Sync** → Trigger sync, verify files appear
**Error Handling in YOLO Mode:**
- If navigation fails: Check if servers running (`ps aux | grep botserver`)
- If element not found: Take snapshot to debug current page state
- If console errors: Extract and report to user for fixing
- If network failures: Check API endpoints and CORS configuration
### Integration Testing
For automated test suites, prefer `cargo test -p bottest` for backend logic and Playwright YOLO mode for full-stack UI testing.
## 🧪 Testing Strategy
### Unit Tests

@ -1 +1 @@
Subproject commit 3e418df1a854fb2c98258b0c454082cd751a8123
Subproject commit 6d48dbba1b21f7fdefd4dfa30d0e33e2879980bb

2
botlib

@ -1 +1 @@
Subproject commit 38dc7c050d9b82c822999ff432600faa0b389df9
Subproject commit 5759fdcd5b528c6f3474cf48f067af4c371e9234

@ -1 +1 @@
Subproject commit 5ea171d12617751283c50c955635135a10a52ad7
Subproject commit 8257d4996739379a6d608230d18047569559864b

2
botui

@ -1 +1 @@
Subproject commit af78f3156594c3bdbb9d76c31b26bcaf30abf77c
Subproject commit 9b417bf4f23f540b5c8cace81e50c37729844e06

19
console-errors.txt Normal file
View file

@ -0,0 +1,19 @@
Total messages: 587 (Errors: 16, Warnings: 4)
Returning 16 messages for level "error"
[ERROR] Failed to load resource: the server responded with a status of 404 (Not Found) @ http://localhost:3000/public/themes/vapordream.css:0
[ERROR] ✗ Failed: 💭 Vapor Dream @ http://localhost:3000/cristo/suite/js/theme-manager.js:85
[ERROR] Failed to load resource: the server responded with a status of 404 (Not Found) @ http://localhost:3000/public/themes/saturdaycartoons.css:0
[ERROR] ✗ Failed: 📺 Cartoons @ http://localhost:3000/cristo/suite/js/theme-manager.js:85
[ERROR] Failed to load resource: the server responded with a status of 404 (Not Found) @ http://localhost:3000/public/themes/cyberpunk.css:0
[ERROR] ✗ Failed: 🌃 Cyberpunk @ http://localhost:3000/cristo/suite/js/theme-manager.js:85
[ERROR] WebSocket connection to 'ws://localhost:3000/ws/chat?session_id=f48dd5f0-662b-49bb-a9a6-4039f6e143e7&user_id=9f6c12e7-15b7-4443-bb4a-15b8e17ba076&bot_name=cristo' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ :819
[ERROR] WebSocket error: Event @ :879
[ERROR] WebSocket connection to 'ws://localhost:3000/ws/chat?session_id=f48dd5f0-662b-49bb-a9a6-4039f6e143e7&user_id=9f6c12e7-15b7-4443-bb4a-15b8e17ba076&bot_name=cristo' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ :819
[ERROR] WebSocket error: Event @ :879
[ERROR] WebSocket connection to 'ws://localhost:3000/ws/chat?session_id=f48dd5f0-662b-49bb-a9a6-4039f6e143e7&user_id=9f6c12e7-15b7-4443-bb4a-15b8e17ba076&bot_name=cristo' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ :819
[ERROR] WebSocket error: Event @ :879
[ERROR] WebSocket connection to 'ws://localhost:3000/ws/chat?session_id=f48dd5f0-662b-49bb-a9a6-4039f6e143e7&user_id=9f6c12e7-15b7-4443-bb4a-15b8e17ba076&bot_name=cristo' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ :819
[ERROR] WebSocket error: Event @ :879
[ERROR] WebSocket connection to 'ws://localhost:3000/ws/chat?session_id=f48dd5f0-662b-49bb-a9a6-4039f6e143e7&user_id=9f6c12e7-15b7-4443-bb4a-15b8e17ba076&bot_name=cristo' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED @ :819
[ERROR] WebSocket error: Event @ :879

7
console-i18n.json Normal file
View file

@ -0,0 +1,7 @@
Total messages: 36 (Errors: 0, Warnings: 4)
Returning 4 messages for level "warning"
[WARNING] [GBSecurity] NO TOKEN - request will be unauthenticated @ https://chat.pragmatismo.com.br/suite/js/security-bootstrap.js?v=20260207b:157
[WARNING] i18n: Missing translation key: chat-mention-title @ https://chat.pragmatismo.com.br/suite/js/i18n.js:129
[WARNING] i18n: Missing translation key: chat-mention-title @ https://chat.pragmatismo.com.br/suite/js/i18n.js:129
[WARNING] i18n: Missing translation key: chat-mention-title @ https://chat.pragmatismo.com.br/suite/js/i18n.js:129

View file

@ -0,0 +1,33 @@
Total messages: 31 (Errors: 0, Warnings: 1)
[LOG] [GBSecurity] HTMX interceptor registered @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:172
[LOG] [GBSecurity] Fetch interceptor registered @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:224
[LOG] [GBSecurity] XHR interceptor registered @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:269
[LOG] [GBSecurity] Security bootstrap initialized @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:125
[LOG] [GBSecurity] Current token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:126
[LOG] [ErrorReporter] Client-side error reporting initialized @ http://localhost:3000/suite/js/error-reporter.js?v=20260207c:102
[LOG] [GBSecurity] fetch intercepted: /api/i18n/en token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:184
[LOG] [GBSecurity] fetch intercepted: /api/product token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:184
[LOG] [GBSecurity] fetch intercepted: /api/product token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:184
[LOG] [NavigationLogger] Navigation tracking initialized @ http://localhost:3000/suite/js/error-reporter.js?v=20260207c:152
[LOG] Initializing HTMX application... @ http://localhost:3000/cristo/suite/js/htmx-app.js:560
[LOG] ✓ Theme Manager initialized @ http://localhost:3000/cristo/suite/js/theme-manager.js:130
[LOG] HTMX application initialized @ http://localhost:3000/cristo/suite/js/htmx-app.js:580
[LOG] 🤖 Bot detected from path: cristo @ http://localhost:3000/cristo/suite/js/suite_app.js:722
[LOG] 🚀 Initializing General Bots with HTMX... @ http://localhost:3000/cristo/suite/js/suite_app.js:748
[LOG] [GBSecurity] fetch intercepted: /api/bot/config?bot_name=cristo token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:184
[LOG] No auth token found - user is signed out @ http://localhost:3000/cristo/suite/js/suite_app.js:1296
[LOG] ✓ Theme loaded: ☀️ Light @ http://localhost:3000/cristo/suite/js/theme-manager.js:79
[LOG] ✅ Bot 'cristo' is public - authentication not required @ http://localhost:3000/cristo/suite/js/suite_app.js:737
[LOG] [GBSecurity] htmx:configRequest for: /suite/chat/chat.html token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:146
[WARNING] [GBSecurity] NO TOKEN - request will be unauthenticated @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:157
[LOG] [GBSecurity] fetch intercepted: /api/bot/config?bot_name=cristo token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:184
[LOG] [GBSecurity] fetch intercepted: /api/auth?bot_name=cristo token: NONE @ http://localhost:3000/suite/js/security-bootstrap.js?v=20260207b:184
[LOG] Chat module initialized with @ mentions support @ :1048
[LOG] Bot config loaded: {color1: #3b82f6, color2: #f5deb3, title: cristo} @ :936
[LOG] Auth: {currentUserId: 042f12c8-7151-4bf3-bd7b-5f8cfd560735, currentSessionId: ecc69ce7-2419-4da7-a149-3c62a1a0af90, currentBotId: 11873f09-9251-4e92-92fa-8de8cabaae7a, currentBotName: cristo} @ :961
[LOG] WebSocket connected @ :822
[LOG] Chat WebSocket received: {bot_id: 11873f09-9251-4e92-92fa-8de8cabaae7a, message: Connected to bot server, session_id: ecc69ce7-2419-4da7-a149-3c62a1a0af90, type: connected, user_id: 042f12c8-7151-4bf3-bd7b-5f8cfd560735} @ :830
[LOG] Chat WebSocket received: {bot_id: 11873f09-9251-4e92-92fa-8de8cabaae7a, user_id: 042f12c8-7151-4bf3-bd7b-5f8cfd560735, session_id: ecc69ce7-2419-4da7-a149-3c62a1a0af90, channel: web, content: Olá! Sou o assistente virtual do Santuário Cristo …sobre celebrações, eventos, visitação ou orações?} @ :830
[LOG] Processing bot response: {bot_id: 11873f09-9251-4e92-92fa-8de8cabaae7a, user_id: 042f12c8-7151-4bf3-bd7b-5f8cfd560735, session_id: ecc69ce7-2419-4da7-a149-3c62a1a0af90, channel: web, content: Olá! Sou o assistente virtual do Santuário Cristo …sobre celebrações, eventos, visitação ou orações?} @ :858
[LOG] Rendering 10 suggestions @ :707

2
prod-console-test.json Normal file
View file

@ -0,0 +1,2 @@
Total messages: 36 (Errors: 0, Warnings: 4)
Returning 0 messages for level "error"

2
prod-console.json Normal file
View file

@ -0,0 +1,2 @@
Total messages: 34 (Errors: 0, Warnings: 4)
Returning 0 messages for level "error"

5
prod-network.json Normal file
View file

@ -0,0 +1,5 @@
[GET] https://chat.pragmatismo.com.br/api/product => [200]
[GET] https://chat.pragmatismo.com.br/api/product => [200]
[GET] https://chat.pragmatismo.com.br/suite/chat/chat.html => [200]
[GET] https://chat.pragmatismo.com.br/api/bot/config?bot_name=default => [200]
[GET] https://chat.pragmatismo.com.br/api/auth?bot_name=default => [200]

View file

@ -1,28 +0,0 @@
#!/bin/bash
set -e
echo "🛑 Stopping existing processes..."
pkill -f botserver || true
pkill -f botui || true
pkill -f rustc || true
echo "🧹 Cleaning logs..."
rm -f botserver.log botui.log
echo "🔨 Building botserver..."
cargo build -p botserver
echo "🔨 Building botui..."
cargo build -p botui
echo "🚀 Starting botserver..."
RUST_LOG=info ./target/debug/botserver --noconsole > botserver.log 2>&1 &
BOTSERVER_PID=$!
echo "🚀 Starting botui..."
BOTSERVER_URL="https://localhost:8088" ./target/debug/botui > botui.log 2>&1 &
BOTUI_PID=$!
echo "✅ Started botserver (PID: $BOTSERVER_PID) and botui (PID: $BOTUI_PID)"
echo "📊 Monitor with: tail -f botserver.log botui.log"
echo "🌐 Access at: http://localhost:3000"

5
vault-unseal-keys Normal file
View file

@ -0,0 +1,5 @@
Unseal Key 1: JDWcTlskyqgKO5dNghRZyVCrdvH9MsJsfmS/nQhpfUyl
Unseal Key 2: UuCsxt0MdaKm0z9ki7oHdLxu7CW47yBnUSrQ2/RiafnT
Unseal Key 3: 5g9WTB3Yg5iwEodnaFM8fUH7DzqGfKMO7Wj8rO6YuJdO
Unseal Key 4: Y5UQzF1PjgeJZ7/3J6fyvTkrNM2W6+hXCyk/5iyOp+0e
Unseal Key 5: f6lFx6B4+RJeKdz3B9r/YNKaTdolenU7PuixDwXMXeJ/