feat: elearning_agent — reduce tools 14 → 8 so it registers at startup

- Merge get_course_stats + get_enrolled_users + get_slide_completion → get_course_details
- Fold publish_course into update_course via website_published param
- Drop flag_low_completion (replaced by post_chatter_note) and suggest_next_course
  (still callable internally via peer-bus suggest_courses request)
- elearning_tools: add get_course_details(), extend update_course() signature
- ARCHITECTURE.md: mark elearning_agent as registered

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 23:02:51 -04:00
parent 233f461480
commit 6c22a9a128
3 changed files with 42 additions and 65 deletions

View File

@@ -83,10 +83,18 @@ class ElearningTools:
return {'id': result.record_id, 'name': name, 'success': True}
return {'success': False, 'error': result.error}
async def get_course_details(self, channel_id: int) -> dict:
"""Combined course stats + enrolled users + per-slide completion."""
stats = await self.get_course_stats(channel_id=channel_id)
enrolled = await self.get_enrolled_users(channel_id=channel_id)
completion = await self.get_slide_completion(channel_id=channel_id)
return {**stats, 'enrolled_users': enrolled, 'slide_completion': completion}
async def update_course(self, channel_id: int, name: str | None = None,
description: str | None = None,
enroll_policy: str | None = None) -> dict:
"""Update fields on an existing course."""
enroll_policy: str | None = None,
website_published: bool | None = None) -> dict:
"""Update fields on an existing course. Pass website_published=True to publish."""
vals: dict = {}
if name is not None:
vals['name'] = name
@@ -94,16 +102,13 @@ class ElearningTools:
vals['description_short'] = description
if enroll_policy is not None:
vals['enroll_policy'] = enroll_policy
if website_published is not None:
vals['website_published'] = website_published
if not vals:
return {'success': False, 'error': 'No values to update'}
result = await self._o.write('slide.channel', [channel_id], vals)
return {'success': result.success, 'error': result.error}
async def publish_course(self, channel_id: int) -> dict:
"""Set website_published=True on a course."""
result = await self._o.write('slide.channel', [channel_id], {'website_published': True})
return {'success': result.success, 'error': result.error}
async def add_section(self, channel_id: int, name: str, sequence: int = 0) -> dict:
"""Add a section (category slide with is_category=True) to a course."""
result = await self._o.create('slide.slide', {