Tutor AI
Versions
Current version
2.0.7 (2026070200)
2.0.7
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2026070200
Version release name: 2.0.7
Maturity: Stable
Supported Moodle versions: 4.4, 4.5, 5.0, 5.1, 5.2
Repository URL (Git): https://github.com/datacurso/moodle-local_dttutor
Repository branch:
Repository tag: 2.0.7
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
Changelog
All notable changes to the Tutor-IA plugin (local_dttutor) will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[2.0.4] - 2026-02-02
Changed
Individual Chat History Implementation
- User-specific sessions: Chat sessions are now tied to individual users instead of being course-wide.
- Session cache keys: Changed from
session_{courseid}tosession_{courseid}_{userid}for proper isolation. - API enhancement: Added
user_idparameter to/chat/startAPI endpoint. - Data privacy: Each user now has their own private chat history that cannot be accessed by other users.
- Breaking change: Sessions created before this update will be invalidated and new sessions will be created per user.
- Files modified:
classes/httpclient/tutoria_api.php- Enhancedstart_session()with userid parameter.classes/external/create_chat_message.php- Pass current user ID to session creation.classes/external/get_chat_history.php- Pass current user ID to history retrieval.
Security Improvements
- Session isolation: Users can only access their own chat sessions.
- Privacy enhancement: Chat history is now private per user, not shared at course level.
[2.0.3] - 2026-02-02
Added
Course Synchronization Validation
- Validation before enabling tutor: Users cannot enable the AI Tutor until course content synchronization is completed
- Frontend validation: Toggle switch is disabled when
indexing_status !== 'completed' - Backend validation:
save_course_configweb service throwsmoodle_exceptionif enabling tutor without completed synchronization - User feedback: Alert message shown explaining synchronization requirement
- Files modified:
classes/external/save_course_config.php- Added validation logicmanage.php- Addedcan_enable_tutortemplate variabletemplates/manage_course.mustache- Added disabled state and info alertlang/en/local_dttutor.php- Added new error string
Technical Details
- Validation checks
indexing_status === 'completed'before allowingindexing_enabled = 1 - Exception type:
moodle_exception('tutor_enable_requires_indexing', 'local_dttutor') - UI state: Toggle disabled with
{{^can_enable_tutor}}disabled{{/can_enable_tutor}}
[2.0.3] - 2026-02-02 (Continued)
Changed
API Compatibility Improvements - Metadata String Conversion
- Metadata string conversion: All metadata values are now converted to strings for API compatibility
- Boolean to string conversion: Boolean values (
off_topic_detection_enabled) are now sent as "true"/"false" strings instead of native booleans - Type safety: Added
array_map()function to ensure all metadata values are strings before sending to API - User ID conversion:
useridmetadata is now explicitly cast to string - Module context support: Added optional
cmidparameter to session management for module-specific chat contexts - Session cache enhancement: Session cache keys now include
cmidwhen in module context (session_{courseid}_{cmid}) - API request structure:
cmidis sent asmodule_idstring in API requests when present - Files modified:
classes/external/create_chat_message.php- Added metadata string conversion and cmid supportclasses/httpclient/tutoria_api.php- Enhanced session caching with cmid parameter
Technical Details
Metadata String Conversion:
- Previous: Mixed types (bool, int, string) sent directly
- Now: All values converted to strings using
array_map()before API call - Boolean conversion:
value ? 'true' : 'false' - Numeric conversion:
(string)$value
Session Caching Enhancement:
- Previous cache key:
session_{courseid} - New cache key:
session_{courseid}_{cmid}(when cmid present) - Allows separate chat sessions for course-level and module-level contexts
- Improves context isolation and relevance of AI responses
API Compatibility:
userid' sent as string instead of integercmid' sent asmodule_idstring in API requestsoff_topic_detection_enabled' sent as "true"/"false" instead of boolean- All other metadata values ' explicitly converted to strings
Version:
- Plugin version:
2026012900 - Release:
2.0.3 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.2:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Existing sessions will be regenerated with new cache key format
- All functionality remains backward compatible
[2.0.2] - 2026-01-23
Changed
Code Cleanup - Removed Redundant Permission Checks
- Removed redundant capability checks: Eliminated unnecessary
require_capability('moodle/course:view')checks from external web services - Reason: The
local/dttutor:usecapability check already validates course access in course context - Impact: Cleaner, more maintainable code without functional changes
- Files modified:
classes/external/create_chat_message.php- Removed redundantmoodle/course:viewcheckclasses/external/delete_chat_session.php- Removed redundantmoodle/course:viewcheckclasses/external/get_chat_history.php- Removed redundantmoodle/course:viewcheckclasses/external/get_course_materials.php- Removed redundantmoodle/course:viewcheck
Technical Details
Permission Check Logic:
- Previous:
require_capability('local/dttutor:use', $context)+require_capability('moodle/course:view', $context) - Now:
require_capability('local/dttutor:use', $context)only - Rationale: Having
local/dttutor:usecapability in a course context already implies course access
Security:
- No security reduction - permission validation remains robust
- All web services still validate:
- User authentication via
require_login() - Context validation via
self::validate_context() - Plugin permission via
require_capability('local/dttutor:use')
- User authentication via
Version:
- Plugin version:
2026012300 - Release:
2.0.2 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.1:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Code refactoring only - no functional changes
[2.0.1] - 2026-01-22
Fixed
Security Vulnerability - Missing Authentication and Context Validation
- Critical fix: Added missing security validations in
create_chat_messageweb service - Issue: Users were receiving permission denied errors because security checks were incomplete
- Root cause: The web service was missing three critical validation steps:
require_login()- User authentication checkself::validate_context($context)- Course context validationrequire_capability('local/dttutor:use', $context)- Plugin permission check
- Solution: Added all three missing validations following Moodle's external service security checklist
- Impact: Fixes "Lo sentimos, pero no tiene los permisos para hacer esto (Ver cursos sin participación)" error
- Files modified:
classes/external/create_chat_message.php
Changed
Permission System - Extended to All Authenticated Users
- Extended access: Added 'user' archetype to
local/dttutor:usecapability - Reason: Allow all authenticated users to use the tutor, not just enrolled students
- Previous behavior: Only students, teachers, editing teachers, and managers could use the chat
- New behavior: All authenticated users with
moodle/course:viewpermission can use the chat - Automatic upgrade: Added upgrade script (
db/upgrade.php) to automatically assign capability to 'user' role when updating from v2.0.0 - Files modified:
db/access.php- Added 'user' archetype to capability definitiondb/upgrade.php- Added version 2026012201 upgrade step to assign capability
Technical Details
Security Validation Order (now properly implemented):
- Parameter validation via
self::validate_parameters() - Authentication check via
require_login() - Plugin state check via
get_config() - Webservice configuration check
- Course context validation via
self::validate_context() - Plugin capability check via
require_capability('local/dttutor:use') - Course view capability check via
require_capability('moodle/course:view')
Permission Archetypes (updated):
user' CAP_ALLOW (NEW - authenticated users)student' CAP_ALLOWteacher' CAP_ALLOWeditingteacher' CAP_ALLOWmanager' CAP_ALLOW
Upgrade Script:
- Version check:
if ($oldversion < 2026012201) - Uses
get_archetype_roles()to find all 'user' roles - Uses
assign_capability()to grant permission at system context - Checks for existing capability to avoid duplicate assignments
- Idempotent - safe to run multiple times
Migration Notes
Upgrading from v2.0.0:
- Replace plugin files with new version
- Access your Moodle site
- Click "Update database" when prompted
- Upgrade script will automatically assign capability to 'user' role
- No manual configuration required
New Installations:
- 'user' archetype automatically included in capability definition
- No additional setup needed
[2.0.0] - 2025-12-30
Changed
User Interface Terminology
- Indexing ' Synchronization: Changed all user-facing terminology from "indexing/indexed" to "synchronization/synchronized" across all 7 supported languages
- Language updates: Updated 19 strings per language - 7 languages = 133 total string changes
- Terminology mapping:
- "Course Indexing" ' "Course Synchronization"
- "Indexed" ' "Synchronized"
- "Indexing in progress" ' "Synchronization in progress"
- "Start Indexing" ' "Start Synchronization"
- "Re-index Course" ' "Re-synchronize Course"
- "Last indexed" ' "Last synchronized"
- "Indexing failed" ' "Synchronization failed"
- "Not indexed" ' "Not synchronized"
- Code preservation: Internal code (variable names, functions, classes) maintains "indexing" terminology to avoid breaking changes
- All languages updated:
- English: Indexing ' Synchronization
- Spanish: Indexación ' Sincronización
- German: Indexierung ' Synchronisierung
- French: Indexation ' Synchronisation
- Portuguese: Indexação ' Sincronização
- Russian: Индексация ' Синхронизация
- Indonesian: Pengindeksan ' Sinkronisasi
Removed
Markdown Formatting Feature
- Removed markdown rendering: Eliminated markdown-to-HTML conversion feature that was causing display issues
- Simplified message display: Chat messages now display as plain text without formatting
- Code cleanup:
- Removed
markdownToHtml()function fromtutor_ia_chat.js - Reverted
appendToAIMessage()to usetextContentinstead ofinnerHTML - Reverted
addMessage()to use.text()for all messages - Reverted
createMessageElement()to use.text()for history messages - Removed CSS styles for markdown formatting (lists, bold, italic)
- Removed
- Reason: Markdown rendering was not working reliably and causing inconsistent message display
Debug Mode
- Removed debug mode feature: Completely removed debug mode and force reindex functionality
- Removed from settings: Deleted debug mode checkbox from admin settings page
- Removed from UI: Deleted debug controls section from chat drawer template
- Removed from hook: Cleaned up debug-related variables from chat_hook.php
- Language cleanup: Removed debug-related strings from all 7 language files
- Removed:
debug_mode,debug_mode_desc,debug_force_reindex
- Removed:
Technical Details
Terminology Change Impact:
- User-facing strings only (no code changes)
- No database migrations required
- No breaking changes to API or functionality
- Maintains backwards compatibility
Files Modified:
lang/en/local_dttutor.php(English)lang/es/local_dttutor.php(Spanish)lang/de/local_dttutor.php(German)lang/fr/local_dttutor.php(French)lang/pt/local_dttutor.php(Portuguese)lang/ru/local_dttutor.php(Russian)lang/id/local_dttutor.php(Indonesian)amd/src/tutor_ia_chat.js(Markdown removal)styles.css(Markdown styles removal)settings.php(Debug mode removal)templates/tutor_ia_drawer.mustache(Debug controls removal)classes/hook/chat_hook.php(Debug variables removal)
[1.9.0] - 2025-12-01
Added
Debug Mode Feature
- Debug mode setting: New admin setting to enable debug options in the chat interface
- Force reindex checkbox: When debug mode is enabled, shows a checkbox to force context reindexing (only visible to site administrators)
- Admin-only access: Debug controls require both debug mode enabled AND site:config capability
- Metadata transmission: Checkbox state sent as
force_reindex=truein message metadata - Visual design: Debug controls styled with warning colors (yellow background) to clearly indicate debug functionality
- Language support: Debug strings added to all 7 supported languages
Error Handling Improvements
- Stream error detection: Enhanced SSE stream error handling to detect and parse JSON error responses
- License error modal: User-friendly modal for license validation errors with clear explanation
- Insufficient credits modal: User-friendly modal for insufficient AI tokens/credits errors
- Language support: Added error strings for license and credits errors in all 7 languages
Technical Details
Debug Mode:
- Admin setting:
local_dttutor/debug_mode(default: disabled) - Template variables:
debug_modeandis_debug_adminpassed to drawer template - Capability check: Requires
moodle/site:configcapability to see debug controls - Visibility: Debug checkbox only shown when BOTH conditions are met (debug_mode=true AND user is admin)
- JavaScript: Checks checkbox state and includes in metadata when checked
- CSS: Warning-styled debug controls with yellow background and amber border
Error Handling:
- Enhanced EventSource error listener to parse JSON error data from SSE stream
- Added
handleStreamError()method to detect and categorize API errors - Detects errors with structure:
{detail: {status: "error", detail: "message"}} - Shows appropriate error modal based on error type (license vs. credits)
- Graceful fallback for unexpected error structures
[1.8.2] - 2025-12-01
Changed
Code Quality Improvements
- JavaScript code cleanup: Reduced tutor_ia_chat.js from 1387 to 1330 lines by removing redundant comments and consolidating documentation
- Improved JSDoc: Added proper class and constructor documentation with @class and @param tags
- Comment standardization: Replaced verbose inline comments with concise, meaningful ones following Moodle coding standards
- Removed unused variable: Eliminated
highlightedRangevariable that was no longer used
CSS Cleanup
- Removed unused styles: Eliminated
.tutor-ia-text-highlightCSS rules (19 l
2.0.6 (2026060108)
2.0.6
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2026060108
Version release name: 2.0.6
Maturity: Stable
Supported Moodle versions: 4.4, 4.5, 5.0, 5.1, 5.2
Repository URL (Git): https://github.com/datacurso/moodle-local_dttutor
Repository branch:
Repository tag: 2.0.6
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
Changelog
All notable changes to the Tutor-IA plugin (local_dttutor) will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[2.0.4] - 2026-02-02
Changed
Individual Chat History Implementation
- User-specific sessions: Chat sessions are now tied to individual users instead of being course-wide.
- Session cache keys: Changed from
session_{courseid}tosession_{courseid}_{userid}for proper isolation. - API enhancement: Added
user_idparameter to/chat/startAPI endpoint. - Data privacy: Each user now has their own private chat history that cannot be accessed by other users.
- Breaking change: Sessions created before this update will be invalidated and new sessions will be created per user.
- Files modified:
classes/httpclient/tutoria_api.php- Enhancedstart_session()with userid parameter.classes/external/create_chat_message.php- Pass current user ID to session creation.classes/external/get_chat_history.php- Pass current user ID to history retrieval.
Security Improvements
- Session isolation: Users can only access their own chat sessions.
- Privacy enhancement: Chat history is now private per user, not shared at course level.
[2.0.3] - 2026-02-02
Added
Course Synchronization Validation
- Validation before enabling tutor: Users cannot enable the AI Tutor until course content synchronization is completed
- Frontend validation: Toggle switch is disabled when
indexing_status !== 'completed' - Backend validation:
save_course_configweb service throwsmoodle_exceptionif enabling tutor without completed synchronization - User feedback: Alert message shown explaining synchronization requirement
- Files modified:
classes/external/save_course_config.php- Added validation logicmanage.php- Addedcan_enable_tutortemplate variabletemplates/manage_course.mustache- Added disabled state and info alertlang/en/local_dttutor.php- Added new error string
Technical Details
- Validation checks
indexing_status === 'completed'before allowingindexing_enabled = 1 - Exception type:
moodle_exception('tutor_enable_requires_indexing', 'local_dttutor') - UI state: Toggle disabled with
{{^can_enable_tutor}}disabled{{/can_enable_tutor}}
[2.0.3] - 2026-02-02 (Continued)
Changed
API Compatibility Improvements - Metadata String Conversion
- Metadata string conversion: All metadata values are now converted to strings for API compatibility
- Boolean to string conversion: Boolean values (
off_topic_detection_enabled) are now sent as "true"/"false" strings instead of native booleans - Type safety: Added
array_map()function to ensure all metadata values are strings before sending to API - User ID conversion:
useridmetadata is now explicitly cast to string - Module context support: Added optional
cmidparameter to session management for module-specific chat contexts - Session cache enhancement: Session cache keys now include
cmidwhen in module context (session_{courseid}_{cmid}) - API request structure:
cmidis sent asmodule_idstring in API requests when present - Files modified:
classes/external/create_chat_message.php- Added metadata string conversion and cmid supportclasses/httpclient/tutoria_api.php- Enhanced session caching with cmid parameter
Technical Details
Metadata String Conversion:
- Previous: Mixed types (bool, int, string) sent directly
- Now: All values converted to strings using
array_map()before API call - Boolean conversion:
value ? 'true' : 'false' - Numeric conversion:
(string)$value
Session Caching Enhancement:
- Previous cache key:
session_{courseid} - New cache key:
session_{courseid}_{cmid}(when cmid present) - Allows separate chat sessions for course-level and module-level contexts
- Improves context isolation and relevance of AI responses
API Compatibility:
userid' sent as string instead of integercmid' sent asmodule_idstring in API requestsoff_topic_detection_enabled' sent as "true"/"false" instead of boolean- All other metadata values ' explicitly converted to strings
Version:
- Plugin version:
2026012900 - Release:
2.0.3 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.2:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Existing sessions will be regenerated with new cache key format
- All functionality remains backward compatible
[2.0.2] - 2026-01-23
Changed
Code Cleanup - Removed Redundant Permission Checks
- Removed redundant capability checks: Eliminated unnecessary
require_capability('moodle/course:view')checks from external web services - Reason: The
local/dttutor:usecapability check already validates course access in course context - Impact: Cleaner, more maintainable code without functional changes
- Files modified:
classes/external/create_chat_message.php- Removed redundantmoodle/course:viewcheckclasses/external/delete_chat_session.php- Removed redundantmoodle/course:viewcheckclasses/external/get_chat_history.php- Removed redundantmoodle/course:viewcheckclasses/external/get_course_materials.php- Removed redundantmoodle/course:viewcheck
Technical Details
Permission Check Logic:
- Previous:
require_capability('local/dttutor:use', $context)+require_capability('moodle/course:view', $context) - Now:
require_capability('local/dttutor:use', $context)only - Rationale: Having
local/dttutor:usecapability in a course context already implies course access
Security:
- No security reduction - permission validation remains robust
- All web services still validate:
- User authentication via
require_login() - Context validation via
self::validate_context() - Plugin permission via
require_capability('local/dttutor:use')
- User authentication via
Version:
- Plugin version:
2026012300 - Release:
2.0.2 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.1:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Code refactoring only - no functional changes
[2.0.1] - 2026-01-22
Fixed
Security Vulnerability - Missing Authentication and Context Validation
- Critical fix: Added missing security validations in
create_chat_messageweb service - Issue: Users were receiving permission denied errors because security checks were incomplete
- Root cause: The web service was missing three critical validation steps:
require_login()- User authentication checkself::validate_context($context)- Course context validationrequire_capability('local/dttutor:use', $context)- Plugin permission check
- Solution: Added all three missing validations following Moodle's external service security checklist
- Impact: Fixes "Lo sentimos, pero no tiene los permisos para hacer esto (Ver cursos sin participación)" error
- Files modified:
classes/external/create_chat_message.php
Changed
Permission System - Extended to All Authenticated Users
- Extended access: Added 'user' archetype to
local/dttutor:usecapability - Reason: Allow all authenticated users to use the tutor, not just enrolled students
- Previous behavior: Only students, teachers, editing teachers, and managers could use the chat
- New behavior: All authenticated users with
moodle/course:viewpermission can use the chat - Automatic upgrade: Added upgrade script (
db/upgrade.php) to automatically assign capability to 'user' role when updating from v2.0.0 - Files modified:
db/access.php- Added 'user' archetype to capability definitiondb/upgrade.php- Added version 2026012201 upgrade step to assign capability
Technical Details
Security Validation Order (now properly implemented):
- Parameter validation via
self::validate_parameters() - Authentication check via
require_login() - Plugin state check via
get_config() - Webservice configuration check
- Course context validation via
self::validate_context() - Plugin capability check via
require_capability('local/dttutor:use') - Course view capability check via
require_capability('moodle/course:view')
Permission Archetypes (updated):
user' CAP_ALLOW (NEW - authenticated users)student' CAP_ALLOWteacher' CAP_ALLOWeditingteacher' CAP_ALLOWmanager' CAP_ALLOW
Upgrade Script:
- Version check:
if ($oldversion < 2026012201) - Uses
get_archetype_roles()to find all 'user' roles - Uses
assign_capability()to grant permission at system context - Checks for existing capability to avoid duplicate assignments
- Idempotent - safe to run multiple times
Migration Notes
Upgrading from v2.0.0:
- Replace plugin files with new version
- Access your Moodle site
- Click "Update database" when prompted
- Upgrade script will automatically assign capability to 'user' role
- No manual configuration required
New Installations:
- 'user' archetype automatically included in capability definition
- No additional setup needed
[2.0.0] - 2025-12-30
Changed
User Interface Terminology
- Indexing ' Synchronization: Changed all user-facing terminology from "indexing/indexed" to "synchronization/synchronized" across all 7 supported languages
- Language updates: Updated 19 strings per language - 7 languages = 133 total string changes
- Terminology mapping:
- "Course Indexing" ' "Course Synchronization"
- "Indexed" ' "Synchronized"
- "Indexing in progress" ' "Synchronization in progress"
- "Start Indexing" ' "Start Synchronization"
- "Re-index Course" ' "Re-synchronize Course"
- "Last indexed" ' "Last synchronized"
- "Indexing failed" ' "Synchronization failed"
- "Not indexed" ' "Not synchronized"
- Code preservation: Internal code (variable names, functions, classes) maintains "indexing" terminology to avoid breaking changes
- All languages updated:
- English: Indexing ' Synchronization
- Spanish: Indexación ' Sincronización
- German: Indexierung ' Synchronisierung
- French: Indexation ' Synchronisation
- Portuguese: Indexação ' Sincronização
- Russian: Индексация ' Синхронизация
- Indonesian: Pengindeksan ' Sinkronisasi
Removed
Markdown Formatting Feature
- Removed markdown rendering: Eliminated markdown-to-HTML conversion feature that was causing display issues
- Simplified message display: Chat messages now display as plain text without formatting
- Code cleanup:
- Removed
markdownToHtml()function fromtutor_ia_chat.js - Reverted
appendToAIMessage()to usetextContentinstead ofinnerHTML - Reverted
addMessage()to use.text()for all messages - Reverted
createMessageElement()to use.text()for history messages - Removed CSS styles for markdown formatting (lists, bold, italic)
- Removed
- Reason: Markdown rendering was not working reliably and causing inconsistent message display
Debug Mode
- Removed debug mode feature: Completely removed debug mode and force reindex functionality
- Removed from settings: Deleted debug mode checkbox from admin settings page
- Removed from UI: Deleted debug controls section from chat drawer template
- Removed from hook: Cleaned up debug-related variables from chat_hook.php
- Language cleanup: Removed debug-related strings from all 7 language files
- Removed:
debug_mode,debug_mode_desc,debug_force_reindex
- Removed:
Technical Details
Terminology Change Impact:
- User-facing strings only (no code changes)
- No database migrations required
- No breaking changes to API or functionality
- Maintains backwards compatibility
Files Modified:
lang/en/local_dttutor.php(English)lang/es/local_dttutor.php(Spanish)lang/de/local_dttutor.php(German)lang/fr/local_dttutor.php(French)lang/pt/local_dttutor.php(Portuguese)lang/ru/local_dttutor.php(Russian)lang/id/local_dttutor.php(Indonesian)amd/src/tutor_ia_chat.js(Markdown removal)styles.css(Markdown styles removal)settings.php(Debug mode removal)templates/tutor_ia_drawer.mustache(Debug controls removal)classes/hook/chat_hook.php(Debug variables removal)
[1.9.0] - 2025-12-01
Added
Debug Mode Feature
- Debug mode setting: New admin setting to enable debug options in the chat interface
- Force reindex checkbox: When debug mode is enabled, shows a checkbox to force context reindexing (only visible to site administrators)
- Admin-only access: Debug controls require both debug mode enabled AND site:config capability
- Metadata transmission: Checkbox state sent as
force_reindex=truein message metadata - Visual design: Debug controls styled with warning colors (yellow background) to clearly indicate debug functionality
- Language support: Debug strings added to all 7 supported languages
Error Handling Improvements
- Stream error detection: Enhanced SSE stream error handling to detect and parse JSON error responses
- License error modal: User-friendly modal for license validation errors with clear explanation
- Insufficient credits modal: User-friendly modal for insufficient AI tokens/credits errors
- Language support: Added error strings for license and credits errors in all 7 languages
Technical Details
Debug Mode:
- Admin setting:
local_dttutor/debug_mode(default: disabled) - Template variables:
debug_modeandis_debug_adminpassed to drawer template - Capability check: Requires
moodle/site:configcapability to see debug controls - Visibility: Debug checkbox only shown when BOTH conditions are met (debug_mode=true AND user is admin)
- JavaScript: Checks checkbox state and includes in metadata when checked
- CSS: Warning-styled debug controls with yellow background and amber border
Error Handling:
- Enhanced EventSource error listener to parse JSON error data from SSE stream
- Added
handleStreamError()method to detect and categorize API errors - Detects errors with structure:
{detail: {status: "error", detail: "message"}} - Shows appropriate error modal based on error type (license vs. credits)
- Graceful fallback for unexpected error structures
[1.8.2] - 2025-12-01
Changed
Code Quality Improvements
- JavaScript code cleanup: Reduced tutor_ia_chat.js from 1387 to 1330 lines by removing redundant comments and consolidating documentation
- Improved JSDoc: Added proper class and constructor documentation with @class and @param tags
- Comment standardization: Replaced verbose inline comments with concise, meaningful ones following Moodle coding standards
- Removed unused variable: Eliminated
highlightedRangevariable that was no longer used
CSS Cleanup
- Removed unused styles: Eliminated
.tutor-ia-text-highlightCSS rules (19 l
2.0.5 (2026050600)
2.0.5
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2026050600
Version release name: 2.0.5
Maturity: Stable
Supported Moodle versions: 4.4, 4.5, 5.0, 5.1, 5.2
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch:
Repository tag: 2.0.5
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
Changelog
All notable changes to the Tutor-IA plugin (local_dttutor) will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[2.0.4] - 2026-02-02
Changed
Individual Chat History Implementation
- User-specific sessions: Chat sessions are now tied to individual users instead of being course-wide.
- Session cache keys: Changed from
session_{courseid}tosession_{courseid}_{userid}for proper isolation. - API enhancement: Added
user_idparameter to/chat/startAPI endpoint. - Data privacy: Each user now has their own private chat history that cannot be accessed by other users.
- Breaking change: Sessions created before this update will be invalidated and new sessions will be created per user.
- Files modified:
classes/httpclient/tutoria_api.php- Enhancedstart_session()with userid parameter.classes/external/create_chat_message.php- Pass current user ID to session creation.classes/external/get_chat_history.php- Pass current user ID to history retrieval.
Security Improvements
- Session isolation: Users can only access their own chat sessions.
- Privacy enhancement: Chat history is now private per user, not shared at course level.
[2.0.3] - 2026-02-02
Added
Course Synchronization Validation
- Validation before enabling tutor: Users cannot enable the AI Tutor until course content synchronization is completed
- Frontend validation: Toggle switch is disabled when
indexing_status !== 'completed' - Backend validation:
save_course_configweb service throwsmoodle_exceptionif enabling tutor without completed synchronization - User feedback: Alert message shown explaining synchronization requirement
- Files modified:
classes/external/save_course_config.php- Added validation logicmanage.php- Addedcan_enable_tutortemplate variabletemplates/manage_course.mustache- Added disabled state and info alertlang/en/local_dttutor.php- Added new error string
Technical Details
- Validation checks
indexing_status === 'completed'before allowingindexing_enabled = 1 - Exception type:
moodle_exception('tutor_enable_requires_indexing', 'local_dttutor') - UI state: Toggle disabled with
{{^can_enable_tutor}}disabled{{/can_enable_tutor}}
[2.0.3] - 2026-02-02 (Continued)
Changed
API Compatibility Improvements - Metadata String Conversion
- Metadata string conversion: All metadata values are now converted to strings for API compatibility
- Boolean to string conversion: Boolean values (
off_topic_detection_enabled) are now sent as "true"/"false" strings instead of native booleans - Type safety: Added
array_map()function to ensure all metadata values are strings before sending to API - User ID conversion:
useridmetadata is now explicitly cast to string - Module context support: Added optional
cmidparameter to session management for module-specific chat contexts - Session cache enhancement: Session cache keys now include
cmidwhen in module context (session_{courseid}_{cmid}) - API request structure:
cmidis sent asmodule_idstring in API requests when present - Files modified:
classes/external/create_chat_message.php- Added metadata string conversion and cmid supportclasses/httpclient/tutoria_api.php- Enhanced session caching with cmid parameter
Technical Details
Metadata String Conversion:
- Previous: Mixed types (bool, int, string) sent directly
- Now: All values converted to strings using
array_map()before API call - Boolean conversion:
value ? 'true' : 'false' - Numeric conversion:
(string)$value
Session Caching Enhancement:
- Previous cache key:
session_{courseid} - New cache key:
session_{courseid}_{cmid}(when cmid present) - Allows separate chat sessions for course-level and module-level contexts
- Improves context isolation and relevance of AI responses
API Compatibility:
userid' sent as string instead of integercmid' sent asmodule_idstring in API requestsoff_topic_detection_enabled' sent as "true"/"false" instead of boolean- All other metadata values ' explicitly converted to strings
Version:
- Plugin version:
2026012900 - Release:
2.0.3 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.2:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Existing sessions will be regenerated with new cache key format
- All functionality remains backward compatible
[2.0.2] - 2026-01-23
Changed
Code Cleanup - Removed Redundant Permission Checks
- Removed redundant capability checks: Eliminated unnecessary
require_capability('moodle/course:view')checks from external web services - Reason: The
local/dttutor:usecapability check already validates course access in course context - Impact: Cleaner, more maintainable code without functional changes
- Files modified:
classes/external/create_chat_message.php- Removed redundantmoodle/course:viewcheckclasses/external/delete_chat_session.php- Removed redundantmoodle/course:viewcheckclasses/external/get_chat_history.php- Removed redundantmoodle/course:viewcheckclasses/external/get_course_materials.php- Removed redundantmoodle/course:viewcheck
Technical Details
Permission Check Logic:
- Previous:
require_capability('local/dttutor:use', $context)+require_capability('moodle/course:view', $context) - Now:
require_capability('local/dttutor:use', $context)only - Rationale: Having
local/dttutor:usecapability in a course context already implies course access
Security:
- No security reduction - permission validation remains robust
- All web services still validate:
- User authentication via
require_login() - Context validation via
self::validate_context() - Plugin permission via
require_capability('local/dttutor:use')
- User authentication via
Version:
- Plugin version:
2026012300 - Release:
2.0.2 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.1:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Code refactoring only - no functional changes
[2.0.1] - 2026-01-22
Fixed
Security Vulnerability - Missing Authentication and Context Validation
- Critical fix: Added missing security validations in
create_chat_messageweb service - Issue: Users were receiving permission denied errors because security checks were incomplete
- Root cause: The web service was missing three critical validation steps:
require_login()- User authentication checkself::validate_context($context)- Course context validationrequire_capability('local/dttutor:use', $context)- Plugin permission check
- Solution: Added all three missing validations following Moodle's external service security checklist
- Impact: Fixes "Lo sentimos, pero no tiene los permisos para hacer esto (Ver cursos sin participación)" error
- Files modified:
classes/external/create_chat_message.php
Changed
Permission System - Extended to All Authenticated Users
- Extended access: Added 'user' archetype to
local/dttutor:usecapability - Reason: Allow all authenticated users to use the tutor, not just enrolled students
- Previous behavior: Only students, teachers, editing teachers, and managers could use the chat
- New behavior: All authenticated users with
moodle/course:viewpermission can use the chat - Automatic upgrade: Added upgrade script (
db/upgrade.php) to automatically assign capability to 'user' role when updating from v2.0.0 - Files modified:
db/access.php- Added 'user' archetype to capability definitiondb/upgrade.php- Added version 2026012201 upgrade step to assign capability
Technical Details
Security Validation Order (now properly implemented):
- Parameter validation via
self::validate_parameters() - Authentication check via
require_login() - Plugin state check via
get_config() - Webservice configuration check
- Course context validation via
self::validate_context() - Plugin capability check via
require_capability('local/dttutor:use') - Course view capability check via
require_capability('moodle/course:view')
Permission Archetypes (updated):
user' CAP_ALLOW (NEW - authenticated users)student' CAP_ALLOWteacher' CAP_ALLOWeditingteacher' CAP_ALLOWmanager' CAP_ALLOW
Upgrade Script:
- Version check:
if ($oldversion < 2026012201) - Uses
get_archetype_roles()to find all 'user' roles - Uses
assign_capability()to grant permission at system context - Checks for existing capability to avoid duplicate assignments
- Idempotent - safe to run multiple times
Migration Notes
Upgrading from v2.0.0:
- Replace plugin files with new version
- Access your Moodle site
- Click "Update database" when prompted
- Upgrade script will automatically assign capability to 'user' role
- No manual configuration required
New Installations:
- 'user' archetype automatically included in capability definition
- No additional setup needed
[2.0.0] - 2025-12-30
Changed
User Interface Terminology
- Indexing ' Synchronization: Changed all user-facing terminology from "indexing/indexed" to "synchronization/synchronized" across all 7 supported languages
- Language updates: Updated 19 strings per language - 7 languages = 133 total string changes
- Terminology mapping:
- "Course Indexing" ' "Course Synchronization"
- "Indexed" ' "Synchronized"
- "Indexing in progress" ' "Synchronization in progress"
- "Start Indexing" ' "Start Synchronization"
- "Re-index Course" ' "Re-synchronize Course"
- "Last indexed" ' "Last synchronized"
- "Indexing failed" ' "Synchronization failed"
- "Not indexed" ' "Not synchronized"
- Code preservation: Internal code (variable names, functions, classes) maintains "indexing" terminology to avoid breaking changes
- All languages updated:
- English: Indexing ' Synchronization
- Spanish: Indexación ' Sincronización
- German: Indexierung ' Synchronisierung
- French: Indexation ' Synchronisation
- Portuguese: Indexação ' Sincronização
- Russian: Индексация ' Синхронизация
- Indonesian: Pengindeksan ' Sinkronisasi
Removed
Markdown Formatting Feature
- Removed markdown rendering: Eliminated markdown-to-HTML conversion feature that was causing display issues
- Simplified message display: Chat messages now display as plain text without formatting
- Code cleanup:
- Removed
markdownToHtml()function fromtutor_ia_chat.js - Reverted
appendToAIMessage()to usetextContentinstead ofinnerHTML - Reverted
addMessage()to use.text()for all messages - Reverted
createMessageElement()to use.text()for history messages - Removed CSS styles for markdown formatting (lists, bold, italic)
- Removed
- Reason: Markdown rendering was not working reliably and causing inconsistent message display
Debug Mode
- Removed debug mode feature: Completely removed debug mode and force reindex functionality
- Removed from settings: Deleted debug mode checkbox from admin settings page
- Removed from UI: Deleted debug controls section from chat drawer template
- Removed from hook: Cleaned up debug-related variables from chat_hook.php
- Language cleanup: Removed debug-related strings from all 7 language files
- Removed:
debug_mode,debug_mode_desc,debug_force_reindex
- Removed:
Technical Details
Terminology Change Impact:
- User-facing strings only (no code changes)
- No database migrations required
- No breaking changes to API or functionality
- Maintains backwards compatibility
Files Modified:
lang/en/local_dttutor.php(English)lang/es/local_dttutor.php(Spanish)lang/de/local_dttutor.php(German)lang/fr/local_dttutor.php(French)lang/pt/local_dttutor.php(Portuguese)lang/ru/local_dttutor.php(Russian)lang/id/local_dttutor.php(Indonesian)amd/src/tutor_ia_chat.js(Markdown removal)styles.css(Markdown styles removal)settings.php(Debug mode removal)templates/tutor_ia_drawer.mustache(Debug controls removal)classes/hook/chat_hook.php(Debug variables removal)
[1.9.0] - 2025-12-01
Added
Debug Mode Feature
- Debug mode setting: New admin setting to enable debug options in the chat interface
- Force reindex checkbox: When debug mode is enabled, shows a checkbox to force context reindexing (only visible to site administrators)
- Admin-only access: Debug controls require both debug mode enabled AND site:config capability
- Metadata transmission: Checkbox state sent as
force_reindex=truein message metadata - Visual design: Debug controls styled with warning colors (yellow background) to clearly indicate debug functionality
- Language support: Debug strings added to all 7 supported languages
Error Handling Improvements
- Stream error detection: Enhanced SSE stream error handling to detect and parse JSON error responses
- License error modal: User-friendly modal for license validation errors with clear explanation
- Insufficient credits modal: User-friendly modal for insufficient AI tokens/credits errors
- Language support: Added error strings for license and credits errors in all 7 languages
Technical Details
Debug Mode:
- Admin setting:
local_dttutor/debug_mode(default: disabled) - Template variables:
debug_modeandis_debug_adminpassed to drawer template - Capability check: Requires
moodle/site:configcapability to see debug controls - Visibility: Debug checkbox only shown when BOTH conditions are met (debug_mode=true AND user is admin)
- JavaScript: Checks checkbox state and includes in metadata when checked
- CSS: Warning-styled debug controls with yellow background and amber border
Error Handling:
- Enhanced EventSource error listener to parse JSON error data from SSE stream
- Added
handleStreamError()method to detect and categorize API errors - Detects errors with structure:
{detail: {status: "error", detail: "message"}} - Shows appropriate error modal based on error type (license vs. credits)
- Graceful fallback for unexpected error structures
[1.8.2] - 2025-12-01
Changed
Code Quality Improvements
- JavaScript code cleanup: Reduced tutor_ia_chat.js from 1387 to 1330 lines by removing redundant comments and consolidating documentation
- Improved JSDoc: Added proper class and constructor documentation with @class and @param tags
- Comment standardization: Replaced verbose inline comments with concise, meaningful ones following Moodle coding standards
- Removed unused variable: Eliminated
highlightedRangevariable that was no longer used
CSS Cleanup
- Removed unused styles: Eliminated
.tutor-ia-text-highlightCSS rules (19 l
2.0.4 (2026020201)
2.0.4
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2026020201
Version release name: 2.0.4
Maturity: Stable
Supported Moodle versions: 4.4, 4.5, 5.0, 5.1
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch:
Repository tag: v2.0.4
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
Changelog
All notable changes to the Tutor-IA plugin (local_dttutor) will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[2.0.4] - 2026-02-02
Changed
Individual Chat History Implementation
- User-specific sessions: Chat sessions are now tied to individual users instead of being course-wide.
- Session cache keys: Changed from
session_{courseid}tosession_{courseid}_{userid}for proper isolation. - API enhancement: Added
user_idparameter to/chat/startAPI endpoint. - Data privacy: Each user now has their own private chat history that cannot be accessed by other users.
- Breaking change: Sessions created before this update will be invalidated and new sessions will be created per user.
- Files modified:
classes/httpclient/tutoria_api.php- Enhancedstart_session()with userid parameter.classes/external/create_chat_message.php- Pass current user ID to session creation.classes/external/get_chat_history.php- Pass current user ID to history retrieval.
Security Improvements
- Session isolation: Users can only access their own chat sessions.
- Privacy enhancement: Chat history is now private per user, not shared at course level.
[2.0.3] - 2026-02-02
Added
Course Synchronization Validation
- Validation before enabling tutor: Users cannot enable the AI Tutor until course content synchronization is completed
- Frontend validation: Toggle switch is disabled when
indexing_status !== 'completed' - Backend validation:
save_course_configweb service throwsmoodle_exceptionif enabling tutor without completed synchronization - User feedback: Alert message shown explaining synchronization requirement
- Files modified:
classes/external/save_course_config.php- Added validation logicmanage.php- Addedcan_enable_tutortemplate variabletemplates/manage_course.mustache- Added disabled state and info alertlang/en/local_dttutor.php- Added new error string
Technical Details
- Validation checks
indexing_status === 'completed'before allowingindexing_enabled = 1 - Exception type:
moodle_exception('tutor_enable_requires_indexing', 'local_dttutor') - UI state: Toggle disabled with
{{^can_enable_tutor}}disabled{{/can_enable_tutor}}
[2.0.3] - 2026-02-02 (Continued)
Changed
API Compatibility Improvements - Metadata String Conversion
- Metadata string conversion: All metadata values are now converted to strings for API compatibility
- Boolean to string conversion: Boolean values (
off_topic_detection_enabled) are now sent as "true"/"false" strings instead of native booleans - Type safety: Added
array_map()function to ensure all metadata values are strings before sending to API - User ID conversion:
useridmetadata is now explicitly cast to string - Module context support: Added optional
cmidparameter to session management for module-specific chat contexts - Session cache enhancement: Session cache keys now include
cmidwhen in module context (session_{courseid}_{cmid}) - API request structure:
cmidis sent asmodule_idstring in API requests when present - Files modified:
classes/external/create_chat_message.php- Added metadata string conversion and cmid supportclasses/httpclient/tutoria_api.php- Enhanced session caching with cmid parameter
Technical Details
Metadata String Conversion:
- Previous: Mixed types (bool, int, string) sent directly
- Now: All values converted to strings using
array_map()before API call - Boolean conversion:
value ? 'true' : 'false' - Numeric conversion:
(string)$value
Session Caching Enhancement:
- Previous cache key:
session_{courseid} - New cache key:
session_{courseid}_{cmid}(when cmid present) - Allows separate chat sessions for course-level and module-level contexts
- Improves context isolation and relevance of AI responses
API Compatibility:
userid' sent as string instead of integercmid' sent asmodule_idstring in API requestsoff_topic_detection_enabled' sent as "true"/"false" instead of boolean- All other metadata values ' explicitly converted to strings
Version:
- Plugin version:
2026012900 - Release:
2.0.3 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.2:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Existing sessions will be regenerated with new cache key format
- All functionality remains backward compatible
[2.0.2] - 2026-01-23
Changed
Code Cleanup - Removed Redundant Permission Checks
- Removed redundant capability checks: Eliminated unnecessary
require_capability('moodle/course:view')checks from external web services - Reason: The
local/dttutor:usecapability check already validates course access in course context - Impact: Cleaner, more maintainable code without functional changes
- Files modified:
classes/external/create_chat_message.php- Removed redundantmoodle/course:viewcheckclasses/external/delete_chat_session.php- Removed redundantmoodle/course:viewcheckclasses/external/get_chat_history.php- Removed redundantmoodle/course:viewcheckclasses/external/get_course_materials.php- Removed redundantmoodle/course:viewcheck
Technical Details
Permission Check Logic:
- Previous:
require_capability('local/dttutor:use', $context)+require_capability('moodle/course:view', $context) - Now:
require_capability('local/dttutor:use', $context)only - Rationale: Having
local/dttutor:usecapability in a course context already implies course access
Security:
- No security reduction - permission validation remains robust
- All web services still validate:
- User authentication via
require_login() - Context validation via
self::validate_context() - Plugin permission via
require_capability('local/dttutor:use')
- User authentication via
Version:
- Plugin version:
2026012300 - Release:
2.0.2 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.1:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Code refactoring only - no functional changes
[2.0.1] - 2026-01-22
Fixed
Security Vulnerability - Missing Authentication and Context Validation
- Critical fix: Added missing security validations in
create_chat_messageweb service - Issue: Users were receiving permission denied errors because security checks were incomplete
- Root cause: The web service was missing three critical validation steps:
require_login()- User authentication checkself::validate_context($context)- Course context validationrequire_capability('local/dttutor:use', $context)- Plugin permission check
- Solution: Added all three missing validations following Moodle's external service security checklist
- Impact: Fixes "Lo sentimos, pero no tiene los permisos para hacer esto (Ver cursos sin participación)" error
- Files modified:
classes/external/create_chat_message.php
Changed
Permission System - Extended to All Authenticated Users
- Extended access: Added 'user' archetype to
local/dttutor:usecapability - Reason: Allow all authenticated users to use the tutor, not just enrolled students
- Previous behavior: Only students, teachers, editing teachers, and managers could use the chat
- New behavior: All authenticated users with
moodle/course:viewpermission can use the chat - Automatic upgrade: Added upgrade script (
db/upgrade.php) to automatically assign capability to 'user' role when updating from v2.0.0 - Files modified:
db/access.php- Added 'user' archetype to capability definitiondb/upgrade.php- Added version 2026012201 upgrade step to assign capability
Technical Details
Security Validation Order (now properly implemented):
- Parameter validation via
self::validate_parameters() - Authentication check via
require_login() - Plugin state check via
get_config() - Webservice configuration check
- Course context validation via
self::validate_context() - Plugin capability check via
require_capability('local/dttutor:use') - Course view capability check via
require_capability('moodle/course:view')
Permission Archetypes (updated):
user' CAP_ALLOW (NEW - authenticated users)student' CAP_ALLOWteacher' CAP_ALLOWeditingteacher' CAP_ALLOWmanager' CAP_ALLOW
Upgrade Script:
- Version check:
if ($oldversion < 2026012201) - Uses
get_archetype_roles()to find all 'user' roles - Uses
assign_capability()to grant permission at system context - Checks for existing capability to avoid duplicate assignments
- Idempotent - safe to run multiple times
Migration Notes
Upgrading from v2.0.0:
- Replace plugin files with new version
- Access your Moodle site
- Click "Update database" when prompted
- Upgrade script will automatically assign capability to 'user' role
- No manual configuration required
New Installations:
- 'user' archetype automatically included in capability definition
- No additional setup needed
[2.0.0] - 2025-12-30
Changed
User Interface Terminology
- Indexing ' Synchronization: Changed all user-facing terminology from "indexing/indexed" to "synchronization/synchronized" across all 7 supported languages
- Language updates: Updated 19 strings per language - 7 languages = 133 total string changes
- Terminology mapping:
- "Course Indexing" ' "Course Synchronization"
- "Indexed" ' "Synchronized"
- "Indexing in progress" ' "Synchronization in progress"
- "Start Indexing" ' "Start Synchronization"
- "Re-index Course" ' "Re-synchronize Course"
- "Last indexed" ' "Last synchronized"
- "Indexing failed" ' "Synchronization failed"
- "Not indexed" ' "Not synchronized"
- Code preservation: Internal code (variable names, functions, classes) maintains "indexing" terminology to avoid breaking changes
- All languages updated:
- English: Indexing ' Synchronization
- Spanish: Indexación ' Sincronización
- German: Indexierung ' Synchronisierung
- French: Indexation ' Synchronisation
- Portuguese: Indexação ' Sincronização
- Russian: Индексация ' Синхронизация
- Indonesian: Pengindeksan ' Sinkronisasi
Removed
Markdown Formatting Feature
- Removed markdown rendering: Eliminated markdown-to-HTML conversion feature that was causing display issues
- Simplified message display: Chat messages now display as plain text without formatting
- Code cleanup:
- Removed
markdownToHtml()function fromtutor_ia_chat.js - Reverted
appendToAIMessage()to usetextContentinstead ofinnerHTML - Reverted
addMessage()to use.text()for all messages - Reverted
createMessageElement()to use.text()for history messages - Removed CSS styles for markdown formatting (lists, bold, italic)
- Removed
- Reason: Markdown rendering was not working reliably and causing inconsistent message display
Debug Mode
- Removed debug mode feature: Completely removed debug mode and force reindex functionality
- Removed from settings: Deleted debug mode checkbox from admin settings page
- Removed from UI: Deleted debug controls section from chat drawer template
- Removed from hook: Cleaned up debug-related variables from chat_hook.php
- Language cleanup: Removed debug-related strings from all 7 language files
- Removed:
debug_mode,debug_mode_desc,debug_force_reindex
- Removed:
Technical Details
Terminology Change Impact:
- User-facing strings only (no code changes)
- No database migrations required
- No breaking changes to API or functionality
- Maintains backwards compatibility
Files Modified:
lang/en/local_dttutor.php(English)lang/es/local_dttutor.php(Spanish)lang/de/local_dttutor.php(German)lang/fr/local_dttutor.php(French)lang/pt/local_dttutor.php(Portuguese)lang/ru/local_dttutor.php(Russian)lang/id/local_dttutor.php(Indonesian)amd/src/tutor_ia_chat.js(Markdown removal)styles.css(Markdown styles removal)settings.php(Debug mode removal)templates/tutor_ia_drawer.mustache(Debug controls removal)classes/hook/chat_hook.php(Debug variables removal)
[1.9.0] - 2025-12-01
Added
Debug Mode Feature
- Debug mode setting: New admin setting to enable debug options in the chat interface
- Force reindex checkbox: When debug mode is enabled, shows a checkbox to force context reindexing (only visible to site administrators)
- Admin-only access: Debug controls require both debug mode enabled AND site:config capability
- Metadata transmission: Checkbox state sent as
force_reindex=truein message metadata - Visual design: Debug controls styled with warning colors (yellow background) to clearly indicate debug functionality
- Language support: Debug strings added to all 7 supported languages
Error Handling Improvements
- Stream error detection: Enhanced SSE stream error handling to detect and parse JSON error responses
- License error modal: User-friendly modal for license validation errors with clear explanation
- Insufficient credits modal: User-friendly modal for insufficient AI tokens/credits errors
- Language support: Added error strings for license and credits errors in all 7 languages
Technical Details
Debug Mode:
- Admin setting:
local_dttutor/debug_mode(default: disabled) - Template variables:
debug_modeandis_debug_adminpassed to drawer template - Capability check: Requires
moodle/site:configcapability to see debug controls - Visibility: Debug checkbox only shown when BOTH conditions are met (debug_mode=true AND user is admin)
- JavaScript: Checks checkbox state and includes in metadata when checked
- CSS: Warning-styled debug controls with yellow background and amber border
Error Handling:
- Enhanced EventSource error listener to parse JSON error data from SSE stream
- Added
handleStreamError()method to detect and categorize API errors - Detects errors with structure:
{detail: {status: "error", detail: "message"}} - Shows appropriate error modal based on error type (license vs. credits)
- Graceful fallback for unexpected error structures
[1.8.2] - 2025-12-01
Changed
Code Quality Improvements
- JavaScript code cleanup: Reduced tutor_ia_chat.js from 1387 to 1330 lines by removing redundant comments and consolidating documentation
- Improved JSDoc: Added proper class and constructor documentation with @class and @param tags
- Comment standardization: Replaced verbose inline comments with concise, meaningful ones following Moodle coding standards
- Removed unused variable: Eliminated
highlightedRangevariable that was no longer used
CSS Cleanup
- Removed unused styles: Eliminated
.tutor-ia-text-highlightCSS rules (19 l
2.0.2 (2026012300)
2.0.2
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2026012300
Version release name: 2.0.2
Maturity: Stable
Supported Moodle versions: 4.5, 5.0, 5.1
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch:
Repository tag: v2.0.2
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
Changelog
All notable changes to the Tutor-IA plugin (local_dttutor) will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[Unreleased]
[2.0.2] - 2026-01-23
Changed
Code Cleanup - Removed Redundant Permission Checks
- Removed redundant capability checks: Eliminated unnecessary
require_capability('moodle/course:view')checks from external web services - Reason: The
local/dttutor:usecapability check already validates course access in course context - Impact: Cleaner, more maintainable code without functional changes
- Files modified:
classes/external/create_chat_message.php- Removed redundantmoodle/course:viewcheckclasses/external/delete_chat_session.php- Removed redundantmoodle/course:viewcheckclasses/external/get_chat_history.php- Removed redundantmoodle/course:viewcheckclasses/external/get_course_materials.php- Removed redundantmoodle/course:viewcheck
Technical Details
Permission Check Logic:
- Previous:
require_capability('local/dttutor:use', $context)+require_capability('moodle/course:view', $context) - Now:
require_capability('local/dttutor:use', $context)only - Rationale: Having
local/dttutor:usecapability in a course context already implies course access
Security:
- No security reduction - permission validation remains robust
- All web services still validate:
- User authentication via
require_login() - Context validation via
self::validate_context() - Plugin permission via
require_capability('local/dttutor:use')
- User authentication via
Version:
- Plugin version:
2026012300 - Release:
2.0.2 - Maturity:
MATURITY_STABLE
Migration Notes
Upgrading from v2.0.1:
- No database changes required
- No configuration changes needed
- Simply replace plugin files
- Code refactoring only - no functional changes
[2.0.1] - 2026-01-22
Fixed
Security Vulnerability - Missing Authentication and Context Validation
- Critical fix: Added missing security validations in
create_chat_messageweb service - Issue: Users were receiving permission denied errors because security checks were incomplete
- Root cause: The web service was missing three critical validation steps:
require_login()- User authentication checkself::validate_context($context)- Course context validationrequire_capability('local/dttutor:use', $context)- Plugin permission check
- Solution: Added all three missing validations following Moodle's external service security checklist
- Impact: Fixes "Lo sentimos, pero no tiene los permisos para hacer esto (Ver cursos sin participación)" error
- Files modified:
classes/external/create_chat_message.php
Changed
Permission System - Extended to All Authenticated Users
- Extended access: Added 'user' archetype to
local/dttutor:usecapability - Reason: Allow all authenticated users to use the tutor, not just enrolled students
- Previous behavior: Only students, teachers, editing teachers, and managers could use the chat
- New behavior: All authenticated users with
moodle/course:viewpermission can use the chat - Automatic upgrade: Added upgrade script (
db/upgrade.php) to automatically assign capability to 'user' role when updating from v2.0.0 - Files modified:
db/access.php- Added 'user' archetype to capability definitiondb/upgrade.php- Added version 2026012201 upgrade step to assign capability
Technical Details
Security Validation Order (now properly implemented):
- Parameter validation via
self::validate_parameters() - Authentication check via
require_login() - Plugin state check via
get_config() - Webservice configuration check
- Course context validation via
self::validate_context() - Plugin capability check via
require_capability('local/dttutor:use') - Course view capability check via
require_capability('moodle/course:view')
Permission Archetypes (updated):
user' CAP_ALLOW (NEW - authenticated users)student' CAP_ALLOWteacher' CAP_ALLOWeditingteacher' CAP_ALLOWmanager' CAP_ALLOW
Upgrade Script:
- Version check:
if ($oldversion < 2026012201) - Uses
get_archetype_roles()to find all 'user' roles - Uses
assign_capability()to grant permission at system context - Checks for existing capability to avoid duplicate assignments
- Idempotent - safe to run multiple times
Migration Notes
Upgrading from v2.0.0:
- Replace plugin files with new version
- Access your Moodle site
- Click "Update database" when prompted
- Upgrade script will automatically assign capability to 'user' role
- No manual configuration required
New Installations:
- 'user' archetype automatically included in capability definition
- No additional setup needed
[2.0.0] - 2025-12-30
Changed
User Interface Terminology
- Indexing ' Synchronization: Changed all user-facing terminology from "indexing/indexed" to "synchronization/synchronized" across all 7 supported languages
- Language updates: Updated 19 strings per language - 7 languages = 133 total string changes
- Terminology mapping:
- "Course Indexing" ' "Course Synchronization"
- "Indexed" ' "Synchronized"
- "Indexing in progress" ' "Synchronization in progress"
- "Start Indexing" ' "Start Synchronization"
- "Re-index Course" ' "Re-synchronize Course"
- "Last indexed" ' "Last synchronized"
- "Indexing failed" ' "Synchronization failed"
- "Not indexed" ' "Not synchronized"
- Code preservation: Internal code (variable names, functions, classes) maintains "indexing" terminology to avoid breaking changes
- All languages updated:
- English: Indexing ' Synchronization
- Spanish: Indexación ' Sincronización
- German: Indexierung ' Synchronisierung
- French: Indexation ' Synchronisation
- Portuguese: Indexação ' Sincronização
- Russian: Индексация ' Синхронизация
- Indonesian: Pengindeksan ' Sinkronisasi
Removed
Markdown Formatting Feature
- Removed markdown rendering: Eliminated markdown-to-HTML conversion feature that was causing display issues
- Simplified message display: Chat messages now display as plain text without formatting
- Code cleanup:
- Removed
markdownToHtml()function fromtutor_ia_chat.js - Reverted
appendToAIMessage()to usetextContentinstead ofinnerHTML - Reverted
addMessage()to use.text()for all messages - Reverted
createMessageElement()to use.text()for history messages - Removed CSS styles for markdown formatting (lists, bold, italic)
- Removed
- Reason: Markdown rendering was not working reliably and causing inconsistent message display
Debug Mode
- Removed debug mode feature: Completely removed debug mode and force reindex functionality
- Removed from settings: Deleted debug mode checkbox from admin settings page
- Removed from UI: Deleted debug controls section from chat drawer template
- Removed from hook: Cleaned up debug-related variables from chat_hook.php
- Language cleanup: Removed debug-related strings from all 7 language files
- Removed:
debug_mode,debug_mode_desc,debug_force_reindex
- Removed:
Technical Details
Terminology Change Impact:
- User-facing strings only (no code changes)
- No database migrations required
- No breaking changes to API or functionality
- Maintains backwards compatibility
Files Modified:
lang/en/local_dttutor.php(English)lang/es/local_dttutor.php(Spanish)lang/de/local_dttutor.php(German)lang/fr/local_dttutor.php(French)lang/pt/local_dttutor.php(Portuguese)lang/ru/local_dttutor.php(Russian)lang/id/local_dttutor.php(Indonesian)amd/src/tutor_ia_chat.js(Markdown removal)styles.css(Markdown styles removal)settings.php(Debug mode removal)templates/tutor_ia_drawer.mustache(Debug controls removal)classes/hook/chat_hook.php(Debug variables removal)
[1.9.0] - 2025-12-01
Added
Debug Mode Feature
- Debug mode setting: New admin setting to enable debug options in the chat interface
- Force reindex checkbox: When debug mode is enabled, shows a checkbox to force context reindexing (only visible to site administrators)
- Admin-only access: Debug controls require both debug mode enabled AND site:config capability
- Metadata transmission: Checkbox state sent as
force_reindex=truein message metadata - Visual design: Debug controls styled with warning colors (yellow background) to clearly indicate debug functionality
- Language support: Debug strings added to all 7 supported languages
Error Handling Improvements
- Stream error detection: Enhanced SSE stream error handling to detect and parse JSON error responses
- License error modal: User-friendly modal for license validation errors with clear explanation
- Insufficient credits modal: User-friendly modal for insufficient AI tokens/credits errors
- Language support: Added error strings for license and credits errors in all 7 languages
Technical Details
Debug Mode:
- Admin setting:
local_dttutor/debug_mode(default: disabled) - Template variables:
debug_modeandis_debug_adminpassed to drawer template - Capability check: Requires
moodle/site:configcapability to see debug controls - Visibility: Debug checkbox only shown when BOTH conditions are met (debug_mode=true AND user is admin)
- JavaScript: Checks checkbox state and includes in metadata when checked
- CSS: Warning-styled debug controls with yellow background and amber border
Error Handling:
- Enhanced EventSource error listener to parse JSON error data from SSE stream
- Added
handleStreamError()method to detect and categorize API errors - Detects errors with structure:
{detail: {status: "error", detail: "message"}} - Shows appropriate error modal based on error type (license vs. credits)
- Graceful fallback for unexpected error structures
[1.8.2] - 2025-12-01
Changed
Code Quality Improvements
- JavaScript code cleanup: Reduced tutor_ia_chat.js from 1387 to 1330 lines by removing redundant comments and consolidating documentation
- Improved JSDoc: Added proper class and constructor documentation with @class and @param tags
- Comment standardization: Replaced verbose inline comments with concise, meaningful ones following Moodle coding standards
- Removed unused variable: Eliminated
highlightedRangevariable that was no longer used
CSS Cleanup
- Removed unused styles: Eliminated
.tutor-ia-text-highlightCSS rules (19 lines) that were no longer used after text selection refactoring
Fixed
Avatar Position Default
- Fixed xref default value: Changed default
xreffrom 'left' to 'right' in position preview admin setting to match actual behavior - Updated settings default: Added complete position object with
drawerside,xref, andyrefto default JSON value
Technical Details
Code Reduction:
- JavaScript: 57 lines removed (4.1% reduction)
- CSS: 19 lines removed (unused text highlight styles)
- Focus on removing redundant comments while preserving essential documentation
- Improved code readability through better comment organization
- All functionality remains unchanged
[1.8.1] - 2025-11-28
Changed
Text Selection Performance Optimization
- Lazy loading of event listeners: Text selection event listeners are now only attached when the chat drawer is open, eliminating performance overhead when the chat is closed
- Event listener cleanup: Listeners are automatically removed when the drawer is closed, ensuring zero performance impact on page interactions outside of the chat
- Debounced text selection handling: Added 150ms debouncing to the
debouncedHandleTextSelection()method to prevent excessive DOM operations during rapid text selection - DOM element caching: Selection indicator DOM elements are now cached instead of being queried repeatedly, improving selection handling performance
- New JavaScript methods:
attachTextSelectionListeners(): Attaches mouseup and keyup event listeners when drawer opensdetachTextSelectionListeners(): Removes event listeners when drawer closesdebouncedHandleTextSelection(): Debounced version of text selection handlercacheSelectionIndicatorElements(): Caches references to selection indicator DOM elements on first use
Technical Details
Performance Improvements:
- Reduced memory footprint by eliminating constant DOM queries during text selection
- Prevented redundant event handling through debouncing (150ms threshold)
- Event listeners only active when user is actively using the chat drawer
- Zero performance impact when chat is not in use
Implementation:
- Lazy attachment in
openDrawer()method callsattachTextSelectionListeners() - Cleanup in
closeDrawer()method callsdetachTextSelectionListeners() - Debouncing threshold configurable via class constant
- Compatible with all existing text selection functionality from version 1.8.0
Performance Metrics
- Memory: Reduced by removing inactive event listeners from DOM
- CPU: Reduced through debouncing and element caching
- Responsiveness: Improved for pages with heavy DOM manipulation
- User impact: No change in user-facing functionality or visual behavior
[1.8.0] - 2025-11-17
Added
Text Selection Context Feature
- Text selection detection: Automatically captures text selected by the user on course pages and activities
- Selection metadata: Selected text is sent as context with chat messages to provide more relevant AI responses
- Persistent visual highlighting: Selected text remains visually highlighted with yellow background and subtle outline even after clicking chat input
- Selection indicator badge: Shows line count and character count in chat footer with clear button
- Backend validation: Robust validation and sanitization of selected text (100KB metadata limit, 50KB text limit)
- Security: XSS prevention through clean_param() sanitization and PARAM_TEXT filtering
- Language support: Translations for text selection feature added to all 7 supported languages (en, es, de, fr, pt, ru, id)
- Error handling: User-friendly error messages for oversized metadata or selected text
- Documentation: Complete backend specification document (BACKEND_TEXT_SELECTION_SPEC.md) with API integration guidelines
Backend Improvements
- Enhanced metadata validation in
create_chat_message.phpwith size limits and type checking - Server-side sanitization of user-selected content
- Improved debugging output for metadata validation errors
Frontend Enhancements
- Real-time text selection handling with mouseup and keyboard event listeners
- Internal state management for selected text, line count, and character count
- Persistent highlighting using DOM manipulation (wraps selected text in styled span element)
- Smart selection persistence - only updates on new selection, never auto-clears when clicking elsewhere
- Automatic selection clearing after message is sent or when clear button clicked
- Visual indicator badge with line count, character count, and clear button
- Smooth animations for badge appearance and highlight transitions
- Interactive highlight with hover effect
UX Improvements
- Context clarity: Users can clearly see what tex
1.9.0 (2025120102)
1.9.0
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2025120102
Version release name: 1.9.0
Maturity: Stable
Supported Moodle versions: 4.5
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch:
Repository tag: 1.9.0
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
1.8.1 (2025112801)
1.8.1
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2025112801
Version release name: 1.8.1
Maturity: Stable
Supported Moodle versions: 4.5
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch:
Repository tag:
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
1.8.0 (2025112500)
1.8.0
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2025112500
Version release name: 1.8.0
Maturity: Stable
Supported Moodle versions: 4.5
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch:
Repository tag:
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
1.8.0 (2025111705)
1.8.0
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2025111705
Version release name: 1.8.0
Maturity: Stable
Supported Moodle versions: 4.5
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch:
Repository tag:
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues
1.7.2 (2025110725)
1.7.2
Plugin type: Local plugins
Frankenstyle component name: local_dttutor
Version build number: 2025110725
Version release name: 1.7.2
Maturity: Stable
Supported Moodle versions: 4.5
Repository URL (Git): https://github.com/industria-elearning/moodle-local_dttutor
Repository branch: main
Repository tag:
Issue/bug tracker URL: https://github.com/datacurso/moodle-local_dttutor/issues