brightspace-mcp-server 3.0.4 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -17
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/build/tools/get-announcements.d.ts +1 -0
- package/build/tools/get-announcements.d.ts.map +1 -1
- package/build/tools/get-announcements.js +29 -9
- package/build/tools/get-announcements.js.map +1 -1
- package/build/tools/get-course-content.d.ts.map +1 -1
- package/build/tools/get-course-content.js +42 -2
- package/build/tools/get-course-content.js.map +1 -1
- package/build/tools/get-video-transcript.d.ts +13 -0
- package/build/tools/get-video-transcript.d.ts.map +1 -0
- package/build/tools/get-video-transcript.js +168 -0
- package/build/tools/get-video-transcript.js.map +1 -0
- package/build/tools/index.d.ts +1 -0
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +1 -0
- package/build/tools/index.js.map +1 -1
- package/build/tools/schemas.d.ts +9 -0
- package/build/tools/schemas.d.ts.map +1 -1
- package/build/tools/schemas.js +16 -0
- package/build/tools/schemas.js.map +1 -1
- package/build/utils/modified-since.d.ts +19 -0
- package/build/utils/modified-since.d.ts.map +1 -0
- package/build/utils/modified-since.js +26 -0
- package/build/utils/modified-since.js.map +1 -0
- package/build/utils/transcript/captions.d.ts +40 -0
- package/build/utils/transcript/captions.d.ts.map +1 -0
- package/build/utils/transcript/captions.js +63 -0
- package/build/utils/transcript/captions.js.map +1 -0
- package/build/utils/transcript/errors.d.ts +14 -0
- package/build/utils/transcript/errors.d.ts.map +1 -0
- package/build/utils/transcript/errors.js +20 -0
- package/build/utils/transcript/errors.js.map +1 -0
- package/build/utils/transcript/kaltura.d.ts +8 -0
- package/build/utils/transcript/kaltura.d.ts.map +1 -0
- package/build/utils/transcript/kaltura.js +94 -0
- package/build/utils/transcript/kaltura.js.map +1 -0
- package/build/utils/transcript/platform.d.ts +23 -0
- package/build/utils/transcript/platform.d.ts.map +1 -0
- package/build/utils/transcript/platform.js +98 -0
- package/build/utils/transcript/platform.js.map +1 -0
- package/build/utils/transcript/types.d.ts +22 -0
- package/build/utils/transcript/types.d.ts.map +1 -0
- package/build/utils/transcript/types.js +7 -0
- package/build/utils/transcript/types.js.map +1 -0
- package/build/utils/transcript/youtube.d.ts +8 -0
- package/build/utils/transcript/youtube.d.ts.map +1 -0
- package/build/utils/transcript/youtube.js +57 -0
- package/build/utils/transcript/youtube.js.map +1 -0
- package/package.json +1 -1
package/build/tools/schemas.js
CHANGED
|
@@ -28,6 +28,8 @@ export const GetMyGradesSchema = z.object({
|
|
|
28
28
|
export const GetAnnouncementsSchema = z.object({
|
|
29
29
|
courseId: z.coerce.number().int().positive().optional().describe("Course ID to get announcements for. If omitted, returns recent announcements across all courses."),
|
|
30
30
|
count: z.coerce.number().int().min(1).max(50).default(10).describe("Maximum number of announcements to return"),
|
|
31
|
+
modifiedSince: z.string().datetime({ offset: true, message: "modifiedSince must be an ISO 8601 datetime, e.g. 2026-01-15T00:00:00Z" }).optional()
|
|
32
|
+
.describe("Only return announcements last modified at or after this ISO 8601 datetime (e.g. 2026-01-15T00:00:00Z). Announcements with no modified timestamp are always included. When set, the response reports how many announcements were filtered out."),
|
|
31
33
|
});
|
|
32
34
|
export const GetAssignmentsSchema = z.object({
|
|
33
35
|
courseId: z.coerce.number().int().positive().optional()
|
|
@@ -42,6 +44,8 @@ export const GetCourseContentSchema = z.object({
|
|
|
42
44
|
.describe("Case-insensitive substring match on module titles. Only returns modules whose title contains this string (e.g. 'Labs', 'Staff', 'Homeworks'). Children of matching modules are included in full."),
|
|
43
45
|
maxDepth: z.coerce.number().int().min(1).max(10).optional()
|
|
44
46
|
.describe("Limit recursive depth of the content tree. Depth 1 returns top-level modules with direct children only. Useful for getting a table of contents without all nested content."),
|
|
47
|
+
modifiedSince: z.string().datetime({ offset: true, message: "modifiedSince must be an ISO 8601 datetime, e.g. 2026-01-15T00:00:00Z" }).optional()
|
|
48
|
+
.describe("Only return topics last modified at or after this ISO 8601 datetime (e.g. 2026-01-15T00:00:00Z), plus any module that contains a matching topic. Topics with no modified timestamp are always included. When set, the response reports how many topics were filtered out."),
|
|
45
49
|
});
|
|
46
50
|
export const GetClasslistEmailsSchema = z.object({
|
|
47
51
|
courseId: z.coerce.number().int().positive()
|
|
@@ -87,6 +91,18 @@ export const GetAssignmentFilesSchema = z.object({
|
|
|
87
91
|
maxChars: z.coerce.number().int().positive().max(100000).default(12000)
|
|
88
92
|
.describe("Maximum characters of extracted text to return. The response reports whether it was truncated."),
|
|
89
93
|
});
|
|
94
|
+
export const GetVideoTranscriptSchema = z.object({
|
|
95
|
+
courseId: z.coerce.number().int().positive().optional()
|
|
96
|
+
.describe("Course ID the video belongs to. Required together with topicId unless videoUrl is given directly."),
|
|
97
|
+
topicId: z.coerce.number().int().positive().optional()
|
|
98
|
+
.describe("Content topic ID (from get_course_content) whose embedded video to transcribe. Requires courseId."),
|
|
99
|
+
videoUrl: z.string().url().optional()
|
|
100
|
+
.describe("Direct video URL to transcribe, e.g. the url field get_course_content already returned. Use instead of courseId/topicId when you already have the link."),
|
|
101
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
102
|
+
.describe("Character offset into the transcript to resume from. Pass back nextOffset from a truncated response to fetch the next piece."),
|
|
103
|
+
maxChars: z.coerce.number().int().positive().max(100000).default(12000)
|
|
104
|
+
.describe("Maximum characters of transcript text to return in one call. The response reports whether it was truncated."),
|
|
105
|
+
});
|
|
90
106
|
export const GetRosterSchema = z.object({
|
|
91
107
|
courseId: z.coerce.number().int().positive()
|
|
92
108
|
.describe("Course ID to get roster for."),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC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,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;SACpE,QAAQ,CAAC,6GAA6G,CAAC;CAC3H,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;SACzC,QAAQ,CAAC,8BAA8B,CAAC;IAC3C,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;SACxC,QAAQ,CAAC,mEAAmE,CAAC;IAChF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;SACvC,QAAQ,CAAC,yCAAyC,CAAC;IACtD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;SAC7D,QAAQ,CAAC,yGAAyG,CAAC;CACvH,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether an item's last-modified timestamp is at or after a cutoff.
|
|
8
|
+
*
|
|
9
|
+
* A null or unparseable timestamp counts as a match, not a miss. D2L sends
|
|
10
|
+
* null for some topics regardless of whether the item is new or old, and
|
|
11
|
+
* excluding them would silently drop content from a filtered listing — the
|
|
12
|
+
* same class of bug as #26, where graded work went missing from a listing
|
|
13
|
+
* with no indication anything was withheld. Comparison happens on epoch
|
|
14
|
+
* millis, which Date normalizes to UTC regardless of the source string's
|
|
15
|
+
* offset, so timezone-qualified and Z-suffixed inputs compare correctly
|
|
16
|
+
* against each other.
|
|
17
|
+
*/
|
|
18
|
+
export declare function matchesModifiedSince(lastModified: string | null | undefined, cutoff: Date): boolean;
|
|
19
|
+
//# sourceMappingURL=modified-since.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modified-since.d.ts","sourceRoot":"","sources":["../../src/utils/modified-since.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACvC,MAAM,EAAE,IAAI,GACX,OAAO,CAKT"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether an item's last-modified timestamp is at or after a cutoff.
|
|
8
|
+
*
|
|
9
|
+
* A null or unparseable timestamp counts as a match, not a miss. D2L sends
|
|
10
|
+
* null for some topics regardless of whether the item is new or old, and
|
|
11
|
+
* excluding them would silently drop content from a filtered listing — the
|
|
12
|
+
* same class of bug as #26, where graded work went missing from a listing
|
|
13
|
+
* with no indication anything was withheld. Comparison happens on epoch
|
|
14
|
+
* millis, which Date normalizes to UTC regardless of the source string's
|
|
15
|
+
* offset, so timezone-qualified and Z-suffixed inputs compare correctly
|
|
16
|
+
* against each other.
|
|
17
|
+
*/
|
|
18
|
+
export function matchesModifiedSince(lastModified, cutoff) {
|
|
19
|
+
if (!lastModified)
|
|
20
|
+
return true;
|
|
21
|
+
const time = new Date(lastModified).getTime();
|
|
22
|
+
if (Number.isNaN(time))
|
|
23
|
+
return true;
|
|
24
|
+
return time >= cutoff.getTime();
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=modified-since.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modified-since.js","sourceRoot":"","sources":["../../src/utils/modified-since.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAClC,YAAuC,EACvC,MAAY;IAEZ,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;IAC9C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Parsing for the two caption formats every platform adapter in
|
|
8
|
+
* src/utils/transcript/ ends up serving: WebVTT and SRT. Both are just
|
|
9
|
+
* "timestamp range, then text, blank line, repeat" — this module is the one
|
|
10
|
+
* place that knows the timestamp punctuation differs (`.` vs `,`) and that
|
|
11
|
+
* VTT can carry inline tags and cue settings SRT never does.
|
|
12
|
+
*/
|
|
13
|
+
export interface TranscriptCue {
|
|
14
|
+
startMs: number;
|
|
15
|
+
endMs: number;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
export type CaptionFormat = "vtt" | "srt";
|
|
19
|
+
/**
|
|
20
|
+
* Parse WebVTT or SRT text into cues. Format is detected from the WEBVTT
|
|
21
|
+
* header rather than taken on faith, since a caller only knows what the
|
|
22
|
+
* platform's API claims to have served.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseCaptions(raw: string): {
|
|
25
|
+
format: CaptionFormat;
|
|
26
|
+
cues: TranscriptCue[];
|
|
27
|
+
};
|
|
28
|
+
/** "H:MM:SS", matching how course-length recordings are usually captioned. */
|
|
29
|
+
export declare function formatTimestamp(ms: number): string;
|
|
30
|
+
/** One line per cue, timestamped, in reading order. */
|
|
31
|
+
export declare function cuesToText(cues: TranscriptCue[]): string;
|
|
32
|
+
export interface TextWindow {
|
|
33
|
+
window: string;
|
|
34
|
+
truncated: boolean;
|
|
35
|
+
nextOffset: number | null;
|
|
36
|
+
totalChars: number;
|
|
37
|
+
}
|
|
38
|
+
/** Character-offset paging, mirroring the maxChars/truncated convention used elsewhere for large text. */
|
|
39
|
+
export declare function paginateText(text: string, offset: number, maxChars: number): TextWindow;
|
|
40
|
+
//# sourceMappingURL=captions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captions.d.ts","sourceRoot":"","sources":["../../../src/utils/transcript/captions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;AAa1C;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,aAAa,EAAE,CAAA;CAAE,CAwB3F;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,MAAM,CAExD;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAKvF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/** "01:02:03.456" or "01:02:03,456" or the hours-omitted "02:03.456". */
|
|
7
|
+
function parseTimestamp(raw) {
|
|
8
|
+
const match = raw.trim().match(/^(?:(\d+):)?(\d{2}):(\d{2})[.,](\d{3})$/);
|
|
9
|
+
if (!match)
|
|
10
|
+
return NaN;
|
|
11
|
+
const [, hours, minutes, seconds, millis] = match;
|
|
12
|
+
return ((Number(hours ?? 0) * 3600 + Number(minutes) * 60 + Number(seconds)) * 1000 +
|
|
13
|
+
Number(millis));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse WebVTT or SRT text into cues. Format is detected from the WEBVTT
|
|
17
|
+
* header rather than taken on faith, since a caller only knows what the
|
|
18
|
+
* platform's API claims to have served.
|
|
19
|
+
*/
|
|
20
|
+
export function parseCaptions(raw) {
|
|
21
|
+
const normalized = raw.replace(/^/, "").replace(/\r\n?/g, "\n");
|
|
22
|
+
const format = /^WEBVTT/.test(normalized.trimStart()) ? "vtt" : "srt";
|
|
23
|
+
const cues = [];
|
|
24
|
+
for (const block of normalized.split(/\n{2,}/)) {
|
|
25
|
+
const lines = block.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
26
|
+
const timingIndex = lines.findIndex((l) => l.includes("-->"));
|
|
27
|
+
if (timingIndex === -1)
|
|
28
|
+
continue;
|
|
29
|
+
const [startRaw, endRaw] = lines[timingIndex].split("-->");
|
|
30
|
+
const startMs = parseTimestamp(startRaw.trim().split(/\s+/)[0] ?? "");
|
|
31
|
+
const endMs = parseTimestamp((endRaw ?? "").trim().split(/\s+/)[0] ?? "");
|
|
32
|
+
if (Number.isNaN(startMs) || Number.isNaN(endMs))
|
|
33
|
+
continue;
|
|
34
|
+
const text = lines
|
|
35
|
+
.slice(timingIndex + 1)
|
|
36
|
+
.join(" ")
|
|
37
|
+
.replace(/<[^>]+>/g, "")
|
|
38
|
+
.trim();
|
|
39
|
+
if (text)
|
|
40
|
+
cues.push({ startMs, endMs, text });
|
|
41
|
+
}
|
|
42
|
+
return { format, cues };
|
|
43
|
+
}
|
|
44
|
+
/** "H:MM:SS", matching how course-length recordings are usually captioned. */
|
|
45
|
+
export function formatTimestamp(ms) {
|
|
46
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1000));
|
|
47
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
48
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
49
|
+
const seconds = totalSeconds % 60;
|
|
50
|
+
return `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
|
|
51
|
+
}
|
|
52
|
+
/** One line per cue, timestamped, in reading order. */
|
|
53
|
+
export function cuesToText(cues) {
|
|
54
|
+
return cues.map((cue) => `[${formatTimestamp(cue.startMs)}] ${cue.text}`).join("\n");
|
|
55
|
+
}
|
|
56
|
+
/** Character-offset paging, mirroring the maxChars/truncated convention used elsewhere for large text. */
|
|
57
|
+
export function paginateText(text, offset, maxChars) {
|
|
58
|
+
const totalChars = text.length;
|
|
59
|
+
const window = text.slice(offset, offset + maxChars);
|
|
60
|
+
const truncated = offset + maxChars < totalChars;
|
|
61
|
+
return { window, truncated, nextOffset: truncated ? offset + maxChars : null, totalChars };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=captions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captions.js","sourceRoot":"","sources":["../../../src/utils/transcript/captions.ts"],"names":[],"mappings":"AAAA;;;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C,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,YAAY,GAAG,EAAE,CAAC;IAClC,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAC5F,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,UAAU,CAAC,IAAqB;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvF,CAAC;AASD,0GAA0G;AAC1G,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc,EAAE,QAAgB;IACzE,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;IACrD,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;IACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/** The video exists and answered, but has no captions — an expected outcome, not a failure. */
|
|
7
|
+
export declare class NoTranscriptError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
/** The platform's API could not be reached or rejected the request. */
|
|
11
|
+
export declare class TranscriptFetchError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/transcript/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+FAA+F;AAC/F,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,uEAAuE;AACvE,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/** The video exists and answered, but has no captions — an expected outcome, not a failure. */
|
|
7
|
+
export class NoTranscriptError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "NoTranscriptError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** The platform's API could not be reached or rejected the request. */
|
|
14
|
+
export class TranscriptFetchError extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = "TranscriptFetchError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utils/transcript/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+FAA+F;AAC/F,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,uEAAuE;AACvE,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
import type { FetchLike, TranscriptResult } from "./types.js";
|
|
7
|
+
export declare function getKalturaTranscript(partnerId: string, entryId: string, fetchImpl: FetchLike): Promise<TranscriptResult>;
|
|
8
|
+
//# sourceMappingURL=kaltura.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kaltura.d.ts","sourceRoot":"","sources":["../../../src/utils/transcript/kaltura.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAqF9D,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAyB3B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Kaltura transcript retrieval — the priority-one platform from issue #33,
|
|
8
|
+
* since Purdue's BoilerCast and many other D2L schools run on it.
|
|
9
|
+
*
|
|
10
|
+
* This does not reuse the Brightspace session: Kaltura is a separate SaaS
|
|
11
|
+
* tenant with its own auth, and an embedded player normally authenticates
|
|
12
|
+
* to it with a "widget session" (a KS token scoped read-only to the entries
|
|
13
|
+
* a partner has made embeddable), not the D2L cookie. That widget-session
|
|
14
|
+
* flow is the same mechanism generic Kaltura embed players use, and it is
|
|
15
|
+
* anonymous by design — it needs no Brightspace credential to obtain. A
|
|
16
|
+
* captions request that fails because the entry actually requires an
|
|
17
|
+
* authenticated (non-widget) session surfaces as TranscriptFetchError, which
|
|
18
|
+
* the tool turns into a "open it in Brightspace directly" message rather
|
|
19
|
+
* than a silent empty result.
|
|
20
|
+
*/
|
|
21
|
+
import { parseCaptions } from "./captions.js";
|
|
22
|
+
import { NoTranscriptError, TranscriptFetchError } from "./errors.js";
|
|
23
|
+
const KALTURA_API_BASE = "https://cdnapisec.kaltura.com/api_v3/service";
|
|
24
|
+
async function startWidgetSession(partnerId, fetchImpl) {
|
|
25
|
+
const res = await fetchImpl(`${KALTURA_API_BASE}/session/action/startWidgetSession?widgetId=_${encodeURIComponent(partnerId)}&format=1`);
|
|
26
|
+
if (!res.ok) {
|
|
27
|
+
throw new TranscriptFetchError(`Kaltura session request failed (HTTP ${res.status}).`);
|
|
28
|
+
}
|
|
29
|
+
const data = (await res.json());
|
|
30
|
+
if (data.error) {
|
|
31
|
+
throw new TranscriptFetchError(`Kaltura rejected the session request: ${data.error.message ?? "unknown error"}.`);
|
|
32
|
+
}
|
|
33
|
+
if (!data.ks) {
|
|
34
|
+
throw new TranscriptFetchError("Kaltura did not return a session token.");
|
|
35
|
+
}
|
|
36
|
+
return data.ks;
|
|
37
|
+
}
|
|
38
|
+
async function listCaptionAssets(ks, entryId, fetchImpl) {
|
|
39
|
+
const res = await fetchImpl(`${KALTURA_API_BASE}/caption_captionasset/action/list?format=1` +
|
|
40
|
+
`&ks=${encodeURIComponent(ks)}&filter:entryIdEqual=${encodeURIComponent(entryId)}`);
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
throw new TranscriptFetchError(`Kaltura caption list request failed (HTTP ${res.status}).`);
|
|
43
|
+
}
|
|
44
|
+
const data = (await res.json());
|
|
45
|
+
if (data.error) {
|
|
46
|
+
throw new TranscriptFetchError(`Kaltura rejected the caption list request: ${data.error.message ?? "unknown error"}.`);
|
|
47
|
+
}
|
|
48
|
+
return data.objects ?? [];
|
|
49
|
+
}
|
|
50
|
+
async function serveCaption(ks, captionAssetId, fetchImpl) {
|
|
51
|
+
const res = await fetchImpl(`${KALTURA_API_BASE}/caption_captionasset/action/serve?ks=${encodeURIComponent(ks)}` +
|
|
52
|
+
`&captionAssetId=${encodeURIComponent(captionAssetId)}`);
|
|
53
|
+
if (!res.ok) {
|
|
54
|
+
throw new TranscriptFetchError(`Kaltura caption download failed (HTTP ${res.status}).`);
|
|
55
|
+
}
|
|
56
|
+
return res.text();
|
|
57
|
+
}
|
|
58
|
+
/** Best-effort title/duration — a caption-only entry still has a usable transcript without this. */
|
|
59
|
+
async function fetchMediaInfo(ks, entryId, fetchImpl) {
|
|
60
|
+
try {
|
|
61
|
+
const res = await fetchImpl(`${KALTURA_API_BASE}/media/action/get?ks=${encodeURIComponent(ks)}&entryId=${encodeURIComponent(entryId)}`);
|
|
62
|
+
if (!res.ok)
|
|
63
|
+
return { title: null, durationSeconds: null };
|
|
64
|
+
const data = (await res.json());
|
|
65
|
+
if (data.error)
|
|
66
|
+
return { title: null, durationSeconds: null };
|
|
67
|
+
return { title: data.name ?? null, durationSeconds: typeof data.duration === "number" ? data.duration : null };
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return { title: null, durationSeconds: null };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export async function getKalturaTranscript(partnerId, entryId, fetchImpl) {
|
|
74
|
+
const ks = await startWidgetSession(partnerId, fetchImpl);
|
|
75
|
+
const assets = await listCaptionAssets(ks, entryId, fetchImpl);
|
|
76
|
+
if (assets.length === 0) {
|
|
77
|
+
throw new NoTranscriptError("This Kaltura video has no captions available.");
|
|
78
|
+
}
|
|
79
|
+
const asset = assets.find((a) => a.isDefault) ?? assets[0];
|
|
80
|
+
const raw = await serveCaption(ks, asset.id, fetchImpl);
|
|
81
|
+
const { format, cues } = parseCaptions(raw);
|
|
82
|
+
if (cues.length === 0) {
|
|
83
|
+
throw new NoTranscriptError("This Kaltura video has a caption track, but it contained no readable cues.");
|
|
84
|
+
}
|
|
85
|
+
const media = await fetchMediaInfo(ks, entryId, fetchImpl);
|
|
86
|
+
return {
|
|
87
|
+
cues,
|
|
88
|
+
format,
|
|
89
|
+
language: asset.languageCode ?? asset.language ?? null,
|
|
90
|
+
title: media.title,
|
|
91
|
+
durationSeconds: media.durationSeconds,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=kaltura.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kaltura.js","sourceRoot":"","sources":["../../../src/utils/transcript/kaltura.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGtE,MAAM,gBAAgB,GAAG,8CAA8C,CAAC;AAaxE,KAAK,UAAU,kBAAkB,CAAC,SAAiB,EAAE,SAAoB;IACvE,MAAM,GAAG,GAAG,MAAM,SAAS,CACzB,GAAG,gBAAgB,gDAAgD,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAC5G,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,oBAAoB,CAAC,wCAAwC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAsC,CAAC;IACrE,IAAI,IAAI,CAAC,KAA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AAC;QACxB,MAAM,IAAI,iBAAiB,CAAC,+CAA+C,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACxD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAE5C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,iBAAiB,CAAC,4EAA4E,CAAC,CAAC;IAC5G,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAE3D,OAAO;QACL,IAAI;QACJ,MAAM;QACN,QAAQ,EAAE,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI;QACtD,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,eAAe,EAAE,KAAK,CAAC,eAAe;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Which video platform a content topic's URL points at, and the identifiers
|
|
8
|
+
* each platform's transcript adapter needs. get_course_content's own
|
|
9
|
+
* `typeFilter: "video"` match is a blunt `youtube|vimeo|kaltura|video` regex
|
|
10
|
+
* on the URL; this is the more accurate classifier get_video_transcript
|
|
11
|
+
* needs before it can pick an adapter.
|
|
12
|
+
*/
|
|
13
|
+
export type VideoPlatform = "kaltura" | "youtube" | "panopto" | "yuja" | "echo360" | "vimeo" | "unknown";
|
|
14
|
+
export declare function detectVideoPlatform(url: string): VideoPlatform;
|
|
15
|
+
export interface KalturaIds {
|
|
16
|
+
partnerId: string;
|
|
17
|
+
entryId: string;
|
|
18
|
+
}
|
|
19
|
+
/** Kaltura embeds carry the entry and partner ID as query params or path segments; naming varies by embed generator. */
|
|
20
|
+
export declare function extractKalturaIds(url: string): KalturaIds | null;
|
|
21
|
+
/** youtube.com/watch?v=, youtu.be/, and /embed/ links. */
|
|
22
|
+
export declare function extractYouTubeVideoId(url: string): string | null;
|
|
23
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../src/utils/transcript/platform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,SAAS,GACT,SAAS,GACT,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAoBd,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAgB9D;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wHAAwH;AACxH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA6BhE;AAED,0DAA0D;AAC1D,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmBhE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
function safeHostname(url) {
|
|
7
|
+
try {
|
|
8
|
+
return new URL(url).hostname.toLowerCase();
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Kaltura's KAF "browseAndEmbed" front end (what a school's own branded
|
|
16
|
+
* domain, e.g. BoilerCast, typically uses) puts params as path segments
|
|
17
|
+
* rather than a query string: `/browseandembed/index/media/entry_id/1_abc/wid/_123`.
|
|
18
|
+
*/
|
|
19
|
+
function pathSegmentParam(pathname, name) {
|
|
20
|
+
const match = pathname.match(new RegExp(`/${name}/([^/]+)`, "i"));
|
|
21
|
+
return match?.[1] ?? null;
|
|
22
|
+
}
|
|
23
|
+
export function detectVideoPlatform(url) {
|
|
24
|
+
const host = safeHostname(url);
|
|
25
|
+
if (!host)
|
|
26
|
+
return "unknown";
|
|
27
|
+
// Kaltura is embedded either from its own multi-tenant domains (kaltura.com,
|
|
28
|
+
// mediaspace.kaltura.com) or from a school's own KAF front end (e.g.
|
|
29
|
+
// BoilerCast at Purdue), which is why entry_id/wid are also checked as
|
|
30
|
+
// query params or path segments before falling back to "unknown".
|
|
31
|
+
if (/kaltura/.test(host))
|
|
32
|
+
return "kaltura";
|
|
33
|
+
if (/youtube\.com$|youtu\.be$/.test(host))
|
|
34
|
+
return "youtube";
|
|
35
|
+
if (/panopto/.test(host))
|
|
36
|
+
return "panopto";
|
|
37
|
+
if (/yuja/.test(host))
|
|
38
|
+
return "yuja";
|
|
39
|
+
if (/echo360/.test(host))
|
|
40
|
+
return "echo360";
|
|
41
|
+
if (/vimeo/.test(host))
|
|
42
|
+
return "vimeo";
|
|
43
|
+
if (extractKalturaIds(url))
|
|
44
|
+
return "kaltura";
|
|
45
|
+
return "unknown";
|
|
46
|
+
}
|
|
47
|
+
/** Kaltura embeds carry the entry and partner ID as query params or path segments; naming varies by embed generator. */
|
|
48
|
+
export function extractKalturaIds(url) {
|
|
49
|
+
let parsed;
|
|
50
|
+
try {
|
|
51
|
+
parsed = new URL(url);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const params = parsed.searchParams;
|
|
57
|
+
const pathname = parsed.pathname;
|
|
58
|
+
const pathEntryMatch = pathname.match(/\/(?:media\/t|id|entryid)\/([\w-]+)/i);
|
|
59
|
+
const entryId = params.get("entry_id") ??
|
|
60
|
+
params.get("entryId") ??
|
|
61
|
+
pathEntryMatch?.[1] ??
|
|
62
|
+
pathSegmentParam(pathname, "entry_id") ??
|
|
63
|
+
null;
|
|
64
|
+
const widParam = params.get("wid") ??
|
|
65
|
+
params.get("partner_id") ??
|
|
66
|
+
params.get("partnerId") ??
|
|
67
|
+
params.get("pid") ??
|
|
68
|
+
pathSegmentParam(pathname, "wid") ??
|
|
69
|
+
pathSegmentParam(pathname, "partner_id");
|
|
70
|
+
const partnerId = widParam ? widParam.replace(/^_/, "") : null;
|
|
71
|
+
if (!entryId || !partnerId)
|
|
72
|
+
return null;
|
|
73
|
+
return { partnerId, entryId };
|
|
74
|
+
}
|
|
75
|
+
/** youtube.com/watch?v=, youtu.be/, and /embed/ links. */
|
|
76
|
+
export function extractYouTubeVideoId(url) {
|
|
77
|
+
let parsed;
|
|
78
|
+
try {
|
|
79
|
+
parsed = new URL(url);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const host = parsed.hostname.toLowerCase();
|
|
85
|
+
if (host === "youtu.be" || host.endsWith(".youtu.be")) {
|
|
86
|
+
return parsed.pathname.slice(1).split("/")[0] || null;
|
|
87
|
+
}
|
|
88
|
+
if (host.endsWith("youtube.com") || host.endsWith("youtube-nocookie.com")) {
|
|
89
|
+
const v = parsed.searchParams.get("v");
|
|
90
|
+
if (v)
|
|
91
|
+
return v;
|
|
92
|
+
const embedMatch = parsed.pathname.match(/\/embed\/([\w-]+)/);
|
|
93
|
+
if (embedMatch)
|
|
94
|
+
return embedMatch[1];
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../../src/utils/transcript/platform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,QAAgB,EAAE,IAAY;IACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,IAAI,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IAClE,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAE5B,6EAA6E;IAC7E,qEAAqE;IACrE,uEAAuE;IACvE,kEAAkE;IAClE,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,IAAI,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IACrC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,IAAI,OAAO,CAAC,IA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AS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAE3C,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACtD,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACxD,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAC1E,MAAM,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;QAChB,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC9D,IAAI,UAAU;YAAE,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
import type { CaptionFormat, TranscriptCue } from "./captions.js";
|
|
7
|
+
/** What every platform adapter (kaltura.ts, youtube.ts, ...) resolves to on success. */
|
|
8
|
+
export interface TranscriptResult {
|
|
9
|
+
cues: TranscriptCue[];
|
|
10
|
+
format: CaptionFormat;
|
|
11
|
+
language: string | null;
|
|
12
|
+
title: string | null;
|
|
13
|
+
durationSeconds: number | null;
|
|
14
|
+
}
|
|
15
|
+
/** Minimal fetch surface an adapter needs, so tests can inject a stub instead of touching global fetch. */
|
|
16
|
+
export type FetchLike = (url: string) => Promise<{
|
|
17
|
+
ok: boolean;
|
|
18
|
+
status: number;
|
|
19
|
+
json(): Promise<unknown>;
|
|
20
|
+
text(): Promise<string>;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/transcript/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAElE,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,2GAA2G;AAC3G,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAC/C,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/transcript/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purdue Brightspace MCP Server
|
|
3
|
+
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
+
* Licensed under MIT — see LICENSE file for details.
|
|
5
|
+
*/
|
|
6
|
+
import type { FetchLike, TranscriptResult } from "./types.js";
|
|
7
|
+
export declare function getYouTubeTranscript(videoId: string, fetchImpl: FetchLike): Promise<TranscriptResult>;
|
|
8
|
+
//# sourceMappingURL=youtube.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../../src/utils/transcript/youtube.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAyB9D,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA0B3G"}
|