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
+1
View File
@@ -2,3 +2,4 @@ export * from './array';
export * from './fileValidation';
export * from './sanitize';
export * from './slug';
export * from './transcript-vtt';
@@ -0,0 +1,45 @@
export interface TranscriptVttSegment {
start: number;
end: number;
text: string;
}
function formatVttTime(seconds: number): string {
if (!Number.isFinite(seconds) || seconds < 0) {
seconds = 0;
}
const totalMs = Math.round(seconds * 1000);
const hours = Math.floor(totalMs / 3_600_000);
const minutes = Math.floor((totalMs % 3_600_000) / 60_000);
const secs = Math.floor((totalMs % 60_000) / 1000);
const ms = totalMs % 1000;
const pad = (n: number, width: number) => n.toString().padStart(width, '0');
return `${pad(hours, 2)}:${pad(minutes, 2)}:${pad(secs, 2)}.${pad(ms, 3)}`;
}
/**
* Build a minimal WEBVTT caption file from transcript segment timestamps.
*/
export function segmentsToWebVtt(segments: TranscriptVttSegment[]): string {
const lines = ['WEBVTT', ''];
let cueIndex = 1;
for (const segment of segments) {
const text = segment.text.trim();
if (!text) continue;
const start = formatVttTime(segment.start);
const end = formatVttTime(Math.max(segment.end, segment.start + 0.001));
lines.push(String(cueIndex));
lines.push(`${start} --> ${end}`);
lines.push(text);
lines.push('');
cueIndex++;
}
return lines.join('\n');
}