feat: HLS streaming, transcripts, agent course generation & landing-page course previews (#663)

New features:
- HLS video encoding/streaming (hls routes, hls-encoder) and a media
  transcripts pipeline (transcripts route + media-transcript queries)
- AI assistant chat vs. run model: agent-course-generation worker/queue,
  run-monitor pane, chat-changes card, content ask-ai bar
- Per-theme course-page previews across org landing-page themes (bold,
  classic, corporate, editorial, etc.) with a shared course token/component set
- View-as-student mode and login-link / link-invite invite flows

Refactor:
- Extract packages/core consolidating config (env, storage, dashboard-url),
  services and utils previously duplicated under apps/api/src/config
- Remove legacy agent service modules (chat-tools, chat-context,
  context-window, document, fetch-url, lesson-content)
- Relax Cross-Origin-Resource-Policy to allow cross-origin media embedding
- Add format script to tenant-router so turbo run format covers it
This commit is contained in:
Rotimi Best
2026-06-07 18:43:05 +01:00
committed by GitHub
parent a2e70779a0
commit d5b07d356e
496 changed files with 19050 additions and 8312 deletions
@@ -13,14 +13,21 @@
import { courseApi } from '$features/course/api';
import ContentCreateModal from '$features/course/components/content/content-create-modal.svelte';
import CourseCompletionModal from '$features/course/components/ceritficate/course-completion-modal.svelte';
import { aiAssistantPanelDefinition } from '$features/ai-assistant';
import { aiAssistantPanelDefinition, ContentAskAiBar, AI_ASSISTANT_PANEL_ID } from '$features/ai-assistant';
import {
getContentAskAiBarWidthClass,
isCourseContentLockedForStudent
} from '$features/ai-assistant/utils/content-ask-ai-bar';
import { initialChatPrompt, openAiAssistant } from '$features/ai-assistant/utils/store';
import { sidePanel, SidePanelRail } from '$features/side-panel';
import { transcriptPanelDefinition } from '$features/course/components/lesson/video/transcript-panel-definition';
import { get } from 'svelte/store';
import { page } from '$app/state';
import { profile } from '$lib/utils/store/user';
import { isOrgAdmin } from '$lib/utils/store/org';
import { isOrgStudent } from '$lib/utils/store/app';
import { t } from '$lib/utils/functions/translations';
import { ContentType } from '@cio/utils/constants/content';
import type { CourseMember } from '$features/course/utils/types';
import {
COURSE_SIDEBAR_DEFAULT_WIDTH,
@@ -79,6 +86,28 @@
const isExercisePage = $derived(!!data.exerciseId);
const lessonId = $derived(page.params.lessonId as string | undefined);
const exerciseId = $derived((page.params.exerciseId as string | undefined) ?? data.exerciseId);
const isLessonOrExercisePage = $derived(Boolean(lessonId || exerciseId));
const isLessonEditMode = $derived(page.url.searchParams.get('mode') === 'edit');
const contentAskAiWidthClass = $derived(getContentAskAiBarWidthClass({ lessonId, isLessonEditMode }));
const isContentLockedForStudent = $derived(
isCourseContentLockedForStudent(
courseApi.course,
lessonId ?? exerciseId,
lessonId ? ContentType.Lesson : exerciseId ? ContentType.Exercise : null
)
);
const showContentAskAiBar = $derived(
isCourseReady &&
isLessonOrExercisePage &&
!($isOrgStudent && isContentLockedForStudent) &&
sidePanel.activePanelId !== AI_ASSISTANT_PANEL_ID
);
function clampSidebarWidth(width: number) {
return Math.min(COURSE_SIDEBAR_MAX_WIDTH, Math.max(COURSE_SIDEBAR_MIN_WIDTH, width));
}
@@ -188,6 +217,10 @@
{/if}
{@render children?.()}
{#if showContentAskAiBar}
<ContentAskAiBar class={contentAskAiWidthClass} />
{/if}
{/if}
</Sidebar.Inset>
@@ -1,9 +1,23 @@
<script lang="ts">
import { fly } from 'svelte/transition';
import type { Component } from 'svelte';
import { goto } from '$app/navigation';
import { resolve } from '$app/paths';
import { courseApi } from '$features/course/api';
import type { Course } from '$features/course/utils/types';
import { setLandingPageEditContext, type LandingSectionKey } from '@cio/ui/custom/org-landing-page';
import {
HeaderIcon,
GoalIcon,
LessonIcon,
ExerciseIcon,
CertificateIcon,
MoneyIcon,
ReviewIcon,
PersonIcon,
ContentIcon
} from '@cio/ui/custom/moving-icons';
import { t } from '$lib/utils/functions/translations';
import { CourseLandingPage } from '$features/ui';
import Editor from '$features/ui/course-landing-page/components/editor/editor.svelte';
@@ -14,6 +28,27 @@
const courseId = $derived(data.courseId);
let sidebarOpen = $state(true);
let selectedSectionKey = $state<LandingSectionKey | null>(null);
const sectionIcons: Partial<Record<LandingSectionKey, Component>> = {
header: HeaderIcon,
requirement: ExerciseIcon,
description: LessonIcon,
goals: GoalIcon,
certificate: CertificateIcon,
curriculum: ContentIcon,
chips: ContentIcon,
instructor: PersonIcon,
reviews: ReviewIcon,
pricing: MoneyIcon
};
setLandingPageEditContext({
selectedKey: () => selectedSectionKey,
selectKey: (key) => (selectedSectionKey = key),
labelFor: (key) => t.get(`course.navItem.landing_page.editor.title.${key}` as never) || key,
iconFor: (key) => sectionIcons[key] ?? HeaderIcon
});
function syncCourseStore(_courseData: Course) {
if (courseApi.course) {
@@ -34,7 +69,13 @@
>
<Sidebar.Provider bind:open={sidebarOpen} style="--sidebar-width: 360px; --sidebar-width-icon: 4rem">
<Sidebar.Root side="left" collapsible="icon" class="h-full">
<Editor {courseId} bind:course={courseApi.course} {syncCourseStore} onClose={handleClose} />
<Editor
{courseId}
bind:course={courseApi.course}
bind:selectedSectionKey
{syncCourseStore}
onClose={handleClose}
/>
</Sidebar.Root>
<Sidebar.Inset class="relative h-screen! overflow-y-auto">
<div class="absolute top-2 left-2 z-60">
@@ -44,11 +44,11 @@
}
};
const downloadPDF = () => {
const downloadPDF = async () => {
if (!data.marksData) return;
isDownloading = true;
try {
generateMarksPDF(
await generateMarksPDF(
data.marksData.students,
exercises,
data.marksData.studentMarksByExerciseId,