dsh-animebar 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 V1Y0h
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,113 @@
1
- # Temporary Holding Version
1
+ # dsh-animebar
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 给 DeepSeek Harness 的看番工具:问一句「今天有什么番」,得到按评分排好的清单。
4
+
5
+ [中文](#中文) · [English](#english)
6
+
7
+ ---
8
+
9
+ ## 中文
10
+
11
+ ### 它做什么
12
+
13
+ 注册一个工具 `anime_today`,读 [Bangumi](https://bgm.tv) 的公开放送表,返回某一天在播的作品,含低分和没评分的,按分数排序。
14
+
15
+ ```
16
+ 今天有什么番
17
+ 周三有哪些番在播
18
+ 最近有什么剧场版动画
19
+ ```
20
+
21
+ `kind` 支持两种模式:
22
+
23
+ - `tv`(默认)— 每周放送表
24
+ - `movie` — 剧场版,翻页抓取后按评分排序
25
+
26
+ 返回结构:
27
+
28
+ ```json
29
+ { "weekday": 5, "total": 6, "items": [{ "title": "…", "score": 7.6, "url": "…" }] }
30
+ ```
31
+
32
+ ### 安装
33
+
34
+ ```sh
35
+ # 直接从仓库装
36
+ dsh plugin --profile desktop add github:V1Y0h/animebar-plugin
37
+ ```
38
+
39
+ 也可以把本地目录加进 **设置 → 插件**。安装后重启 DeepSeek Harness,工具才会注册。
40
+
41
+ npm 版本还没发布;发出去之后 `dsh plugin --profile desktop add dsh-animebar` 也能用。
42
+
43
+ ### 平台
44
+
45
+ 插件是纯 Host 侧 JavaScript,没有原生代码,所以只要能跑 DeepSeek Harness 就能用——macOS、Linux、Windows 都行。只要求能访问 Bangumi 的网络。
46
+
47
+ ### 配置
48
+
49
+ bundle 那一行支持 `config`:
50
+
51
+ | 字段 | 默认 | 说明 |
52
+ | --- | --- | --- |
53
+ | `minScore` | `0` | 低于这个分数的不返回;0 表示全部显示(含无评分) |
54
+ | `limit` | `8` | 最多返回几部 |
55
+
56
+ ### 数据与隐私
57
+
58
+ 插件在请求时调用 `api.bgm.tv`,不存任何东西、不做缓存、不分发任何番剧画面或内容。离开你机器的只有你查询的番名。
59
+
60
+ ### 限制
61
+
62
+ - 只覆盖 Bangumi 收录的作品,冷门和独立动画经常缺失。
63
+ - 打分人数很少的作品,分数不可靠。
64
+ - 不提供播放,看还得用你自己的播放器。
65
+
66
+ ### 写给插件作者
67
+
68
+ 做这个插件时有两处很费时间,而且都不明显:
69
+
70
+ 1. 本地链接安装的 bundle,依赖必须在包目录里自己 `pnpm add` 一遍。只写进 `package.json` 不够,因为 pnpm 对本地目录是 link 而不是安装。
71
+ 2. `defineTool` 必须提供 `output: { schema, render }`。少任何一个,激活时都会报 `Cannot read properties of undefined (reading 'render')`。
72
+
73
+ ### 许可
74
+
75
+ MIT。图标是作者本人绘制。
76
+
77
+ ---
78
+
79
+ ## English
80
+
81
+ Registers one tool, `anime_today`, which reads the public [Bangumi](https://bgm.tv) broadcast calendar and returns the titles airing on a weekday, filtered by rating and sorted by score.
82
+
83
+ ### Install
84
+
85
+ ```sh
86
+ dsh plugin --profile desktop add github:V1Y0h/animebar-plugin
87
+ ```
88
+
89
+ Or point **Plugins → Add plugin** at a local checkout. Restart DeepSeek Harness afterwards so the tool registers.
90
+
91
+ ### Modes
92
+
93
+ `kind: "tv"` (default) reads the weekly broadcast calendar. `kind: "movie"` searches theatrical films and ranks them by rating.
94
+
95
+ ### Configuration
96
+
97
+ | key | default | meaning |
98
+ | --- | --- | --- |
99
+ | `minScore` | `0` | skip titles rated below this; 0 keeps everything, including unrated |
100
+ | `limit` | `8` | maximum titles returned |
101
+
102
+ ### Data and privacy
103
+
104
+ The plugin calls `api.bgm.tv` at request time. It stores nothing, caches nothing, and ships no artwork or episode content.
105
+
106
+ ### Notes for plugin authors
107
+
108
+ 1. A locally linked bundle still needs its own `pnpm add <dependency>` inside the package directory.
109
+ 2. `defineTool` requires `output: { schema, render }`.
110
+
111
+ ### License
112
+
113
+ MIT. The icon is the author's own artwork.
@@ -0,0 +1,4 @@
1
+ - insert:
2
+ - id: animebar
3
+ name: dsh-animebar
4
+ config: {}
package/docs/DETAIL.md ADDED
@@ -0,0 +1,31 @@
1
+ # AnimeBar
2
+
3
+ 给 DeepSeek Harness 加一个查番表的工具。
4
+
5
+ ## 用法
6
+
7
+ 直接问「今天有什么番」,或者指定星期:
8
+
9
+ ```
10
+ 今天有什么好看的番
11
+ 周三有哪些番在播
12
+ ```
13
+
14
+ 工具会返回当天在播、评分不低于配置阈值的作品,按分数从高到低。
15
+
16
+ ## 配置
17
+
18
+ | 字段 | 默认 | 说明 |
19
+ | --- | --- | --- |
20
+ | `minScore` | 7 | 低于这个分数的不返回 |
21
+ | `limit` | 8 | 最多返回几部 |
22
+
23
+ ## 数据来源
24
+
25
+ 放送表来自 [Bangumi](https://bgm.tv) 的公开接口 `api.bgm.tv/calendar`,本插件不缓存、不分发任何番剧内容。
26
+
27
+ ## 限制
28
+
29
+ - 只覆盖 Bangumi 收录的作品,冷门/独立动画可能缺失
30
+ - 评分样本少的作品分数会失真(比如只有几个人打分)
31
+ - 不提供播放:想看还得自己用播放器
package/icon.svg ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="1254" height="1254" viewBox="0 0 1254 1254">
3
+ <path d="M 913 317 L 908 315 L 899 315 L 833 337 L 333 493 L 318 499 L 313 504 L 310 512 L 310 517 L 331 583 L 331 596 L 328 605 L 328 918 L 333 931 L 339 938 L 346 942 L 354 944 L 916 944 L 926 940 L 935 932 L 940 920 L 941 717 L 940 602 L 933 592 L 927 589 L 912 588 L 448 589 L 442 588 L 440 585 L 441 583 L 544 552 L 550 549 L 570 544 L 940 429 L 948 419 L 948 408 L 921 326 Z M 862 607 L 792 696 L 725 695 L 795 605 L 860 605 Z M 698 606 L 630 696 L 563 695 L 630 605 Z M 543 606 L 473 696 L 406 695 L 440 649 L 475 605 Z M 368 562 L 376 562 L 384 566 L 390 572 L 393 580 L 392 589 L 389 595 L 383 601 L 374 604 L 369 604 L 361 601 L 354 594 L 351 586 L 351 579 L 355 570 L 362 564 Z M 529 451 L 530 454 L 492 550 L 489 553 L 435 569 L 429 556 L 459 474 L 461 472 Z M 689 401 L 691 403 L 675 440 L 652 500 L 649 503 L 584 523 L 584 518 L 619 424 L 637 417 Z M 847 352 L 847 357 L 811 452 L 800 457 L 744 474 L 743 472 L 777 375 L 798 367 Z" fill="#000000" fill-rule="evenodd" clip-rule="evenodd"/>
4
+ </svg>
package/index.js ADDED
@@ -0,0 +1,85 @@
1
+ import { defineTool } from "@deepseek-ai/dsh-tools";
2
+
3
+ export const name = "animebar";
4
+ export const inject = ["tools"];
5
+
6
+ const CALENDAR = "https://api.bgm.tv/calendar";
7
+ const UA = "dsh-animebar/0.1 (+https://github.com/)";
8
+
9
+ async function fetchMovies(pages = 4) {
10
+ const all = [];
11
+ for (let page = 0; page < pages; page += 1) {
12
+ const res = await fetch(`https://api.bgm.tv/v0/search/subjects?limit=20&offset=${page * 20}`, {
13
+ method: "POST",
14
+ headers: { "user-agent": UA, "content-type": "application/json" },
15
+ body: JSON.stringify({ keyword: "劇場版", filter: { type: [2] }, sort: "heat" }),
16
+ });
17
+ if (!res.ok) break;
18
+ const data = await res.json();
19
+ const rows = data.data ?? [];
20
+ if (rows.length === 0) break;
21
+ all.push(...rows.map((item) => ({
22
+ title: item.name_cn || item.name,
23
+ score: item.rating?.score ?? 0,
24
+ date: item.date ?? "",
25
+ url: `https://bgm.tv/subject/${item.id}`,
26
+ })));
27
+ }
28
+ return all;
29
+ }
30
+
31
+ async function fetchCalendar() {
32
+ const res = await fetch(CALENDAR, { headers: { "user-agent": UA, accept: "application/json" } });
33
+ if (!res.ok) throw new Error(`Bangumi API returned ${res.status}`);
34
+ return res.json();
35
+ }
36
+
37
+ export function apply(ctx, config) {
38
+ const minScore = Number(config?.minScore ?? 0);
39
+ const limit = Number(config?.limit ?? 8);
40
+
41
+ ctx.tools.register(defineTool({
42
+ name: "anime_today",
43
+ description: "List every anime airing on a given weekday (default: today) from Bangumi, ranked by rating. Low-rated titles are included; raise minScore in the bundle config to filter.",
44
+ parameters: {
45
+ weekday: {
46
+ type: "number",
47
+ description: "ISO weekday, 1 = Monday through 7 = Sunday. Defaults to today. Ignored when kind is movie.",
48
+ },
49
+ kind: {
50
+ type: "string",
51
+ enum: ["tv", "movie"],
52
+ description: "tv lists the weekly broadcast schedule; movie lists theatrical films sorted by rating.",
53
+ },
54
+ },
55
+ output: {
56
+ schema: { type: "object", additionalProperties: true },
57
+ render: (_args, value) => [{ type: "text", text: JSON.stringify(value) }],
58
+ },
59
+ async execute(args) {
60
+ if (args?.kind === "movie") {
61
+ const films = (await fetchMovies())
62
+ .filter((f) => f.score >= minScore)
63
+ .sort((a, b) => b.score - a.score)
64
+ .slice(0, limit);
65
+ return { kind: "movie", total: films.length, items: films };
66
+ }
67
+ const data = await fetchCalendar();
68
+ const weekday = Number(args?.weekday) || new Date().getDay() || 7;
69
+ const items = data
70
+ .filter((day) => day?.weekday?.id === weekday)
71
+ .flatMap((day) => day.items ?? [])
72
+ .map((item) => ({
73
+ title: item.name_cn || item.name,
74
+ original: item.name_cn ? item.name : undefined,
75
+ score: item.rating?.score ?? 0,
76
+ url: item.url,
77
+ }))
78
+ .filter((item) => item.score >= minScore)
79
+ .sort((a, b) => b.score - a.score)
80
+ .slice(0, limit);
81
+
82
+ return { weekday, total: items.length, items };
83
+ },
84
+ }));
85
+ }
package/locale/en.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "AnimeBar",
4
+ "description": "Shows today's anime lineup from Bangumi and returns it as a ranked list.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "AnimeBar 番表",
4
+ "description": "从 Bangumi 取当天在播的番剧,按评分排好交给你。",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "dsh-animebar",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Anime airing board for DeepSeek Harness — today's lineup from Bangumi.",
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./locale/*.json": "./locale/*.json",
9
+ "./icon": "./icon.svg"
10
+ },
11
+ "files": [
12
+ "index.js",
13
+ "cordis.patch.yml",
14
+ "locale/*.json",
15
+ "docs",
16
+ "icon.svg"
17
+ ],
18
+ "dsh": {
19
+ "bundle": {
20
+ "patch": "./cordis.patch.yml"
21
+ }
22
+ },
23
+ "dependencies": {
24
+ "@deepseek-ai/dsh-tools": "0.2.2-rc.1"
25
+ },
26
+ "license": "MIT",
27
+ "keywords": [
28
+ "dsh",
29
+ "deepseek-harness",
30
+ "anime",
31
+ "bangumi",
32
+ "plugin"
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/V1Y0h/animebar-plugin.git"
37
+ },
38
+ "homepage": "https://github.com/V1Y0h/animebar-plugin#readme"
6
39
  }