dsh-plugin-zotero 0.6.6 → 0.6.8
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 +14 -14
- package/client/client.js +176 -16
- package/icon.svg +43 -0
- package/locale/en.json +8 -0
- package/locale/zh.json +8 -0
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
- **整理文库**:新建、重命名、移动、删除分类,批量把条目加入或移出分类。你说一句「把这几篇归到『待读』里」,它就照做。
|
|
26
26
|
- **帮你入库**:把本地下载好的论文、PDF 交给 DSH 导入 Zotero;也可以让它读完外文文献后,把译文作为附件挂回条目。
|
|
27
27
|
- **带进对话**:右侧面板单条目引用、列表多选批量引用、阅读页划词摘录与点高亮引用、单标签或多标签引用、整分类引用,一键写进当前会话草稿(不自动发送),你再接着说要求。全部都以「引用胶囊」的形式出现,草稿里一眼看清引了哪几篇 / 哪几段,单独删掉某一条也不影响其他内容;完整文本在发送那一刻才展开给模型。
|
|
28
|
-
- **安全可控**:写能力默认全关 —— 「设置 → Zotero
|
|
28
|
+
- **安全可控**:写能力默认全关 —— 「设置 → Zotero文献库」里的「Zotero 写权限」不开启,面板就是纯只读,模型也看不到任何写工具。开启后写操作优先走集成 MCP(在 Zotero 进程内执行,不触发本地 API 授权弹窗),标注与笔记这两类 MCP 覆盖不到的才走本地 API,需要一次性点「始终允许」授权;模型侧每一项工具都能单独开关。
|
|
29
29
|
|
|
30
30
|
面板布局与 Zotero 本体一致:顶部状态栏显示连接状态并提供刷新;左侧是分类树,树下是可拖高、可折叠的标签面板;右侧列表显示当前范围(分类 / 全库 / 标签筛选后)的条目。分类树与条目列表之间的分隔条可拖动,宽度按本机记住。列表里单击条目选中、`Ctrl` / `Cmd` 点选多选,双击才在右侧栏顶层单开一个标签页看详情。阅读页就开在会话旁边的标签里,边读边摘、边问边改,不必在 Zotero 与 AI 两个窗口之间来回切换。
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
| [1](#第-1-步在-dsh-里安装本插件) | DSH | 安装本插件 | 必须 |
|
|
41
41
|
| [2](#第-2-步给-zotero-装一个桥接小插件) | Zotero | 装桥接小插件 Zotero MCP Plugin | 想让 AI 动手就必须 |
|
|
42
42
|
| [3](#第-3-步打开-zotero-的本机通信开关) | Zotero | 打开「允许本机其他程序通信」开关 | 必须 |
|
|
43
|
-
| [4](#第-4-步回到-dsh-确认已经连上) | DSH | 到「设置 → Zotero
|
|
43
|
+
| [4](#第-4-步回到-dsh-确认已经连上) | DSH | 到「设置 → Zotero文献库」看一眼 | 必须(只是确认) |
|
|
44
44
|
| [5](#第-5-步可选想让-ai-帮你改文献库) | DSH + Zotero | 打开写权限并授权 | 想改库 / 划高亮才需要 |
|
|
45
45
|
|
|
46
46
|
开始前请确认两件事:**Zotero 桌面版已装好并且正开着**(本插件读的是你本机 Zotero 里的文献,不是云端);**DSH 桌面版 ≥ 0.2.1-rc.3**。
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
4. 点「**安装**」,在弹出的确认框里确认,等安装进度走完。
|
|
54
54
|
5. 按提示**重启 DSH**。
|
|
55
55
|
|
|
56
|
-
怎么算装好了:重启后 DSH 右侧栏多出「**Zotero 文献库**」入口,「设置」左侧列表里(「Agent 预设」下面)多出「**Zotero
|
|
56
|
+
怎么算装好了:重启后 DSH 右侧栏多出「**Zotero 文献库**」入口,「设置」左侧列表里(「Agent 预设」下面)多出「**Zotero文献库**」一页。看到这两个就对了。
|
|
57
57
|
|
|
58
58
|
<details>
|
|
59
59
|
<summary>习惯用命令行的人可以这样装(可选,效果一样)</summary>
|
|
@@ -97,9 +97,9 @@ Zotero → **设置** → **高级** → 勾选「**允许此计算机上的其
|
|
|
97
97
|
|
|
98
98
|
### 第 4 步:回到 DSH 确认已经连上
|
|
99
99
|
|
|
100
|
-
打开 DSH 的「**设置**」,点左侧列表里的「**Zotero
|
|
100
|
+
打开 DSH 的「**设置**」,点左侧列表里的「**Zotero文献库**」。这一页就是本插件的全部设置,从上到下三块:**Zotero 写权限**、**API 设置**、**MCP 设置**。
|
|
101
101
|
|
|
102
|
-
- 正常情况**一个字都不用改**,默认值就是对的。每一项的含义见[设置项说明](#设置项说明设置--zotero
|
|
102
|
+
- 正常情况**一个字都不用改**,默认值就是对的。每一项的含义见[设置项说明](#设置项说明设置--zotero文献库)。
|
|
103
103
|
- 回到会话,打开右侧栏的「Zotero 文献库」:顶部状态栏显示连接状态,左边应该已经列出你在 Zotero 里的分类。看到分类树就说明整条链路通了。
|
|
104
104
|
- 如果 Zotero 里装的 MCP 插件不是第 2 步那个、或者端口不是 23120:把「**MCP 设置 → 集成 MCP 地址**」改成实际地址(形如 `http://127.0.0.1:<端口>/mcp`)。改完自动保存、立即生效,不用重启。
|
|
105
105
|
|
|
@@ -107,22 +107,22 @@ Zotero → **设置** → **高级** → 勾选「**允许此计算机上的其
|
|
|
107
107
|
|
|
108
108
|
**默认是只读的**:面板只能看和引用,AI 也看不到任何写工具。想在读 PDF 时直接划高亮、写笔记,或者让 AI 帮你整理分类、导入论文,就打开写权限:
|
|
109
109
|
|
|
110
|
-
1. 「设置 → Zotero
|
|
110
|
+
1. 「设置 → Zotero文献库」最上面那块「Zotero 写权限」,打开「**允许写入 Zotero**」开关。
|
|
111
111
|
2. 等一秒左右让它自动保存(页面会闪一下「正在自动保存…」),下面的按钮就可以点了。
|
|
112
112
|
3. 点「**授权 Zotero 写权限**」。Zotero 会弹出一个确认框,**一定要选「始终允许」**——选「允许」只管一次,第二次写入就又失败了。
|
|
113
113
|
4. 状态行变成「**已授权(永久有效),重启 DSH 后继续可用**」就完成了。以后重启 DSH、重启 Zotero 都不用再点。
|
|
114
114
|
|
|
115
115
|
[](docs/images/zotero-settings-write.png)
|
|
116
116
|
|
|
117
|
-
<sub>上图为「设置 → Zotero
|
|
117
|
+
<sub>上图为「设置 → Zotero文献库」顶部的写权限区块:开关已打开、状态显示「已授权(永久有效)」,主按钮已降级为「重新授权」——正常使用的情况下你不需要再点它。旁边的「重新读取」只是重新查一下本机保存的授权状态,写入报错时点它。</sub>
|
|
118
118
|
|
|
119
119
|
授权凭据存在本机 `~/.dsh/storages/dsh-plugin-zotero/local-api-key.json`(权限 `0600`,不会出现在任何表单里)。要收回权限,在 Zotero 里清除本地 API 授权即可,插件下次写入被拒后会自动删掉本地副本、回到「未授权」。想临时全面止损,把「允许写入 Zotero」关掉就彻底回到只读。
|
|
120
120
|
|
|
121
121
|
> 写入是**直接改你本机的 Zotero 库**,插件不另存副本。删除类操作在面板里要点两次(「删除」→「确认删除」)才真删,而且**不进 Zotero 回收站**,撤销不了。
|
|
122
122
|
|
|
123
|
-
## 设置项说明(设置 → Zotero
|
|
123
|
+
## 设置项说明(设置 → Zotero文献库)
|
|
124
124
|
|
|
125
|
-
入口只有一个:DSH 的「**设置**」→ 左侧「**Zotero
|
|
125
|
+
入口只有一个:DSH 的「**设置**」→ 左侧「**Zotero文献库**」。
|
|
126
126
|
|
|
127
127
|
**没有保存按钮**:任何一项改完、停手约一秒就自动落盘,页面顶部会显示「正在自动保存…」,失败会显示红字提示(再改任意一项就会重试)。所有改动**立即生效,不用重启 DSH**。字段旁出现「已覆盖」表示这一项被你改过、不是默认值,点「恢复默认」即可还原。
|
|
128
128
|
|
|
@@ -176,7 +176,7 @@ Zotero → **设置** → **高级** → 勾选「**允许此计算机上的其
|
|
|
176
176
|
|---|---|---|
|
|
177
177
|
| 面板显示「Zotero 未连接」 | Zotero 没开,或第 3 步的通信开关没勾 | 打开 Zotero,勾上「允许此计算机上的其他应用程序与 Zotero 通信」,回面板点刷新 |
|
|
178
178
|
| 状态栏「模型工具不可用」,或工具清单读取失败 | 第 2 步的小插件没装 / 端口不是 23120 | 装 Zotero MCP Plugin;端口不同就改「集成 MCP 地址」,再点「重新读取」 |
|
|
179
|
-
| 「设置」里没有「Zotero
|
|
179
|
+
| 「设置」里没有「Zotero文献库」这一页 | 插件没装成功或没重启 | 回「插件市场」确认已安装,然后重启 DSH |
|
|
180
180
|
| 划高亮 / 写笔记失败,提示未授权 | 第 5 步只开了开关、没点授权按钮 | 点「授权 Zotero 写权限」,弹窗里选「**始终允许**」 |
|
|
181
181
|
| 每写一次就弹一次授权框 | 上次选的是「允许」,拿到的是一次性凭据 | 重新点授权,这次选「始终允许」 |
|
|
182
182
|
| 授权按钮灰着点不动 | 上面的开关还没打开,或改动还没自动保存 | 先打开「允许写入 Zotero」,等「正在自动保存…」消失 |
|
|
@@ -200,8 +200,8 @@ Zotero → **设置** → **高级** → 勾选「**允许此计算机上的其
|
|
|
200
200
|
- **多种插入方式**:单条目、列表多选批量、单标签、多标签(合并成一枚「标签组」胶囊,AND/OR 在插入那一刻定格)、整目录、全文划词摘录、单条标注与单条笔记**全部**以「引用胶囊」写进草稿——胶囊只显示短标签,发送那一刻才展开成完整引用文本,模型拿到的内容与以前一致。所有方式都只写进会话草稿(不自动发送、不抢焦点),文本携带 `itemKey` / `collectionKey` / 标签名供模型接续操作。标签类引用始终按全库范围展开,不受你当时选中哪个分类影响;摘录胶囊把 `itemKey`、标题与原文一起定格在胶囊里,重开 DSH 后仍可展开,发送时不依赖 Zotero 在线(单段上限 4000 字)。
|
|
201
201
|
- **胶囊依赖本插件展开**:草稿里留着引用胶囊时禁用或卸载本插件,发送会失败并提示找不到引用来源,把胶囊删掉即可继续正常发送。
|
|
202
202
|
- **分类只读**:不提供任何新建 / 改名 / 删除分类的按钮——整理分类是模型的活,人在面板里只管浏览与引用。
|
|
203
|
-
- **标注与笔记可写(默认关)**:在「设置 → Zotero
|
|
204
|
-
- **模型侧工具可逐个开关**:插件自持连接集成 MCP,把工具以 `mcp__zotero__*` 注册进 dsh,可在「设置 → Zotero
|
|
203
|
+
- **标注与笔记可写(默认关)**:在「设置 → Zotero文献库」打开「Zotero 写权限」并授权后,阅读页划选即写高亮 / 下划线(Zotero 色板七色 + 评论一次点明),点页内高亮弹出的标注卡片可当场「添加评论 / 改评论」,「标注」块还支持改色、改页码、加标签、高亮↔划线、删除,「笔记」块支持新建 / 编辑 / 删除。所有写入都直接进 Zotero 本地库,插件不存副本;含 Zotero 引文或标注锚点的笔记只给删除、不给编辑,改正文会让锚点失联。删除是**硬删**,不进 Zotero 回收站,面板里要点两次才会真删。开关关着时上述入口一个都不出现。
|
|
204
|
+
- **模型侧工具可逐个开关**:插件自持连接集成 MCP,把工具以 `mcp__zotero__*` 注册进 dsh,可在「设置 → Zotero文献库 → MCP 工具」里逐项启用 / 禁用。
|
|
205
205
|
|
|
206
206
|
---
|
|
207
207
|
|
|
@@ -333,14 +333,14 @@ dsh --profile demo # 启动
|
|
|
333
333
|
|
|
334
334
|
## 配置层与权限实现
|
|
335
335
|
|
|
336
|
-
界面操作见[安装与设置](#安装与设置)与[设置项说明](#设置项说明设置--zotero
|
|
336
|
+
界面操作见[安装与设置](#安装与设置)与[设置项说明](#设置项说明设置--zotero文献库),这里只记实现。
|
|
337
337
|
|
|
338
338
|
### 设置怎么落盘
|
|
339
339
|
|
|
340
340
|
- 入口是「设置」对话框的 `settings.section` 席位(section id `zotero`,`order: 30`,排在框架自带各页之后),仅当 Host 服务本插件的 settings 命名空间时才注册。命名空间 id `dsh-plugin-zotero` 必须与 [cordis.patch.yml](cordis.patch.yml) 的 insert 行 id 保持同步。
|
|
341
341
|
- **表单没有保存按钮**:最后一次改动后防抖 600ms 落盘;离开页面时合法草稿立刻冲盘、非法草稿直接丢弃;写盘失败**不自动重试**(否则每 600ms 打一次后端),等用户下一次编辑。
|
|
342
342
|
- 落盘目标是 profile 的 patch 层 `~/.dsh/profiles/<profile>/cordis.patch.yml`。所有字段走 Schemastery `.volatile()`,只提交新值并唤醒引用,**无需重启**即时生效。
|
|
343
|
-
- 表单里露出的六个字段与界面标签的对照见[设置项说明](#设置项说明设置--zotero
|
|
343
|
+
- 表单里露出的六个字段与界面标签的对照见[设置项说明](#设置项说明设置--zotero文献库)。另有两个不以文本框形式露出的字段:`writeEnabled`(布尔,写权限总开关)、`disabledMcpTools`(字符串数组,被停用的 MCP 工具**原始名**,由「MCP 工具」区的开关维护,模型侧据此过滤注册)。
|
|
344
344
|
- 「已覆盖」表示该值来自 patch 层而非默认值,「恢复默认」清掉覆盖;若被更高优先级的 patch 层覆盖,保存会报「被覆盖」错误。「设置 → 内置插件」是只读清单,不提供编辑入口。
|
|
345
345
|
- 实现:Host 半在 [src/index.ts](src/index.ts) 导出 `Config` schema、注入读取器([src/zotero/config.ts](src/zotero/config.ts) 的 `setSettingsReader`)并驱动 [src/host/mcp-bridge.ts](src/host/mcp-bridge.ts);Client 半在 [src/client/ZoteroCard.tsx](src/client/ZoteroCard.tsx) 渲染表单,由 [src/client/index.ts](src/client/index.ts) 注册席位。一次写入落地后重取工具清单与写权限状态。
|
|
346
346
|
|
package/client/client.js
CHANGED
|
@@ -3,8 +3,135 @@ var module = { exports: {} };
|
|
|
3
3
|
var exports = module.exports;
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5
5
|
let react = require("react");
|
|
6
|
-
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
7
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
8
|
+
//#region src/client/GuideIcon.tsx
|
|
9
|
+
/**
|
|
10
|
+
* 右侧栏「开始」页 guide 卡片专用的插件图标。
|
|
11
|
+
*
|
|
12
|
+
* 宿主 `ui-sidebar-right` 的 EntryBox 用 `entry.icon ?? CubeGlyph` 渲染卡片图标,
|
|
13
|
+
* 没传 icon 的插件一律显示灰色立方体占位;它**不读** `package.json` 的 `icon`。
|
|
14
|
+
* 而 guide[].icon 要的是能接 `{size, className}` 的 React 组件,不是图片 URL,
|
|
15
|
+
* 客户端 bundle 又不能 import `.svg` 文件,所以这里用内联 SVG 重写一份。
|
|
16
|
+
*
|
|
17
|
+
* 根 `icon.svg` 是 64×64 的完整版;guide 卡片只有 22 / 26px,等比缩会把
|
|
18
|
+
* 2px 的文字线压成半像素条纹、Z 也糊成红点。这里用 32×32 紧凑版重排:
|
|
19
|
+
* 保留「亮蓝圆角底 + 白色文档页 + 蓝标题条 + 三条灰蓝文字行 + 居中红 Z」
|
|
20
|
+
* 的全部识别元素,只把笔画加粗、间距压紧,26px 下仍能读成一页文档。
|
|
21
|
+
*/
|
|
22
|
+
/** Zotero Z 的原始轮廓(0 基、18 × 17.5),与根 `icon.svg` 同一条 path。 */
|
|
23
|
+
const Z_PATH = "M0.5 0H17L18 4.5L5.5 13H18V17.5H1L0 13L12.5 4.5H0.5Z";
|
|
24
|
+
/** 宿主在有 description 时传 26,否则 22。 */
|
|
25
|
+
function GuideIcon({ size = 26, className }) {
|
|
26
|
+
const uid = (0, react.useId)().replace(/:/g, "");
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
28
|
+
width: size,
|
|
29
|
+
height: size,
|
|
30
|
+
viewBox: "0 0 32 32",
|
|
31
|
+
className,
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
focusable: "false",
|
|
34
|
+
style: {
|
|
35
|
+
display: "block",
|
|
36
|
+
flexShrink: 0
|
|
37
|
+
},
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
40
|
+
id: `${uid}-bg`,
|
|
41
|
+
x1: "0",
|
|
42
|
+
y1: "0",
|
|
43
|
+
x2: "1",
|
|
44
|
+
y2: "1",
|
|
45
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
46
|
+
offset: "0",
|
|
47
|
+
stopColor: "#359ff2"
|
|
48
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
49
|
+
offset: "1",
|
|
50
|
+
stopColor: "#279af2"
|
|
51
|
+
})]
|
|
52
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
|
|
53
|
+
id: `${uid}-z`,
|
|
54
|
+
x1: "0",
|
|
55
|
+
y1: "0",
|
|
56
|
+
x2: "0.35",
|
|
57
|
+
y2: "1",
|
|
58
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
59
|
+
offset: "0",
|
|
60
|
+
stopColor: "#ff5a4b"
|
|
61
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
|
|
62
|
+
offset: "1",
|
|
63
|
+
stopColor: "#df2030"
|
|
64
|
+
})]
|
|
65
|
+
})] }),
|
|
66
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
67
|
+
x: "1",
|
|
68
|
+
y: "1",
|
|
69
|
+
width: "30",
|
|
70
|
+
height: "30",
|
|
71
|
+
rx: "7.5",
|
|
72
|
+
fill: `url(#${uid}-bg)`
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
75
|
+
d: "M20 6h5a2 2 0 0 1 2 2v15",
|
|
76
|
+
fill: "none",
|
|
77
|
+
stroke: "#ffffff",
|
|
78
|
+
strokeOpacity: ".6",
|
|
79
|
+
strokeWidth: "1.8",
|
|
80
|
+
strokeLinecap: "round"
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
83
|
+
x: "8",
|
|
84
|
+
y: "4.5",
|
|
85
|
+
width: "16",
|
|
86
|
+
height: "24",
|
|
87
|
+
rx: "2.4",
|
|
88
|
+
fill: "#ffffff"
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
91
|
+
x: "10.5",
|
|
92
|
+
y: "7.5",
|
|
93
|
+
width: "8.5",
|
|
94
|
+
height: "2",
|
|
95
|
+
rx: "1",
|
|
96
|
+
fill: "#4a86e8"
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
|
|
99
|
+
fill: "#9db2ce",
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
102
|
+
x: "10.5",
|
|
103
|
+
y: "11.6",
|
|
104
|
+
width: "10",
|
|
105
|
+
height: "1.5",
|
|
106
|
+
rx: "0.75"
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
109
|
+
x: "10.5",
|
|
110
|
+
y: "23.2",
|
|
111
|
+
width: "9",
|
|
112
|
+
height: "1.5",
|
|
113
|
+
rx: "0.75"
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
116
|
+
x: "10.5",
|
|
117
|
+
y: "25.9",
|
|
118
|
+
width: "6",
|
|
119
|
+
height: "1.5",
|
|
120
|
+
rx: "0.75"
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
125
|
+
transform: "translate(12.3 14) scale(0.45) skewX(-5)",
|
|
126
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
127
|
+
d: Z_PATH,
|
|
128
|
+
fill: `url(#${uid}-z)`
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
8
135
|
//#region src/client/api.ts
|
|
9
136
|
const BASE = "/dsh-zotero/api";
|
|
10
137
|
/** 写端点的自定义头名(与 `src/zotero/config.ts` 的 WRITE_HEADER 同步)。 */
|
|
@@ -445,7 +572,7 @@ const dicts = {
|
|
|
445
572
|
"toast.insertedItems": "已把 {n} 条加入会话草稿",
|
|
446
573
|
"toast.copied": "已复制",
|
|
447
574
|
"toast.copyFailed": "复制失败",
|
|
448
|
-
"settings.nav": "Zotero
|
|
575
|
+
"settings.nav": "Zotero文献库",
|
|
449
576
|
"settings.hint": "这些参数决定面板与模型工具如何连上 Zotero;改完自动保存、即时生效,无需重启。",
|
|
450
577
|
"group.api": "API 设置",
|
|
451
578
|
"group.mcp": "MCP 设置",
|
|
@@ -785,7 +912,7 @@ const dicts = {
|
|
|
785
912
|
"toast.insertedItems": "Added {n} to the conversation draft",
|
|
786
913
|
"toast.copied": "Copied",
|
|
787
914
|
"toast.copyFailed": "Copy failed",
|
|
788
|
-
"settings.nav": "Zotero
|
|
915
|
+
"settings.nav": "Zotero Library",
|
|
789
916
|
"settings.hint": "These parameters decide how the panel and the model tools reach Zotero; edits save automatically and take effect immediately, no restart needed.",
|
|
790
917
|
"group.api": "API settings",
|
|
791
918
|
"group.mcp": "MCP settings",
|
|
@@ -2082,6 +2209,27 @@ function insertChip(sessions, sessionId, reference, span) {
|
|
|
2082
2209
|
}) === true;
|
|
2083
2210
|
}
|
|
2084
2211
|
//#endregion
|
|
2212
|
+
//#region src/client/SettingsNavIcon.tsx
|
|
2213
|
+
function SettingsNavIcon({ size = 16 }) {
|
|
2214
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
2215
|
+
width: size,
|
|
2216
|
+
height: size,
|
|
2217
|
+
viewBox: "0 0 16 16",
|
|
2218
|
+
fill: "none",
|
|
2219
|
+
stroke: "currentColor",
|
|
2220
|
+
strokeWidth: "1.7",
|
|
2221
|
+
strokeLinecap: "round",
|
|
2222
|
+
strokeLinejoin: "round",
|
|
2223
|
+
"aria-hidden": "true",
|
|
2224
|
+
focusable: "false",
|
|
2225
|
+
style: {
|
|
2226
|
+
display: "block",
|
|
2227
|
+
flexShrink: 0
|
|
2228
|
+
},
|
|
2229
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.7 3.4h8.6L3.7 12.6h8.6" })
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
//#endregion
|
|
2085
2233
|
//#region src/client/styles.ts
|
|
2086
2234
|
/** 蓝色高亮色(详情面板的区块标题、当前附件标记等旧调用)。 */
|
|
2087
2235
|
const ACCENT = "#508cff";
|
|
@@ -2277,7 +2425,7 @@ function SectionTitle({ children, title, style }) {
|
|
|
2277
2425
|
* 设置页(浏览器半)。
|
|
2278
2426
|
*
|
|
2279
2427
|
* 把 Host 导出的 volatile `Config` 表单渲染进「设置」对话框的
|
|
2280
|
-
* `settings.section` 席位(左侧导航里独立一页「Zotero
|
|
2428
|
+
* `settings.section` 席位(左侧导航里独立一页「Zotero文献库」)—— 表单模型照抄官方
|
|
2281
2429
|
* 参考实现 `@deepseek-ai/dsh-client-ui-settings-shell` 的 `ShellCard`:
|
|
2282
2430
|
* 控制器持 `SettingsFormModel`,组件经注入的 hook 读快照。
|
|
2283
2431
|
*
|
|
@@ -4902,7 +5050,8 @@ const attachmentMetaStyle = {
|
|
|
4902
5050
|
* 面板不解释跳转目标,点一条就把 `target` 原样交回 `ItemDetail` 转给渲染器——
|
|
4903
5051
|
* 于是 PDF 跳页、HTML 滚到标题可以共用同一份 UI。
|
|
4904
5052
|
*
|
|
4905
|
-
*
|
|
5053
|
+
* 点条目只跳转、不收起:浮层要留着让用户连点几条反复导航,关闭统一交给
|
|
5054
|
+
* {@link useDismiss}(点浮层外 / 按 Esc)或再点一次目录按钮。
|
|
4906
5055
|
*/
|
|
4907
5056
|
/** 缩进宽度;层级再深也不再往外推,免得窄面板里标题全被挤成一点。 */
|
|
4908
5057
|
const INDENT$1 = 13;
|
|
@@ -32516,10 +32665,10 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onInsertAnnotati
|
|
|
32516
32665
|
* 跳到一条目录项。
|
|
32517
32666
|
*
|
|
32518
32667
|
* 目标原样交给渲染器:PDF 按页、网页快照 / 笔记按标题锚点,面板不解释。
|
|
32519
|
-
*
|
|
32668
|
+
* **跳完不收起**:目录浮层保持打开,可以连着点好几条反复导航;收起交给
|
|
32669
|
+
* `OutlinePanel` 的 `useDismiss`(点浮层外 / 按 Esc)或再点一次目录按钮。
|
|
32520
32670
|
*/
|
|
32521
32671
|
function jumpToOutline(item) {
|
|
32522
|
-
setOutlineOpen(false);
|
|
32523
32672
|
if (item.target !== null) viewerRef.current?.goToOutline(item.target);
|
|
32524
32673
|
}
|
|
32525
32674
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -34430,7 +34579,8 @@ function apply(ctx) {
|
|
|
34430
34579
|
id: TAB_ID,
|
|
34431
34580
|
title: () => t("guide.title"),
|
|
34432
34581
|
description: () => t("guide.desc"),
|
|
34433
|
-
order: 10
|
|
34582
|
+
order: 10,
|
|
34583
|
+
icon: GuideIcon
|
|
34434
34584
|
}]
|
|
34435
34585
|
}), "dsh-plugin-zotero: sidebar tab");
|
|
34436
34586
|
ctx.effect(() => ctx.sidebarRightTabs.register({
|
|
@@ -34505,14 +34655,24 @@ function apply(ctx) {
|
|
|
34505
34655
|
ctx.effect(() => () => resetPaneStore(), "dsh-plugin-zotero: pane state");
|
|
34506
34656
|
const controller = new ZoteroCardController(ctx.configForms.get(ROW_ID));
|
|
34507
34657
|
ctx.effect(() => () => controller.dispose(), "dsh-plugin-zotero: settings form");
|
|
34508
|
-
ctx.effect(() => ctx.configForms.whileServed([ROW_ID], () =>
|
|
34509
|
-
|
|
34510
|
-
|
|
34511
|
-
|
|
34512
|
-
|
|
34513
|
-
|
|
34514
|
-
|
|
34515
|
-
|
|
34658
|
+
ctx.effect(() => ctx.configForms.whileServed([ROW_ID], () => {
|
|
34659
|
+
const offSection = ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
34660
|
+
name: "settings.section",
|
|
34661
|
+
id: SETTINGS_SECTION_ID,
|
|
34662
|
+
order: 30,
|
|
34663
|
+
label: () => t("settings.nav"),
|
|
34664
|
+
locale: NS,
|
|
34665
|
+
inject: () => controller.inject()
|
|
34666
|
+
}, ZoteroSettingsSection));
|
|
34667
|
+
const offIcon = ctx.slots.inject("settings.section.icon", () => ctx.slots.register({
|
|
34668
|
+
name: "settings.section.icon",
|
|
34669
|
+
id: SETTINGS_SECTION_ID
|
|
34670
|
+
}, SettingsNavIcon));
|
|
34671
|
+
return () => {
|
|
34672
|
+
offSection();
|
|
34673
|
+
offIcon();
|
|
34674
|
+
};
|
|
34675
|
+
}), "dsh-plugin-zotero: settings section");
|
|
34516
34676
|
}
|
|
34517
34677
|
//#endregion
|
|
34518
34678
|
exports.apply = apply;
|
package/icon.svg
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="Zotero Library for DSH">
|
|
2
|
+
<defs>
|
|
3
|
+
<!-- User-picked blue badge (sample #2e9df2): deep enough for the white sheet to read as paper. -->
|
|
4
|
+
<linearGradient id="zp-bg" x1="8" y1="4" x2="56" y2="60" gradientUnits="userSpaceOnUse">
|
|
5
|
+
<stop offset="0" stop-color="#359ff2"/>
|
|
6
|
+
<stop offset="1" stop-color="#279af2"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
<linearGradient id="zp-paper" x1="18" y1="14" x2="44" y2="50" gradientUnits="userSpaceOnUse">
|
|
9
|
+
<stop offset="0" stop-color="#ffffff"/>
|
|
10
|
+
<stop offset="1" stop-color="#eaf1fb"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
<linearGradient id="zp-z" x1="0" y1="0" x2="0.35" y2="1">
|
|
13
|
+
<stop offset="0" stop-color="#ff5a4b"/>
|
|
14
|
+
<stop offset="1" stop-color="#df2030"/>
|
|
15
|
+
</linearGradient>
|
|
16
|
+
</defs>
|
|
17
|
+
|
|
18
|
+
<!-- Self-contained badge: readable on both light and dark host themes. -->
|
|
19
|
+
<rect x="4" y="4" width="56" height="56" rx="15" fill="url(#zp-bg)"/>
|
|
20
|
+
|
|
21
|
+
<!-- A second sheet behind the front page: a library, not one document. -->
|
|
22
|
+
<path d="M25 16h17a3 3 0 0 1 3 3v26" fill="none" stroke="#ffffff" stroke-opacity=".6" stroke-width="3" stroke-linecap="round"/>
|
|
23
|
+
|
|
24
|
+
<!-- Front page. -->
|
|
25
|
+
<rect x="16" y="13" width="27" height="38" rx="3.5" fill="url(#zp-paper)"/>
|
|
26
|
+
<rect x="20" y="18.5" width="14" height="2.8" rx="1.4" fill="#4a86e8"/>
|
|
27
|
+
|
|
28
|
+
<!-- Text lines above the Z: the page must still read as a document. -->
|
|
29
|
+
<rect x="20" y="24" width="19" height="2" rx="1" fill="#9db2ce"/>
|
|
30
|
+
|
|
31
|
+
<!-- Zotero's Z, scaled down to sit between the text lines. Local zero-based
|
|
32
|
+
path keeps the transform readable; objectBoundingBox gradient keeps the
|
|
33
|
+
reds in place under the scale. The orange-red bookmark tab is gone. -->
|
|
34
|
+
<g transform="translate(24 28.5) scale(0.62) translate(0.8 0) skewX(-5)">
|
|
35
|
+
<path d="M0.5 0H17L18 4.5L5.5 13H18V17.5H1L0 13L12.5 4.5H0.5Z" fill="url(#zp-z)"/>
|
|
36
|
+
</g>
|
|
37
|
+
|
|
38
|
+
<!-- Remaining text lines below the Z, tapering off like a paragraph. -->
|
|
39
|
+
<g fill="#9db2ce">
|
|
40
|
+
<rect x="20" y="42" width="17" height="2" rx="1"/>
|
|
41
|
+
<rect x="20" y="46" width="11" height="2" rx="1"/>
|
|
42
|
+
</g>
|
|
43
|
+
</svg>
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Zotero Library",
|
|
4
|
+
"description": "Bring your Zotero library into DSH: browse collections and tags, read PDFs with highlights in the side panel, cite items, notes and excerpts into the chat, and let AI search, organize and import your references."
|
|
5
|
+
},
|
|
6
|
+
"title": "Zotero Library",
|
|
7
|
+
"description": "Bring your Zotero library into DSH: browse collections and tags, read PDFs with highlights in the side panel, cite items, notes and excerpts into the chat, and let AI search, organize and import your references."
|
|
8
|
+
}
|
package/locale/zh.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Zotero 文献库",
|
|
4
|
+
"description": "把 Zotero 文献库接入 DSH:按分类与标签浏览文库、在右侧栏精读 PDF 与标注,把条目、笔记和划词摘录作为引用胶囊带进对话,并让 AI 帮你检索、整理与导入文献。"
|
|
5
|
+
},
|
|
6
|
+
"title": "Zotero 文献库",
|
|
7
|
+
"description": "把 Zotero 文献库接入 DSH:按分类与标签浏览文库、在右侧栏精读 PDF 与标注,把条目、笔记和划词摘录作为引用胶囊带进对话,并让 AI 帮你检索、整理与导入文献。"
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-zotero",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Map your Zotero library into DSH: let AI operate Zotero for you and help you read papers. Browse collections and tags in the sidebar, read PDFs with highlights in place, and cite excerpts, annotations, notes or whole items into the chat. The model works from the source text for reviews, comparisons and data extraction, and can also search and organize the library, import papers and attach translations back to items; first use needs the Zotero MCP plugin and the local API enabled.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -20,17 +20,24 @@
|
|
|
20
20
|
"type": "module",
|
|
21
21
|
"main": "lib/index.js",
|
|
22
22
|
"types": "./lib/index.d.ts",
|
|
23
|
+
"icon": "./icon.svg",
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
25
26
|
"types": "./lib/index.d.ts",
|
|
26
27
|
"default": "./lib/index.js"
|
|
27
28
|
},
|
|
28
|
-
"./client": "./client/client.js"
|
|
29
|
+
"./client": "./client/client.js",
|
|
30
|
+
"./package.json": "./package.json",
|
|
31
|
+
"./locale/*.json": "./locale/*.json",
|
|
32
|
+
"./icon": "./icon.svg"
|
|
29
33
|
},
|
|
30
34
|
"files": [
|
|
31
35
|
"lib",
|
|
32
36
|
"client",
|
|
33
|
-
"
|
|
37
|
+
"client/client.js",
|
|
38
|
+
"cordis.patch.yml",
|
|
39
|
+
"locale/*.json",
|
|
40
|
+
"icon.svg"
|
|
34
41
|
],
|
|
35
42
|
"engines": {
|
|
36
43
|
"dsh": ">=0.2.1-rc.3 <0.3.0-0"
|