dsh-zju-lecture-note 2.2.7 → 2.2.9
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/ATTRIBUTION.md +1 -1
- package/CHANGELOG.md +108 -2
- package/README.md +57 -25
- package/SECURITY.md +96 -51
- package/docs/technical.md +98 -40
- package/lib/bridge.js +12 -2
- package/lib/client.js +142 -36
- package/lib/index.js +130 -22
- package/lib/tools.js +14 -11
- package/lib/tools.schema.json +14 -11
- package/mcp.json +21 -0
- package/mcp_server.py +258 -43
- package/package.json +5 -2
- package/plugin.json +19 -0
- package/server.mjs +118 -0
- package/skills/scholia-notes.manifest.json +1 -1
- package/skills/zju-lecture-summarizer/SKILL.md +46 -9
- package/skills/zju-lecture-summarizer/SLIDES.md +58 -14
- package/skills/zju-lecture-summarizer-help/SKILL.md +2 -2
- package/skills/zju-lecture-summarizer-help.manifest.json +4 -4
- package/skills/zju-lecture-summarizer-login.manifest.json +1 -1
- package/skills/zju-lecture-summarizer.manifest.json +6 -6
- package/zju_lecture/__init__.py +6 -0
- package/zju_lecture/browser_login.py +176 -222
- package/zju_lecture/cli.py +24 -2
- package/zju_lecture/client.py +325 -116
- package/zju_lecture/cookies.py +43 -4
- package/zju_lecture/credential_store.py +621 -0
- package/zju_lecture/deps.py +16 -0
- package/zju_lecture/formatter.py +201 -3
- package/zju_lecture/handout.py +29 -3
- package/zju_lecture/slides.py +9 -7
- package/zju_lecture/study_notes.py +4 -0
package/lib/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-zju-lecture-note — DeepSeek Harness 原生插件。
|
|
3
3
|
*
|
|
4
|
-
* 把浙大智云课堂(classroom.zju.edu.cn
|
|
4
|
+
* 把浙大智云课堂(classroom.zju.edu.cn)与互动式课堂
|
|
5
|
+
* (interactivemeta.cmc.zju.edu.cn)回放变成可复习的结构化讲义:
|
|
5
6
|
* 以语音字幕 + 本地课件为主链路;投影 PPT 截图是可选模块,由 `enableSlides` 开关。
|
|
6
7
|
* 产出带时间戳、公式可渲染的讲义。
|
|
7
8
|
*
|
|
@@ -189,14 +190,25 @@ const Config = Schema.object({
|
|
|
189
190
|
enableSlides: Schema.boolean()
|
|
190
191
|
.description(
|
|
191
192
|
"启用「PPT 投影抓取」可选模块(默认关闭):开启后注册 zju_fetch_slides,"
|
|
192
|
-
+ "
|
|
193
|
+
+ "写讲义前会抓取投影截图清单;是否下载图片、是否把投影当作内容来源,"
|
|
194
|
+
+ "分别由 slidesAsSource / embedSlideImages 决定。关闭时不注册投影工具、不下载截图;"
|
|
193
195
|
+ "字幕鉴权由核心链路自动完成,与投影独立。",
|
|
194
196
|
)
|
|
195
197
|
.default(false)
|
|
196
198
|
.volatile(),
|
|
199
|
+
slidesAsSource: Schema.boolean()
|
|
200
|
+
.description(
|
|
201
|
+
"把课堂投影截图作为讲义内容来源(默认关闭;需先开启「PPT 投影抓取」):"
|
|
202
|
+
+ "开启后写讲义前会抓取并下载一次投影截图,把幻灯片上的定义、公式、图例与例题"
|
|
203
|
+
+ "同字幕对照写入讲义;模型看不到本地图片时不得臆造幻灯片文字,只在文末列出截图索引。"
|
|
204
|
+
+ "只需要插图、不需要以投影为内容来源时保持关闭。",
|
|
205
|
+
)
|
|
206
|
+
.default(false)
|
|
207
|
+
.volatile(),
|
|
197
208
|
embedSlideImages: Schema.boolean()
|
|
198
209
|
.description(
|
|
199
|
-
"把投影截图引用进讲义(需先开启「PPT 投影抓取」;默认关闭,节省下载时间与视觉 token
|
|
210
|
+
"把投影截图引用进讲义(需先开启「PPT 投影抓取」;默认关闭,节省下载时间与视觉 token):"
|
|
211
|
+
+ "只控制是否插入 3–8 张关键页,不改变「投影是否作为内容来源」。",
|
|
200
212
|
)
|
|
201
213
|
.default(false)
|
|
202
214
|
.volatile(),
|
|
@@ -278,6 +290,7 @@ function featureFlags(config = {}) {
|
|
|
278
290
|
renderPdf: value("renderPdf") !== false,
|
|
279
291
|
enableStudyNotes: value("enableStudyNotes") === true,
|
|
280
292
|
enableSlides,
|
|
293
|
+
slidesAsSource: enableSlides && value("slidesAsSource") === true,
|
|
281
294
|
embedSlideImages: enableSlides && value("embedSlideImages") === true,
|
|
282
295
|
enableLoginTools: value("enableLoginTools") === true,
|
|
283
296
|
typstAutoInstall: value("typstAutoInstall") !== false,
|
|
@@ -303,6 +316,7 @@ function bridgeOptions(config = {}) {
|
|
|
303
316
|
python: String(readSetting(config, "python") ?? ""),
|
|
304
317
|
timeoutMs: Number.isFinite(timeout) && timeout > 0 ? timeout : 120000,
|
|
305
318
|
enableSlides: flags.enableSlides,
|
|
319
|
+
slidesAsSource: flags.slidesAsSource,
|
|
306
320
|
embedSlideImages: flags.embedSlideImages,
|
|
307
321
|
enableStudyNotes: flags.enableStudyNotes,
|
|
308
322
|
enableLoginTools: flags.enableLoginTools,
|
|
@@ -352,32 +366,34 @@ function toolTimeoutFor(toolName, timeoutMs) {
|
|
|
352
366
|
}
|
|
353
367
|
|
|
354
368
|
const SYSTEM_PROMPT = [
|
|
355
|
-
"适用范围:仅处理浙大智云课堂(classroom.zju.edu.cn
|
|
356
|
-
"主链路:把链接或 sub_id 直接交给 zju_fetch_transcript(默认 per_minute;长课 chunked;同一节课只抓一次,per_segment 仅在确实需要秒级时间戳时用)→
|
|
369
|
+
"适用范围:仅处理浙大智云课堂(classroom.zju.edu.cn)与互动式课堂(interactivemeta.cmc.zju.edu.cn)回放与讲义任务;两种回放链接(普通 query 与 #/replay hash 路由)都直接接受;其他任务请忽略本段。",
|
|
370
|
+
"主链路:把链接或 sub_id 直接交给 zju_fetch_transcript(默认 per_minute;长课 chunked;同一节课只抓一次,per_segment 仅在确实需要秒级时间戳时用)→ 按下面的材料规则补齐投影或课件 → zju_write_note 一次写入。write_note 会自动命名、拒绝静默覆盖、修公式、校验,并按设置自动排版同名 PDF;不要再调 zju_parse_url,也不要对同一份讲义重复调 zju_check_note。",
|
|
357
371
|
"讲义默认按「复习版」写:每节保留 [HH:MM];老师讲过的例题整理成「题目 → 切入点 → 关键步骤 → 易错点」,本节没有例题就写「本节无例题」,不要编题;文末给 3–5 道自测题(答案用多行 <details> 折叠)与 5–10 条考点预测。",
|
|
358
372
|
"例题/定理/定义/证明要写成行首标记([例] 标题 —— 正文 / [定理] … / [定义] … / [证明] …),"
|
|
359
373
|
+ "不要写成 `#### 例 1:…` 或 `**证明**`——那种写法在 PDF 里只是小标题和粗体,排不出方框(工具会报 pseudo_box 警告)。",
|
|
360
374
|
"用户只说「整理这节课」时按完整链路一次做完,不要只交字幕摘要;只有明确说「只要速记 / 只要 Markdown」时才省略这些增强内容。",
|
|
361
375
|
"交付时给出 Markdown 路径;有 PDF 时一并给出 PDF 路径。不要声称看过自己无法查看的图片。",
|
|
362
376
|
"隐私边界:登录态只在本机安全保存或进程内存中使用;工具不接受、也不回显 Cookie / 密码 / token 明文;不要向用户索要 Cookie,或把它写进对话、文件、命令。",
|
|
363
|
-
"字幕先匿名;401/403
|
|
377
|
+
"字幕先匿名;401/403 时先自动使用本机登录态并重试,主站失败时工具会自动回退互动式课堂后端,不要自行换主机或拼 URL。仍失败就调用 zju_login(url=<这节课链接>) 打开独立登录窗口,让用户在窗口里正常登录(成功后自动关闭并安全保存),然后重试字幕一次。不要让用户开开发者工具、手工配置 Cookie 文件,也不要把 401/403 直接归因校园网。",
|
|
364
378
|
].join("\n");
|
|
365
379
|
|
|
366
380
|
/**
|
|
367
381
|
* The note-writing instruction for projected-slide images.
|
|
368
382
|
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
383
|
+
* `embedSlideImages` only decides whether screenshots go into the Markdown;
|
|
384
|
+
* whether the projection is a *content source* is `slidesAsSource`. Keeping
|
|
385
|
+
* the two apart matters because "read the slides" and "paste the slides" have
|
|
386
|
+
* different failure modes: a host without vision can still use the list as an
|
|
387
|
+
* index, but it must not pretend to have read an image.
|
|
371
388
|
*/
|
|
372
389
|
function slideImageRule(enabled) {
|
|
373
390
|
return enabled
|
|
374
|
-
? "
|
|
375
|
-
+ "
|
|
376
|
-
+ "按讲义所在目录的相对路径插入 Markdown(例如 );"
|
|
391
|
+
? "讲义插图模式已开启:从下载结果里挑 3–8 张关键页(定义、示意图、公式推导、例题),"
|
|
392
|
+
+ "按讲义所在目录的相对路径插入 Markdown(例如 );"
|
|
377
393
|
+ "如果宿主不能查看本地图片,不要把截图当作已读文字,只在文末列出截图索引。"
|
|
378
|
-
+ "
|
|
379
|
-
: "
|
|
380
|
-
+ "用户明确要求看图时再调用 zju_fetch_slides(download=true),并在文末列截图索引。";
|
|
394
|
+
+ "不要一次塞入全部截图或图片字节。"
|
|
395
|
+
: "讲义插图模式关闭(节省下载时间与 token):不要插入截图;"
|
|
396
|
+
+ "用户明确要求看图时再调用 zju_fetch_slides(download=true, confirm=true),并在文末列截图索引。";
|
|
381
397
|
}
|
|
382
398
|
|
|
383
399
|
/**
|
|
@@ -387,15 +403,68 @@ function slideImageRule(enabled) {
|
|
|
387
403
|
* registered, so the prompt must not lead the model into calling them (or
|
|
388
404
|
* reading browser cookies "just in case"). The transcript path never depends
|
|
389
405
|
* on any of this.
|
|
406
|
+
*
|
|
407
|
+
* When the module is on, the prompt always names the projected-slide step in
|
|
408
|
+
* the material order. The previous wording only asked for a call when
|
|
409
|
+
* `embedSlideImages` was on, so a user who enabled "抓取投影截图" alone saw the
|
|
410
|
+
* agent skip the tool entirely. That is a configuration inconsistency, not a
|
|
411
|
+
* model preference: the switch promised capture and the prompt forbade it.
|
|
390
412
|
*/
|
|
391
|
-
function slidesFeatureRule(enableSlides, embedSlideImages) {
|
|
413
|
+
function slidesFeatureRule(enableSlides, embedSlideImages, slidesAsSource = false) {
|
|
392
414
|
if (!enableSlides) {
|
|
393
415
|
return "PPT 投影抓取已关闭(插件设置 enableSlides=false):本会话没有注册 zju_fetch_slides,"
|
|
394
416
|
+ "不要尝试抓取或引用投影截图,也不要为了投影额外读取浏览器 Cookie;"
|
|
395
417
|
+ "字幕鉴权由字幕工具自行处理,需要登录时用 zju_login。只用语音字幕与本地课件生成讲义。"
|
|
396
418
|
+ "用户明确要投影画面时,告诉他在插件设置里打开「启用 PPT 投影抓取」后重试。";
|
|
397
419
|
}
|
|
398
|
-
|
|
420
|
+
if (slidesAsSource) {
|
|
421
|
+
return "PPT 投影抓取已开启(enableSlides=true),投影作为讲义来源已开启(slidesAsSource=true):"
|
|
422
|
+
+ "写讲义前必须先调用一次 zju_fetch_slides(url_or_sub_id=<回放链接>, download=true, confirm=true),"
|
|
423
|
+
+ "整节课只抓一次;主站为空/失败时工具会自动回退互动式课堂后端,不要自行拼 URL 或反复重试。"
|
|
424
|
+
+ "把投影当作与字幕并列的内容来源:定义、公式、图例、例题按幻灯片与字幕互相校正,写进对应小节。"
|
|
425
|
+
+ "如果当前宿主能读取本地图片,先按返回的「页时间轴」抽查 15–25 页关键截图"
|
|
426
|
+
+ "(没有时间轴时按页码均匀抽样;从字幕挑 8–12 个关键节点,每个节点读最近 1–2 页;"
|
|
427
|
+
+ "超过 60 页的 deck 不要逐页通读);"
|
|
428
|
+
+ "不能读图时不要臆造幻灯片文字,"
|
|
429
|
+
+ "只在文末列「课堂投影截图索引」并说明哪些内容未核对。"
|
|
430
|
+
+ "登录失败时按工具返回调用 zju_login 后重试一次;仍失败就降级为纯字幕,并在讲义开头注明投影未使用。"
|
|
431
|
+
+ (embedSlideImages
|
|
432
|
+
? "讲义插图模式已开启:再挑 3–8 张关键页按相对路径插入。"
|
|
433
|
+
: "本次不插入截图(embedSlideImages=false),但投影内容仍必须用于正文。");
|
|
434
|
+
}
|
|
435
|
+
if (embedSlideImages) {
|
|
436
|
+
return "PPT 投影抓取已开启(enableSlides=true,讲义插图模式已开启):"
|
|
437
|
+
+ "写讲义前先调用一次 zju_fetch_slides(download=true, confirm=true)(整节课只抓一次),"
|
|
438
|
+
+ "从返回的截图里挑 3–8 张关键页插入对应小节;"
|
|
439
|
+
+ "如果宿主不能查看本地图片,只把截图当作索引,不要臆造幻灯片文字。"
|
|
440
|
+
+ "用户明确说不要投影时才跳过。";
|
|
441
|
+
}
|
|
442
|
+
return "PPT 投影抓取已开启(enableSlides=true,slidesAsSource=false、embedSlideImages=false):"
|
|
443
|
+
+ "写讲义前调用一次 zju_fetch_slides(download=false) 核对投影清单(整节课只抓一次);"
|
|
444
|
+
+ "不要下载截图、不要插入图片,也不要把截图当作内容来源。"
|
|
445
|
+
+ "如果只是登录态不可用,跳过投影并用字幕照常生成讲义,不要为了投影打断用户。"
|
|
446
|
+
+ "用户明确要看投影时再传 download=true, confirm=true 并列出截图索引。";
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* The material order for this session, stated once and before the generic
|
|
451
|
+
* pipeline. It is what makes "投影讲义" presets behave like a real pipeline
|
|
452
|
+
* step instead of an optional appendix the model may or may not read.
|
|
453
|
+
*/
|
|
454
|
+
function materialRule(flags) {
|
|
455
|
+
if (!flags.enableSlides) return "";
|
|
456
|
+
if (flags.slidesAsSource) {
|
|
457
|
+
return "材料顺序(投影讲义模式):zju_fetch_transcript 抓字幕 → "
|
|
458
|
+
+ "zju_fetch_slides(download=true, confirm=true) 抓一次投影 →"
|
|
459
|
+
+ "(可选 zju_extract_courseware)→ zju_write_note。投影是必做材料,不是可选项;整节课只抓一次。";
|
|
460
|
+
}
|
|
461
|
+
if (flags.embedSlideImages) {
|
|
462
|
+
return "材料顺序:zju_fetch_transcript 抓字幕 → "
|
|
463
|
+
+ "zju_fetch_slides(download=true, confirm=true) 抓一次投影 →"
|
|
464
|
+
+ "(可选 zju_extract_courseware)→ zju_write_note。投影截图用于插图,整节课只抓一次。";
|
|
465
|
+
}
|
|
466
|
+
return "材料顺序:zju_fetch_transcript 抓字幕 → zju_fetch_slides(download=false) 核对一次投影清单 →"
|
|
467
|
+
+ "(可选 zju_extract_courseware)→ zju_write_note。投影清单不下载、不插图。";
|
|
399
468
|
}
|
|
400
469
|
|
|
401
470
|
function pdfFeatureRule(enabled) {
|
|
@@ -436,8 +505,9 @@ function loginFeatureRule(enabled) {
|
|
|
436
505
|
const core = "`zju_login` 不受本开关影响,始终可用:需要登录时调用它打开独立登录窗口,"
|
|
437
506
|
+ "用户只需在窗口里正常登录,窗口会自动关闭并把登录态安全保存在本机;"
|
|
438
507
|
+ "不要让用户开开发者工具、手工配置 Cookie 文件或把凭据贴进对话。"
|
|
439
|
-
+ "字幕鉴权也不依赖本开关:先匿名,401/403 时自动读取本机登录态并用 Bearer
|
|
440
|
-
+ "
|
|
508
|
+
+ "字幕鉴权也不依赖本开关:先匿名,401/403 时自动读取本机登录态并用 Bearer 重试,"
|
|
509
|
+
+ "主站失败会自动回退互动式课堂后端;仍失败就调用 zju_login,登录成功后重试字幕一次,"
|
|
510
|
+
+ "不要反复重试、擅断校园网或自行更换后端。";
|
|
441
511
|
return enabled
|
|
442
512
|
? "登录辅助工具已开启(zju_get_video_url / zju_read_browser_cookie):仅在需要视频直链或手动检查登录态时调用,"
|
|
443
513
|
+ "二者都不会回显 Cookie。" + core
|
|
@@ -456,7 +526,8 @@ function skillFeatureRule(enabled) {
|
|
|
456
526
|
function buildSystemPrompt(flags) {
|
|
457
527
|
return [
|
|
458
528
|
SYSTEM_PROMPT,
|
|
459
|
-
|
|
529
|
+
materialRule(flags),
|
|
530
|
+
slidesFeatureRule(flags.enableSlides, flags.embedSlideImages, flags.slidesAsSource),
|
|
460
531
|
pdfFeatureRule(flags.renderPdf),
|
|
461
532
|
studyFeatureRule(flags.enableStudyNotes, flags.registerSkill),
|
|
462
533
|
formulaFeatureRule(flags.registerSkill),
|
|
@@ -477,7 +548,7 @@ const jsonOutput = {
|
|
|
477
548
|
|
|
478
549
|
/** 每个工具在 UI 上的呈现方式与超时。 */
|
|
479
550
|
const TOOL_PRESENT = {
|
|
480
|
-
zju_parse_url: { title: "
|
|
551
|
+
zju_parse_url: { title: "解析智云课堂/互动式课堂回放链接", kind: "read" },
|
|
481
552
|
zju_fetch_transcript: { title: "抓取课堂语音字幕", kind: "fetch" },
|
|
482
553
|
zju_fetch_slides: { title: "抓取/下载课堂投影 PPT", kind: "fetch" },
|
|
483
554
|
zju_extract_courseware: { title: "提取本地课件文本", kind: "read" },
|
|
@@ -531,13 +602,41 @@ function splitFrontmatter(raw) {
|
|
|
531
602
|
return { description, body };
|
|
532
603
|
}
|
|
533
604
|
|
|
605
|
+
/**
|
|
606
|
+
* The mode-specific paragraph appended to the transcript Skill.
|
|
607
|
+
*
|
|
608
|
+
* `SLIDES.md` documents every projection mode, but the model reads a Skill
|
|
609
|
+
* selectively. Stating this session's mode at the end keeps "仅注册 / 插图 /
|
|
610
|
+
* 讲义素材" from being confused with one another, and it is regenerated when
|
|
611
|
+
* the settings change (`syncSkills` includes `slidesAsSource` in its signature).
|
|
612
|
+
*/
|
|
613
|
+
function slidesModeAppendix(flags) {
|
|
614
|
+
if (!flags.enableSlides) return "";
|
|
615
|
+
if (flags.slidesAsSource) {
|
|
616
|
+
return "## 本次会话:投影作为讲义来源\n"
|
|
617
|
+
+ "系统提示已开启 slidesAsSource。写讲义前必须先调用一次 "
|
|
618
|
+
+ "zju_fetch_slides(download=true, confirm=true),整节课只抓一次;"
|
|
619
|
+
+ "把幻灯片上的定义、公式、图例、例题与字幕对照写进正文。"
|
|
620
|
+
+ "宿主不能读图时不要臆造幻灯片文字,只在文末列截图索引并说明哪些内容未核对。"
|
|
621
|
+
+ "登录失败按提示调用 zju_login 后重试一次,仍失败则降级为纯字幕并在讲义开头注明。";
|
|
622
|
+
}
|
|
623
|
+
if (flags.embedSlideImages) {
|
|
624
|
+
return "## 本次会话:投影插图\n"
|
|
625
|
+
+ "系统提示已开启 embedSlideImages。写讲义前抓一次投影(download=true, confirm=true),"
|
|
626
|
+
+ "挑 3–8 张关键页插入对应小节;宿主不能读图时不要臆造幻灯片文字,只在文末列索引。";
|
|
627
|
+
}
|
|
628
|
+
return "## 本次会话:投影清单\n"
|
|
629
|
+
+ "系统提示已开启 enableSlides。写讲义前调用一次 zju_fetch_slides(download=false) 核对清单;"
|
|
630
|
+
+ "不下载、不插图、不把截图当内容来源;登录态不可用时直接跳过投影,用字幕照常生成讲义。";
|
|
631
|
+
}
|
|
632
|
+
|
|
534
633
|
/**
|
|
535
634
|
* Read the bundled skills for in-memory registration.
|
|
536
635
|
*
|
|
537
636
|
* The plugin is installed under a pnpm store path, so the skill files ship
|
|
538
637
|
* inside the package and are read from there; nothing is copied into the user's
|
|
539
638
|
* home directory. The projection appendix is concatenated only when the
|
|
540
|
-
* optional module is enabled.
|
|
639
|
+
* optional module is enabled, followed by this session's projection mode.
|
|
541
640
|
*
|
|
542
641
|
* @param {object|boolean} configOrSlides plugin config (or a bare slides flag)
|
|
543
642
|
* @returns {Array<object>} skill descriptors ready for the registry
|
|
@@ -558,6 +657,7 @@ function readBundledSkills(configOrSlides = {}) {
|
|
|
558
657
|
const raw = readFileSync(file, "utf8");
|
|
559
658
|
const { description, body } = splitFrontmatter(raw);
|
|
560
659
|
let content = body;
|
|
660
|
+
const carriesSlides = spec.appendices.some((appendix) => appendix.when === "slides");
|
|
561
661
|
for (const appendix of spec.appendices) {
|
|
562
662
|
if (appendix.when === "slides" && !flags.enableSlides) continue;
|
|
563
663
|
const appendixFile = appendix.path;
|
|
@@ -568,6 +668,10 @@ function readBundledSkills(configOrSlides = {}) {
|
|
|
568
668
|
const text = splitFrontmatter(readFileSync(appendixFile, "utf8")).body.trim();
|
|
569
669
|
if (text) content = `${body.trimEnd()}\n\n---\n\n${text}\n`;
|
|
570
670
|
}
|
|
671
|
+
if (carriesSlides && flags.enableSlides) {
|
|
672
|
+
const modeNote = slidesModeAppendix(flags);
|
|
673
|
+
if (modeNote) content = `${content.trimEnd()}\n\n---\n\n${modeNote}\n`;
|
|
674
|
+
}
|
|
571
675
|
const descriptor = {
|
|
572
676
|
name: spec.name,
|
|
573
677
|
description: description || spec.fallbackDescription,
|
|
@@ -713,13 +817,15 @@ function apply(ctx, config = {}) {
|
|
|
713
817
|
}
|
|
714
818
|
};
|
|
715
819
|
|
|
716
|
-
/** Reconcile the in-memory Skill set with
|
|
820
|
+
/** Reconcile the in-memory Skill set with the projection / study switches. */
|
|
717
821
|
const syncSkills = () => {
|
|
718
822
|
if (!skillsScope) return;
|
|
719
823
|
const flags = featureFlags(config);
|
|
720
824
|
const signature = JSON.stringify({
|
|
721
825
|
registerSkill: flags.registerSkill,
|
|
722
826
|
enableSlides: flags.enableSlides,
|
|
827
|
+
slidesAsSource: flags.slidesAsSource,
|
|
828
|
+
embedSlideImages: flags.embedSlideImages,
|
|
723
829
|
enableStudyNotes: flags.enableStudyNotes,
|
|
724
830
|
});
|
|
725
831
|
if (signature === skillSignature) return;
|
|
@@ -802,11 +908,13 @@ export {
|
|
|
802
908
|
bridgeOptions,
|
|
803
909
|
buildSystemPrompt,
|
|
804
910
|
featureFlags,
|
|
911
|
+
materialRule,
|
|
805
912
|
name,
|
|
806
913
|
readBundledSkills,
|
|
807
914
|
readSetting,
|
|
808
915
|
registerableTools,
|
|
809
916
|
slideImageRule,
|
|
810
917
|
slidesFeatureRule,
|
|
918
|
+
slidesModeAppendix,
|
|
811
919
|
splitFrontmatter,
|
|
812
920
|
};
|
package/lib/tools.js
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
export const ZJU_TOOLS = [
|
|
10
10
|
{
|
|
11
11
|
"name": "zju_parse_url",
|
|
12
|
-
"description": "解析浙大智云课堂
|
|
12
|
+
"description": "解析浙大智云课堂 / 互动式课堂回放链接,提取 sub_id、course_id 与 tenant_code;兼容 classroom.zju.edu.cn/livingroom?... 与 interactivemeta.cmc.zju.edu.cn/#/replay?... 两种 URL。",
|
|
13
13
|
"parameters": {
|
|
14
14
|
"url": {
|
|
15
|
-
"description": "
|
|
15
|
+
"description": "回放 URL(classroom.zju.edu.cn/livingroom?... 或 interactivemeta.cmc.zju.edu.cn/#/replay?...)或纯 sub_id 数字",
|
|
16
16
|
"type": "string",
|
|
17
17
|
"required": true
|
|
18
18
|
}
|
|
@@ -20,10 +20,10 @@ export const ZJU_TOOLS = [
|
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"name": "zju_fetch_transcript",
|
|
23
|
-
"description": "
|
|
23
|
+
"description": "抓取智云课堂 / 互动式课堂某节课的语音识别字幕。先匿名;401/403 时自动用本机登录态重试一次,并自动回退互动式课堂后端。登录态只能来自本机 Edge 或 ZJU_COOKIE_FILE,不要传 Cookie。默认 per_minute 带时间戳;长课用 chunked;同一节课只抓一次,per_segment 仅在确实需要秒级时间戳时用。",
|
|
24
24
|
"parameters": {
|
|
25
25
|
"url_or_sub_id": {
|
|
26
|
-
"description": "回放 URL
|
|
26
|
+
"description": "回放 URL(含互动式课堂 #/replay hash 链接)或 sub_id",
|
|
27
27
|
"type": "string",
|
|
28
28
|
"required": true
|
|
29
29
|
},
|
|
@@ -60,10 +60,10 @@ export const ZJU_TOOLS = [
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"name": "zju_fetch_slides",
|
|
63
|
-
"description": "
|
|
63
|
+
"description": "(投影模块)抓取智云课堂 / 互动式课堂投影 PPT 截图清单。search-ppt 返回的是投影截图,不是文字层/OCR;主站为空时自动回退互动式课堂后端。download=true 时下载截图并合成 PDF。返回紧凑索引:截图目录/文件名模式、页时间轴、建议抽查页与引用示例。当插件把投影作为讲义来源(slidesAsSource / ZJU_SLIDES_SOURCE=1)时,写讲义前应调用一次并传 download=true, confirm=true;download 省略时跟随 slidesAsSource / embedSlideImages(ZJU_SLIDES_SOURCE / ZJU_EMBED_SLIDES)。需要登录态(Cookie 含 _token,由服务端本地解析,不接受也不回显 Cookie)。抓不到时返回诊断,可降级为纯字幕总结。dsh 的 enableSlides(ZJU_ENABLE_SLIDES)关闭时本工具不注册。",
|
|
64
64
|
"parameters": {
|
|
65
65
|
"url_or_sub_id": {
|
|
66
|
-
"description": "回放 URL(通常含 course_id
|
|
66
|
+
"description": "回放 URL(通常含 course_id,支持互动式课堂 hash 链接)或 sub_id",
|
|
67
67
|
"type": "string",
|
|
68
68
|
"required": true
|
|
69
69
|
},
|
|
@@ -77,7 +77,7 @@ export const ZJU_TOOLS = [
|
|
|
77
77
|
"type": "string"
|
|
78
78
|
},
|
|
79
79
|
"download": {
|
|
80
|
-
"description": "是否下载截图到工作区并合成 PDF。省略时跟随插件设置(
|
|
80
|
+
"description": "是否下载截图到工作区并合成 PDF。省略时跟随插件设置(slidesAsSource 或 embedSlideImages 开启即下载;环境变量 ZJU_SLIDES_SOURCE / ZJU_EMBED_SLIDES);显式传 true/false 可覆盖。一节 1 小时的课通常有几十到几百张截图",
|
|
81
81
|
"type": "boolean"
|
|
82
82
|
},
|
|
83
83
|
"output_dir": {
|
|
@@ -164,7 +164,7 @@ export const ZJU_TOOLS = [
|
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
"name": "zju_write_note",
|
|
167
|
-
"description": "写入讲义 Markdown
|
|
167
|
+
"description": "写入讲义 Markdown(content 或 content_file 二选一):自动命名(知识总结-<日期>-<课程>-<主题>)、默认拒绝静默覆盖、写前修正公式、写后返回规范检查,并按设置自动排版同名 PDF——写文件、检查、出 PDF 一次完成。只写工作区内的 .md 文件。",
|
|
168
168
|
"parameters": {
|
|
169
169
|
"sub_id": {
|
|
170
170
|
"description": "课程回放的 sub_id,用于追溯(不传 name 时也参与文件名)",
|
|
@@ -172,9 +172,12 @@ export const ZJU_TOOLS = [
|
|
|
172
172
|
"required": true
|
|
173
173
|
},
|
|
174
174
|
"content": {
|
|
175
|
-
"description": "讲义 Markdown
|
|
176
|
-
"type": "string"
|
|
177
|
-
|
|
175
|
+
"description": "讲义 Markdown 全文(与 content_file 二选一)",
|
|
176
|
+
"type": "string"
|
|
177
|
+
},
|
|
178
|
+
"content_file": {
|
|
179
|
+
"description": "从工作区内的 Markdown 草稿读取讲义全文(与 content 二选一)。长篇讲义建议先用 write 落盘,再传此路径,避免在 run_code 里重复粘贴。",
|
|
180
|
+
"type": "string"
|
|
178
181
|
},
|
|
179
182
|
"name": {
|
|
180
183
|
"description": "讲义文件名(可省略 .md),由你按上课时间与本节内容命名,推荐 知识总结-<上课日期 YYYY-MM-DD>-<课程简称>-<本节主题>;拿不到上课日期时省略日期段,不要用当天日期顶替",
|
package/lib/tools.schema.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
3
|
"name": "zju_parse_url",
|
|
4
|
-
"description": "解析浙大智云课堂
|
|
4
|
+
"description": "解析浙大智云课堂 / 互动式课堂回放链接,提取 sub_id、course_id 与 tenant_code;兼容 classroom.zju.edu.cn/livingroom?... 与 interactivemeta.cmc.zju.edu.cn/#/replay?... 两种 URL。",
|
|
5
5
|
"parameters": {
|
|
6
6
|
"url": {
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "回放 URL(classroom.zju.edu.cn/livingroom?... 或 interactivemeta.cmc.zju.edu.cn/#/replay?...)或纯 sub_id 数字",
|
|
8
8
|
"type": "string",
|
|
9
9
|
"required": true
|
|
10
10
|
}
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "zju_fetch_transcript",
|
|
15
|
-
"description": "
|
|
15
|
+
"description": "抓取智云课堂 / 互动式课堂某节课的语音识别字幕。先匿名;401/403 时自动用本机登录态重试一次,并自动回退互动式课堂后端。登录态只能来自本机 Edge 或 ZJU_COOKIE_FILE,不要传 Cookie。默认 per_minute 带时间戳;长课用 chunked;同一节课只抓一次,per_segment 仅在确实需要秒级时间戳时用。",
|
|
16
16
|
"parameters": {
|
|
17
17
|
"url_or_sub_id": {
|
|
18
|
-
"description": "回放 URL
|
|
18
|
+
"description": "回放 URL(含互动式课堂 #/replay hash 链接)或 sub_id",
|
|
19
19
|
"type": "string",
|
|
20
20
|
"required": true
|
|
21
21
|
},
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"name": "zju_fetch_slides",
|
|
55
|
-
"description": "
|
|
55
|
+
"description": "(投影模块)抓取智云课堂 / 互动式课堂投影 PPT 截图清单。search-ppt 返回的是投影截图,不是文字层/OCR;主站为空时自动回退互动式课堂后端。download=true 时下载截图并合成 PDF。返回紧凑索引:截图目录/文件名模式、页时间轴、建议抽查页与引用示例。当插件把投影作为讲义来源(slidesAsSource / ZJU_SLIDES_SOURCE=1)时,写讲义前应调用一次并传 download=true, confirm=true;download 省略时跟随 slidesAsSource / embedSlideImages(ZJU_SLIDES_SOURCE / ZJU_EMBED_SLIDES)。需要登录态(Cookie 含 _token,由服务端本地解析,不接受也不回显 Cookie)。抓不到时返回诊断,可降级为纯字幕总结。dsh 的 enableSlides(ZJU_ENABLE_SLIDES)关闭时本工具不注册。",
|
|
56
56
|
"parameters": {
|
|
57
57
|
"url_or_sub_id": {
|
|
58
|
-
"description": "回放 URL(通常含 course_id
|
|
58
|
+
"description": "回放 URL(通常含 course_id,支持互动式课堂 hash 链接)或 sub_id",
|
|
59
59
|
"type": "string",
|
|
60
60
|
"required": true
|
|
61
61
|
},
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"type": "string"
|
|
70
70
|
},
|
|
71
71
|
"download": {
|
|
72
|
-
"description": "是否下载截图到工作区并合成 PDF。省略时跟随插件设置(
|
|
72
|
+
"description": "是否下载截图到工作区并合成 PDF。省略时跟随插件设置(slidesAsSource 或 embedSlideImages 开启即下载;环境变量 ZJU_SLIDES_SOURCE / ZJU_EMBED_SLIDES);显式传 true/false 可覆盖。一节 1 小时的课通常有几十到几百张截图",
|
|
73
73
|
"type": "boolean"
|
|
74
74
|
},
|
|
75
75
|
"output_dir": {
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
"name": "zju_write_note",
|
|
159
|
-
"description": "写入讲义 Markdown
|
|
159
|
+
"description": "写入讲义 Markdown(content 或 content_file 二选一):自动命名(知识总结-<日期>-<课程>-<主题>)、默认拒绝静默覆盖、写前修正公式、写后返回规范检查,并按设置自动排版同名 PDF——写文件、检查、出 PDF 一次完成。只写工作区内的 .md 文件。",
|
|
160
160
|
"parameters": {
|
|
161
161
|
"sub_id": {
|
|
162
162
|
"description": "课程回放的 sub_id,用于追溯(不传 name 时也参与文件名)",
|
|
@@ -164,9 +164,12 @@
|
|
|
164
164
|
"required": true
|
|
165
165
|
},
|
|
166
166
|
"content": {
|
|
167
|
-
"description": "讲义 Markdown
|
|
168
|
-
"type": "string"
|
|
169
|
-
|
|
167
|
+
"description": "讲义 Markdown 全文(与 content_file 二选一)",
|
|
168
|
+
"type": "string"
|
|
169
|
+
},
|
|
170
|
+
"content_file": {
|
|
171
|
+
"description": "从工作区内的 Markdown 草稿读取讲义全文(与 content 二选一)。长篇讲义建议先用 write 落盘,再传此路径,避免在 run_code 里重复粘贴。",
|
|
172
|
+
"type": "string"
|
|
170
173
|
},
|
|
171
174
|
"name": {
|
|
172
175
|
"description": "讲义文件名(可省略 .md),由你按上课时间与本节内容命名,推荐 知识总结-<上课日期 YYYY-MM-DD>-<课程简称>-<本节主题>;拿不到上课日期时省略日期段,不要用当天日期顶替",
|
package/mcp.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
|
|
3
|
+
"mcpServers": {
|
|
4
|
+
"zju-lecture": {
|
|
5
|
+
"type": "stdio",
|
|
6
|
+
"command": "node",
|
|
7
|
+
"args": [
|
|
8
|
+
"./server.mjs"
|
|
9
|
+
],
|
|
10
|
+
"env": {
|
|
11
|
+
"ZJU_ENABLE_SLIDES": "0",
|
|
12
|
+
"ZJU_SLIDES_SOURCE": "0",
|
|
13
|
+
"ZJU_EMBED_SLIDES": "0",
|
|
14
|
+
"ZJU_ENABLE_STUDY_NOTES": "0",
|
|
15
|
+
"ZJU_ENABLE_LOGIN_TOOLS": "0",
|
|
16
|
+
"ZJU_RENDER_PDF": "0",
|
|
17
|
+
"ZJU_TYPST_AUTO_INSTALL": "1"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|