dsh-fulltext 0.1.1 → 0.1.2
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/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/README_CN.md +1 -1
- package/lib/client-types/client/controller.d.ts +5 -1
- package/lib/client.js +67 -20
- package/lib/client.js.map +1 -1
- package/lib/routes.d.ts +1 -0
- package/lib/routes.js +13 -1
- package/lib/store.d.ts +2 -0
- package/lib/store.js +12 -0
- package/package.json +13 -16
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.2 — 2026-11-11
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Add a delete action to saved reports. It removes the report's HTML, CSV and source JSON from the local report directory after an explicit confirmation.
|
|
9
|
+
|
|
5
10
|
## 0.1.1 — 2026-11-09
|
|
6
11
|
|
|
7
12
|
- Adopted the selected original-evidence icon: paired quotation marks and a lime excerpt on the Ai4Scholar dark rounded tile. Package, sidebar and workspace marks share the same design.
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Search coverage depends on the index; results may come from titles, abstracts or
|
|
|
43
43
|
|
|
44
44
|
## Files and fees
|
|
45
45
|
|
|
46
|
-
Each search saves `report.html`, `report.csv` and `report.json` in `$DSH_HOME/fulltext/reports/<report-id>/` (default: `~/.dsh/fulltext/reports/`). The workspace lists the newest 100 reports;
|
|
46
|
+
Each search saves `report.html`, `report.csv` and `report.json` in `$DSH_HOME/fulltext/reports/<report-id>/` (default: `~/.dsh/fulltext/reports/`). The workspace lists the newest 100 reports; the sidebar can delete a report and all three local files after confirmation. HTML includes its styles/scripts and needs no remote assets. CSV is UTF-8 with a BOM and spreadsheet-formula protection.
|
|
47
47
|
|
|
48
48
|
Search and optional metadata enrichment are billed by AI4Scholar. Every report records the returned charges. Disable enrichment for a search-only request. Opening, filtering, updating and exporting saved reports make no new search requests. Model usage for synthesis/translation is separate.
|
|
49
49
|
|
package/README_CN.md
CHANGED
|
@@ -43,7 +43,7 @@ dsh plugin add dsh-fulltext
|
|
|
43
43
|
|
|
44
44
|
## 文件与费用
|
|
45
45
|
|
|
46
|
-
每次搜索保存 `report.html`、`report.csv` 和 `report.json`,目录为 `$DSH_HOME/fulltext/reports/<report-id>/`,默认位于 `~/.dsh/fulltext/reports/`。工作台显示最新 100
|
|
46
|
+
每次搜索保存 `report.html`、`report.csv` 和 `report.json`,目录为 `$DSH_HOME/fulltext/reports/<report-id>/`,默认位于 `~/.dsh/fulltext/reports/`。工作台显示最新 100 份报告;侧边栏可在确认后删除报告及这三个本地文件。HTML 的样式和脚本内嵌,无远程资源依赖;CSV 使用 UTF-8 BOM,并对可能被表格软件当作公式的文本做保护。
|
|
47
47
|
|
|
48
48
|
搜索和可选的信息补全由 AI4Scholar 接口计费,报告保留实际返回的扣费。关闭「补全」可只发出检索请求。重新打开、报告内筛选、更新和导出不会新增检索费用。模型总结、翻译的用量另计。
|
|
49
49
|
|
|
@@ -15,6 +15,7 @@ export interface State {
|
|
|
15
15
|
draft: SearchInput;
|
|
16
16
|
loading: boolean;
|
|
17
17
|
busy: boolean;
|
|
18
|
+
deleting?: string | undefined;
|
|
18
19
|
keyBusy: boolean;
|
|
19
20
|
error?: string | undefined;
|
|
20
21
|
message?: string | undefined;
|
|
@@ -26,7 +27,8 @@ type Reply<T> = {
|
|
|
26
27
|
ok: false;
|
|
27
28
|
error: string;
|
|
28
29
|
};
|
|
29
|
-
export type
|
|
30
|
+
export type Method = 'POST' | 'DELETE';
|
|
31
|
+
export type Fetcher = <T>(path: string, signal: AbortSignal, body?: unknown, method?: Method) => Promise<Reply<T>>;
|
|
30
32
|
export declare const request: Fetcher;
|
|
31
33
|
/** Persistent in-memory UI state; saved reports themselves live on the host. */
|
|
32
34
|
export declare class Controller {
|
|
@@ -36,6 +38,7 @@ export declare class Controller {
|
|
|
36
38
|
private listeners;
|
|
37
39
|
private active;
|
|
38
40
|
private refreshRequest;
|
|
41
|
+
private deleteRequest;
|
|
39
42
|
private first;
|
|
40
43
|
private disposed;
|
|
41
44
|
private revision;
|
|
@@ -48,6 +51,7 @@ export declare class Controller {
|
|
|
48
51
|
newSearch(): void;
|
|
49
52
|
attach(): Promise<void>;
|
|
50
53
|
search(): Promise<void>;
|
|
54
|
+
removeReport(id: string): Promise<boolean>;
|
|
51
55
|
cancel(): void;
|
|
52
56
|
notify(message: string): void;
|
|
53
57
|
saveKey(text: string): Promise<boolean>;
|
package/lib/client.js
CHANGED
|
@@ -11,9 +11,9 @@ window.__ModuleLoader__.load({
|
|
|
11
11
|
const PANEL = "fulltext";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/client/controller.ts
|
|
14
|
-
const request = async (path, signal, body) => {
|
|
14
|
+
const request = async (path, signal, body, method) => {
|
|
15
15
|
const response = await fetch(new URL(path.replace(/^\//, ""), document.baseURI), {
|
|
16
|
-
method: body === void 0 ? "GET" : "POST",
|
|
16
|
+
method: method ?? (body === void 0 ? "GET" : "POST"),
|
|
17
17
|
credentials: "same-origin",
|
|
18
18
|
cache: "no-store",
|
|
19
19
|
signal,
|
|
@@ -43,6 +43,7 @@ window.__ModuleLoader__.load({
|
|
|
43
43
|
listeners = /* @__PURE__ */ new Set();
|
|
44
44
|
active;
|
|
45
45
|
refreshRequest;
|
|
46
|
+
deleteRequest;
|
|
46
47
|
first = true;
|
|
47
48
|
disposed = false;
|
|
48
49
|
revision = 0;
|
|
@@ -148,6 +149,37 @@ window.__ModuleLoader__.load({
|
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
}
|
|
152
|
+
async removeReport(id) {
|
|
153
|
+
if (this.state.loading || this.state.busy || this.deleteRequest || !this.state.reports.some((report) => report.id === id)) return false;
|
|
154
|
+
const control = new AbortController();
|
|
155
|
+
this.deleteRequest = control;
|
|
156
|
+
this.set({
|
|
157
|
+
deleting: id,
|
|
158
|
+
error: void 0,
|
|
159
|
+
message: void 0
|
|
160
|
+
});
|
|
161
|
+
try {
|
|
162
|
+
const reply = await this.fetcher(`${ROUTE}/report?id=${encodeURIComponent(id)}`, control.signal, void 0, "DELETE");
|
|
163
|
+
if (control.signal.aborted || this.disposed || this.deleteRequest !== control) return false;
|
|
164
|
+
if (!reply.ok) throw new Error(reply.error);
|
|
165
|
+
this.revision++;
|
|
166
|
+
const reports = this.state.reports.filter((report) => report.id !== id);
|
|
167
|
+
this.set({
|
|
168
|
+
reports,
|
|
169
|
+
selected: this.state.selected?.id === id ? void 0 : this.state.selected,
|
|
170
|
+
message: "报告已删除。"
|
|
171
|
+
});
|
|
172
|
+
return true;
|
|
173
|
+
} catch (error) {
|
|
174
|
+
if (!control.signal.aborted) this.set({ error: error instanceof Error ? error.message : "报告删除失败。" });
|
|
175
|
+
return false;
|
|
176
|
+
} finally {
|
|
177
|
+
if (this.deleteRequest === control) {
|
|
178
|
+
this.deleteRequest = void 0;
|
|
179
|
+
this.set({ deleting: void 0 });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
151
183
|
cancel() {
|
|
152
184
|
this.active?.abort();
|
|
153
185
|
this.active = void 0;
|
|
@@ -202,6 +234,7 @@ window.__ModuleLoader__.load({
|
|
|
202
234
|
this.disposed = true;
|
|
203
235
|
this.active?.abort();
|
|
204
236
|
this.refreshRequest?.abort();
|
|
237
|
+
this.deleteRequest?.abort();
|
|
205
238
|
this.listeners.clear();
|
|
206
239
|
}
|
|
207
240
|
};
|
|
@@ -748,24 +781,38 @@ window.__ModuleLoader__.load({
|
|
|
748
781
|
children: "刷新"
|
|
749
782
|
})]
|
|
750
783
|
}),
|
|
751
|
-
state.reports.map((r) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
752
|
-
className: "ft-report-item"
|
|
784
|
+
state.reports.map((r) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
785
|
+
className: `ft-report-item${r.id === selected?.id ? " ft-report-item-selected" : ""}`,
|
|
753
786
|
"aria-current": r.id === selected?.id,
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
787
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
788
|
+
type: "button",
|
|
789
|
+
className: "ft-report-select",
|
|
790
|
+
onClick: () => {
|
|
791
|
+
controller.select(r.id);
|
|
792
|
+
setLibrary(false);
|
|
793
|
+
setPrompt("");
|
|
794
|
+
},
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: r.query }),
|
|
797
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
798
|
+
r.count,
|
|
799
|
+
" 个片段 · ",
|
|
800
|
+
r.papers,
|
|
801
|
+
" 篇论文"
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [new Date(r.createdAt).toLocaleDateString("zh-CN"), r.charged === void 0 ? "" : ` · ${r.charged} 积分`] })
|
|
804
|
+
]
|
|
805
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
806
|
+
type: "button",
|
|
807
|
+
className: "ft-report-delete",
|
|
808
|
+
"aria-label": `删除报告:${r.query}`,
|
|
809
|
+
title: "删除报告",
|
|
810
|
+
disabled: state.busy || state.loading || state.deleting !== void 0,
|
|
811
|
+
onClick: () => {
|
|
812
|
+
if (window.confirm(`确定删除报告“${r.query}”?\nHTML、CSV 和原始数据都会从本机移除。`)) controller.removeReport(r.id);
|
|
813
|
+
},
|
|
814
|
+
children: state.deleting === r.id ? "删除中…" : "删除"
|
|
815
|
+
})]
|
|
769
816
|
}, r.id)),
|
|
770
817
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
771
818
|
className: "ft-library-note",
|
|
@@ -875,7 +922,7 @@ window.__ModuleLoader__.load({
|
|
|
875
922
|
.ft *{box-sizing:border-box}.ft button,.ft input,.ft select{font:inherit}.ft button,.ft a{touch-action:manipulation}.ft button{cursor:pointer}.ft button:disabled{cursor:default;opacity:.5}.ft button:focus-visible,.ft a:focus-visible,.ft input:focus-visible,.ft select:focus-visible,.ft summary:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#597dfa);outline-offset:2px}
|
|
876
923
|
.ft-head{min-height:64px;flex:none;display:flex;gap:12px;align-items:center;justify-content:space-between;padding:14px 24px;padding-left:max(24px,var(--dsh-frame-leading-clearance,0px));border-bottom:1px solid var(--ft-line)}.ft-title{display:flex;gap:9px;align-items:center;white-space:nowrap}.ft-title strong{font-size:15px;font-weight:550}.ft-brand{color:var(--ft-muted);font-size:11px;margin-left:6px}.ft-button{display:inline-flex;gap:6px;align-items:center;justify-content:center;color:var(--ft-text);background:transparent;border:1px solid var(--ft-line);border-radius:8px;padding:6px 10px;text-decoration:none;white-space:nowrap;font-size:12px;line-height:20px}.ft-button:hover{background:var(--dsw-alias-interactive-bg-hover,#8881)}.ft-button-primary{background:var(--ft-text);color:var(--ft-bg);border-color:transparent}.ft-button-primary:hover{background:var(--ft-text);opacity:.85}
|
|
877
924
|
.ft-search{padding:16px 24px;border-bottom:1px solid var(--ft-line);flex:none}.ft-search-row{display:flex;gap:10px;align-items:center;max-width:1120px;margin:auto}.ft-query{flex:1;min-width:0;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:10px;padding:11px 14px;font-size:14px!important;line-height:22px}.ft-query::placeholder{color:var(--ft-muted)}.ft-count{display:flex;align-items:center;gap:6px;white-space:nowrap;color:var(--ft-muted);font-size:12px}.ft-count select,.ft-filter input,.ft-filter select{color:var(--ft-text);background:var(--ft-bg);border:1px solid var(--ft-line);border-radius:7px;padding:6px 8px;min-width:0}.ft-count select{width:66px}.ft-search-row .ft-button{min-height:44px;padding:8px 16px}.ft-options{max-width:1120px;margin:10px auto 0;color:var(--ft-muted);font-size:12px}.ft-options summary{cursor:pointer;width:fit-content}.ft-options[open] summary{margin-bottom:12px}.ft-filters{display:grid;grid-template-columns:repeat(4,minmax(90px,1fr));gap:12px}.ft-filter{display:flex;flex-direction:column;gap:5px}.ft-enrich{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:12px;align-items:center}.ft-enrich label{display:flex;align-items:center;gap:7px;color:var(--ft-text)}.ft-enrich input{accent-color:#657ee7}.ft-key-warning{max-width:1120px;margin:8px auto 0;display:flex;gap:8px;align-items:center;color:var(--ft-muted)}
|
|
878
|
-
.ft-alert{padding:10px 24px;color:var(--ft-text);background:var(--ft-fill);flex:none;overflow-wrap:anywhere}.ft-alert[role=alert]{color:var(--dsw-alias-state-danger-primary,#cc5364)}.ft-body{display:flex;flex:1;min-height:0;min-width:0}.ft-library{width:220px;flex:none;padding:18px 10px;border-right:1px solid var(--ft-line);overflow:auto}.ft-library-head{display:flex;align-items:center;justify-content:space-between;padding:0 8px 12px;color:var(--ft-muted);font-size:11px;letter-spacing:.04em}.ft-library .ft-button{padding:2px 7px;font-size:11px}.ft-report-item{display:flex;flex-direction:column;
|
|
925
|
+
.ft-alert{padding:10px 24px;color:var(--ft-text);background:var(--ft-fill);flex:none;overflow-wrap:anywhere}.ft-alert[role=alert]{color:var(--dsw-alias-state-danger-primary,#cc5364)}.ft-body{display:flex;flex:1;min-height:0;min-width:0}.ft-library{width:220px;flex:none;padding:18px 10px;border-right:1px solid var(--ft-line);overflow:auto}.ft-library-head{display:flex;align-items:center;justify-content:space-between;padding:0 8px 12px;color:var(--ft-muted);font-size:11px;letter-spacing:.04em}.ft-library .ft-button{padding:2px 7px;font-size:11px}.ft-report-item{position:relative;display:flex;flex-direction:column;gap:5px;width:100%;padding:12px 10px;border-radius:8px;margin-bottom:4px;color:var(--ft-text);background:transparent}.ft-report-item:hover,.ft-report-item-selected{background:var(--dsw-alias-interactive-bg-hover,#8881)}.ft-report-select{display:flex;flex-direction:column;gap:5px;min-width:0;width:100%;padding:0 34px 0 0;border:0;text-align:left;color:inherit;background:transparent}.ft-report-select b{font-size:12px;font-weight:500;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.ft-report-select span{font-size:10px;color:var(--ft-muted)}.ft-report-delete{position:absolute;right:7px;top:9px;padding:2px 5px;border:0;border-radius:5px;color:var(--ft-muted);background:transparent;font-size:10px;opacity:.72}.ft-report-item:hover .ft-report-delete,.ft-report-item:focus-within .ft-report-delete,.ft-report-delete:focus-visible{opacity:1}.ft-report-delete:hover:not(:disabled){color:var(--dsw-alias-state-danger-primary,#cc5364);background:var(--ft-fill)}.ft-library-note{color:var(--ft-muted);font-size:11px;padding:8px;line-height:1.8}.ft-view{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}.ft-report-bar{padding:10px 16px;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;flex:none;border-bottom:1px solid var(--ft-line)}.ft-report-bar-title{min-width:0;flex:1}.ft-report-bar-title b{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42ch}.ft-report-bar-title small{color:var(--ft-muted);font-size:11px}.ft-report-actions{display:flex;flex-wrap:wrap;gap:6px}.ft-report-actions .ft-button{font-size:11px;padding:4px 8px}.ft-frame{width:100%;flex:1;min-height:0;border:0;background:var(--ft-bg)}.ft-empty{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:32px 24px 70px;overflow:auto}.ft-empty svg{color:var(--ft-muted);margin-bottom:18px}.ft-empty h1{font-size:27px;line-height:1.4;letter-spacing:-.04em;font-weight:550;margin:0 0 12px}.ft-empty p{color:var(--ft-muted);max-width:440px;margin:0 0 22px;font-size:13px;line-height:1.8}.ft-examples{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;max-width:540px}.ft-examples button{border:1px solid var(--ft-line);border-radius:20px;background:transparent;color:var(--ft-muted);padding:7px 12px;font-size:11px}.ft-examples button:hover{color:var(--ft-text);background:var(--ft-fill)}.ft-loading{font-size:12px;color:var(--ft-muted);margin-left:8px}
|
|
879
926
|
.ft-settings{padding:32px 24px;max-width:680px;width:100%;margin:0 auto;overflow:auto}.ft-settings h2{font-size:18px;font-weight:550;margin:0 0 12px}.ft-settings p{color:var(--ft-muted);font-size:13px;line-height:1.8}.ft-settings label{display:block;font-size:12px;color:var(--ft-muted);margin:20px 0 7px}.ft-key-row{display:flex;gap:8px}.ft-key-row input{flex:1;min-width:0;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:8px;padding:9px 12px}.ft-settings-actions{display:flex;flex-wrap:wrap;gap:10px;margin:18px 0}.ft-settings a{color:var(--dsw-alias-state-business-primary,#687ee1)}.ft-key-status{padding:14px 16px;background:var(--ft-fill);border:1px solid var(--ft-line);border-radius:10px;font-size:12px}.ft-status-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#8590a2;margin-right:7px}.ft-status-dot[data-ready=true]{background:#3da888}.ft-library-toggle{display:none}.ft-task-prompt{width:100%;height:100px;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:8px;padding:10px;font:12px/1.6 system-ui,sans-serif}
|
|
880
927
|
@container fulltext (max-width:820px){.ft-library{width:190px}.ft-report-bar-title{flex-basis:100%;max-width:100%}.ft-report-bar-title b{max-width:100%}.ft-brand{display:none}.ft-report-actions{width:100%}.ft-filters{grid-template-columns:repeat(2,minmax(90px,1fr))}}
|
|
881
928
|
@container fulltext (max-width:620px){.ft-head{padding:12px 16px;min-height:56px;padding-left:max(16px,var(--dsh-frame-leading-clearance,0px))}.ft-search{padding:12px 16px}.ft-search-row{gap:7px;flex-wrap:wrap}.ft-query{width:100%;flex-basis:100%;font-size:13px!important}.ft-search-row .ft-button{min-height:36px;padding:4px 14px}.ft-count{margin-right:auto}.ft-options{margin-top:9px}.ft-library{display:none}.ft-library.ft-library-open{display:block;width:100%;border-right:0}.ft-body:has(.ft-library-open) .ft-view{display:none}.ft-library-toggle{display:inline-flex}.ft-report-bar{padding:10px 12px}.ft-report-actions{gap:5px}.ft-report-actions .ft-button{padding:3px 6px}.ft-empty{padding:24px 20px 36px}.ft-empty h1{font-size:23px}.ft-empty p{font-size:12px}.ft-title strong{font-size:14px}.ft-title svg{width:18px;height:18px}.ft-alert{padding:10px 16px}.ft-settings{padding:24px 16px}}
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["useSyncExternalStore","useState","useId","useRef","useSyncExternalStore"],"sources":["../src/shared/types.ts","../src/client/controller.ts","../src/client/credentials-port.ts","../src/client/handoff.ts","../src/client/Workspace.tsx","../src/client/styles.ts","../src/client/index.tsx"],"sourcesContent":["export const ROUTE = '/api/fulltext'\nexport const PANEL = 'fulltext'\nexport const OWN_KEY = 'FULLTEXT_API_KEY'\nexport const SHARED_KEY = 'AI4SCHOLAR_API_KEY'\nexport interface SearchInput {\n query: string\n limit: number\n year?: string\n fieldsOfStudy?: string\n venue?: string\n minCitationCount?: number | undefined\n enrich: boolean\n}\nexport interface Snippet {\n id: string\n corpusId?: string\n paperId?: string\n title: string\n titleZh?: string\n authors: string[]\n year?: number\n venue?: string\n url?: string\n pdfUrl?: string\n text: string\n kind: 'title' | 'abstract' | 'body' | 'unknown'\n section?: string\n score?: number\n}\nexport interface Charge {\n operation: 'search' | 'metadata'\n charged?: number\n remaining?: number\n}\nexport interface Report {\n id: string\n createdAt: string\n updatedAt: string\n input: SearchInput\n snippets: Snippet[]\n summary?: string\n warnings: string[]\n charges: Charge[]\n}\nexport interface ReportEntry {\n id: string\n query: string\n createdAt: string\n updatedAt: string\n count: number\n papers: number\n charged?: number\n}\nexport const isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v)\nexport const safeUrl = (v: unknown): string | undefined => {\n if (typeof v !== 'string') return undefined\n try { const u = new URL(v); return ['http:', 'https:'].includes(u.protocol) ? u.href : undefined } catch { return undefined }\n}\nexport const paperKey = (s: Snippet): string => s.corpusId ?? s.paperId ?? s.title\nexport const paperCount = (r: Report): number => new Set(r.snippets.map(paperKey)).size\nexport const totalCharge = (r: Report): number | undefined => r.charges.some(x => x.charged !== undefined)\n ? r.charges.reduce((n, x) => n + (x.charged ?? 0), 0) : undefined\nexport const entryOf = (r: Report): ReportEntry => ({ id: r.id, query: r.input.query, createdAt: r.createdAt,\n updatedAt: r.updatedAt, count: r.snippets.length, papers: paperCount(r),\n ...(totalCharge(r) === undefined ? {} : { charged: totalCharge(r)! }) })\n","import { ROUTE } from '../shared/types.js'\nimport type { ReportEntry, SearchInput } from '../shared/types.js'\nimport type { CredentialsPort } from './credentials-port.js'\nexport interface Catalog {\n version: string; configured: boolean; keySource: 'own' | 'shared' | 'none'; keyRef: string; defaultLimit: number; reports: ReportEntry[]\n}\nexport interface State {\n catalog?: Catalog | undefined\n reports: ReportEntry[]\n selected?: ReportEntry | undefined\n draft: SearchInput\n loading: boolean\n busy: boolean\n keyBusy: boolean\n error?: string | undefined\n message?: string | undefined\n}\ntype Reply<T> = { ok: true; value: T } | { ok: false; error: string }\nexport type Fetcher = <T>(path: string, signal: AbortSignal, body?: unknown) => Promise<Reply<T>>\nexport const request: Fetcher = async <T>(path: string, signal: AbortSignal, body?: unknown): Promise<Reply<T>> => {\n const response = await fetch(new URL(path.replace(/^\\//, ''), document.baseURI), {\n method: body === undefined ? 'GET' : 'POST', credentials: 'same-origin', cache: 'no-store', signal,\n ...(body === undefined ? {} : { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }),\n })\n if (!response.headers.get('content-type')?.includes('application/json')) throw new Error(`全文搜索暂不可用(HTTP ${response.status})。`)\n return response.json() as Promise<Reply<T>>\n}\n/** Persistent in-memory UI state; saved reports themselves live on the host. */\nexport class Controller {\n private state: State = { reports: [], draft: { query: '', limit: 10, enrich: true }, loading: true, busy: false, keyBusy: false }\n private listeners = new Set<() => void>()\n private active: AbortController | undefined\n private refreshRequest: AbortController | undefined\n private first = true\n private disposed = false\n private revision = 0\n constructor(private readonly credentials: () => CredentialsPort, private readonly fetcher: Fetcher = request) {}\n getSnapshot = (): State => this.state\n subscribe = (listener: () => void): (() => void) => { this.listeners.add(listener); return () => this.listeners.delete(listener) }\n private set(patch: Partial<State>) { if (this.disposed) return; this.state = { ...this.state, ...patch }; this.listeners.forEach(l => l()) }\n edit(patch: Partial<SearchInput>) { this.first = false; this.set({ draft: { ...this.state.draft, ...patch }, error: undefined, message: undefined }) }\n select(id: string) { const selected = this.state.reports.find(r => r.id === id); if (selected) this.set({ selected, error: undefined, message: undefined }) }\n newSearch() { this.set({ selected: undefined, error: undefined, message: undefined }) }\n async attach(): Promise<void> {\n this.refreshRequest?.abort()\n const control = new AbortController(), revision = this.revision; this.refreshRequest = control\n this.set({ loading: true })\n try {\n const reply = await this.fetcher<Catalog>(ROUTE, control.signal)\n if (control.signal.aborted || this.disposed) return\n if (!reply.ok) throw new Error(reply.error)\n const catalog = reply.value\n const reports = revision === this.revision ? catalog.reports : this.state.reports\n const selected = this.state.selected ? reports.find(r => r.id === this.state.selected!.id) ?? this.state.selected : undefined\n this.set({ catalog, reports, selected, ...(this.first ? { draft: { ...this.state.draft, limit: catalog.defaultLimit } } : {}), error: undefined })\n this.first = false\n } catch (error) { if (!control.signal.aborted) this.set({ error: error instanceof Error ? error.message : '读取报告失败。' }) }\n finally { if (this.refreshRequest === control) { this.refreshRequest = undefined; this.set({ loading: false }) } }\n }\n async search(): Promise<void> {\n if (this.state.busy || this.state.loading || !this.state.draft.query.trim()) return\n const control = new AbortController(); this.active = control\n this.set({ busy: true, error: undefined, message: undefined })\n try {\n const reply = await this.fetcher<ReportEntry>(ROUTE + '/search', control.signal, this.state.draft)\n if (control.signal.aborted || this.disposed || this.active !== control) return\n if (!reply.ok) throw new Error(reply.error)\n this.revision++\n this.set({ reports: [reply.value, ...this.state.reports.filter(r => r.id !== reply.value.id)].slice(0, 100), selected: reply.value })\n } catch (error) { if (!control.signal.aborted) this.set({ error: error instanceof Error ? error.message : '检索失败。' }) }\n finally { if (this.active === control) { this.active = undefined; this.set({ busy: false }) } }\n }\n cancel() {\n this.active?.abort(); this.active = undefined\n this.set({ busy: false, message: '已停止等待;已发出的接口请求仍可能计费。' })\n }\n notify(message: string) { this.set({ message }) }\n async saveKey(text: string): Promise<boolean> {\n if (!text.trim() || this.state.keyBusy || !this.state.catalog) return false\n this.set({ keyBusy: true, error: undefined, message: undefined })\n try {\n const port = this.credentials(), ref = this.state.catalog.keyRef\n if ((await port.describe(ref))?.writable === false) throw new Error('独立 Key 由环境变量或只读来源管理,请在启动环境中修改。')\n await port.set(ref, text.trim()); await this.attach(); this.set({ message: '独立 API Key 已保存。' }); return true\n } catch (error) { this.set({ error: error instanceof Error ? error.message : '保存失败。' }); return false }\n finally { this.set({ keyBusy: false }) }\n }\n async removeKey(): Promise<void> {\n if (!this.state.catalog || this.state.keyBusy) return\n this.set({ keyBusy: true, error: undefined })\n try {\n const port = this.credentials(), ref = this.state.catalog.keyRef\n if ((await port.describe(ref))?.writable === false) throw new Error('独立 Key 由环境变量或只读来源管理,请在启动环境中移除。')\n await port.unset(ref); await this.attach(); this.set({ message: '已移除独立 Key;如已配置 Ai4Scholar,将自动使用其 Key。' })\n }\n catch (error) { this.set({ error: error instanceof Error ? error.message : '移除失败。' }) }\n finally { this.set({ keyBusy: false }) }\n }\n dispose() { this.disposed = true; this.active?.abort(); this.refreshRequest?.abort(); this.listeners.clear() }\n}\n","/**\n * One credentials face over two incompatible dsh contracts.\n *\n * Why this exists: dsh moved the credentials domain in 0.1.2-alpha, and the two\n * shapes overlap in nothing but the data they carry.\n *\n * ≤0.1.1-rc.2 (npm `latest`, and the hosted web app)\n * ctx.get('connection').api.credentials\n * describe({ refs: [ref] }) -> { result: { ok, value: { credentials: {…} } } }\n * set({ ref, value }) unset({ ref }) event: credentials/updated\n *\n * ≥0.1.2-alpha (what DSH Desktop 2.0.4 bundles — alpha.1)\n * ctx.get('remote.credentials')\n * describe([ref]) -> { ok, value: { [ref]: view } }\n * set(ref, value) unset(ref) event: credentials/reference-updated\n *\n * `ConnectionHandle.api` is simply gone in alpha, so the card built against rc.6\n * read `undefined.credentials` on the desktop app and reported\n * \"保存失败: Cannot read properties of undefined (reading 'credentials')\".\n * The view payload is identical on both (configured / source? / writable), so\n * only the call shape and the envelope need bridging.\n *\n * The alpha face is passed in already resolved, and this module never dots into\n * `ctx.remote` to find it. `remote` is a cordis Service registering its\n * sub-domains as flat store entries under dotted names, and reading `.credentials`\n * off it goes through the traceable proxy, which rewrites the access into\n * `Reflect.get(ctx, 'remote.credentials')` — a *guarded* context read. Without\n * that exact name in `inject` the guard throws\n * \"cannot get property \"remote.credentials\" without inject\", which is what the\n * desktop app reported after the first fix. `ctx.get(name)` reads the same flat\n * store with no inject requirement, returning undefined instead of throwing when\n * the name is absent, so the caller resolves it that way.\n *\n * Resolved per call, never captured at apply() time, for two reasons:\n * - which face exists is a property of the host, not of our plugin, and on the\n * desktop app the answer is not the one the types promise;\n * - the alternative — declaring `remote.credentials` in `inject` — would make\n * cordis withhold apply() entirely on stable dsh, where that service does\n * not exist (cordis 4.0.x has no optional inject: every declared name is\n * required and checked). The card would vanish with no message at all, which\n * is a worse failure than the one being fixed.\n * @module dsh-ai4scholar/client/credentials-port\n */\n\n/** What both contracts report about a reference; identical payload on each. */\nexport interface CredentialView {\n /** Whether the Host currently resolves a value. */\n configured: boolean\n /** Winning source layer when configured; absent while unconfigured. */\n source?: string\n /** Whether a write from here can affect the reference. */\n writable: boolean\n}\n\n/** The three calls the card makes, with the version differences already absorbed. */\nexport interface CredentialsPort {\n /**\n * @param ref - the reference to describe.\n * @returns its view, or undefined when the Host knows nothing about it.\n */\n describe(ref: string): Promise<CredentialView | undefined>\n /**\n * @param ref - the reference to write.\n * @param value - the secret literal.\n */\n set(ref: string, value: string): Promise<void>\n /** @param ref - the reference to clear. */\n unset(ref: string): Promise<void>\n}\n\n/**\n * Where a port comes from. The controller holds this, not a port, so a host that\n * finishes wiring after apply() still works and a missing face is reported at\n * the moment of the click rather than at boot.\n */\nexport type CredentialsPortSource = () => CredentialsPort\n\n/** The two places a credentials face has lived, both optional at runtime. */\nexport interface CredentialsFaces {\n /** `ctx.get('connection')` — carries `.api.credentials` up to 0.1.1-rc.2. */\n connection?: unknown\n /**\n * `ctx.get('remote.credentials')` from 0.1.2-alpha — the service itself, already\n * resolved. Deliberately not `ctx.remote`: see the module note on why dotting\n * into that proxy throws on the very host this face exists to support.\n */\n remoteCredentials?: unknown\n}\n\n/** Narrow an unknown to something with a readable property, without `any`. */\nconst at = (host: unknown, key: string): unknown =>\n typeof host === 'object' && host !== null ? (host as Record<string, unknown>)[key] : undefined\n\n/** The stable face's calls, as they are shaped once `callable` has vouched for them. */\ninterface LegacyFace {\n describe(arg: { refs: string[] }): Promise<unknown>\n set(arg: { ref: string; value: string }): Promise<unknown>\n unset(arg: { ref: string }): Promise<unknown>\n}\n\n/** The alpha face's calls, likewise. */\ninterface ModernFace {\n describe(refs: string[]): Promise<unknown>\n set(ref: string, value: string): Promise<unknown>\n unset(ref: string): Promise<unknown>\n}\n\n/** Whether every named member of a candidate face is callable. */\nconst callable = (face: unknown, methods: readonly string[]): boolean =>\n methods.every((m) => typeof at(face, m) === 'function')\n\n/** The credential methods both contracts expose, under either calling convention. */\nconst METHODS = ['describe', 'set', 'unset'] as const\n\n/**\n * Error message for the case no host should produce: neither face present.\n * Names both the surface and its version, because the answer differs per build\n * of the same app and the version is what a bug report needs.\n */\nclass NoCredentialsFace extends Error {\n constructor() {\n super('this dsh build exposes no credentials API (neither connection.api.credentials nor the remote.credentials service) — the plugin cannot store the key here')\n this.name = 'NoCredentialsFace'\n }\n}\n\n/**\n * Read `{ok, value}` off either envelope depth.\n *\n * Stable nests the result one level down (`response.result`) and alpha does not,\n * so the depth is probed rather than assumed: a future build that changes only\n * the nesting keeps working.\n * @param response - whatever the call returned.\n * @returns the unwrapped outcome.\n */\nfunction unwrap(response: unknown): { ok: boolean; value: unknown; error: unknown } {\n const envelope = at(response, 'result') ?? response\n const ok = at(envelope, 'ok')\n return {\n // A void result (alpha's set/unset) is success: nothing to report is not failure.\n ok: ok === undefined ? true : ok === true,\n value: at(envelope, 'value'),\n error: at(envelope, 'error'),\n }\n}\n\n/**\n * Throw when a call reported failure, preserving the Host's own message.\n * @param response - whatever the call returned.\n * @param what - the operation, for the fallback message.\n * @returns the unwrapped value on success.\n */\nfunction orThrow(response: unknown, what: string): unknown {\n const { ok, value, error } = unwrap(response)\n if (ok) return value\n if (error instanceof Error) throw error\n const message = at(error, 'message')\n throw new Error(typeof message === 'string' ? message : `credentials ${what} failed`)\n}\n\n/**\n * The stable face: object arguments, `result` envelope, views under a\n * `credentials` key.\n * @param credentials - `connection.api.credentials`.\n * @returns a port speaking the ≤0.1.1-rc.2 contract.\n */\nfunction legacyPort(credentials: LegacyFace): CredentialsPort {\n return {\n async describe(ref) {\n const value = orThrow(await credentials.describe({ refs: [ref] }), 'describe')\n return at(at(value, 'credentials'), ref) as CredentialView | undefined\n },\n async set(ref, value) { orThrow(await credentials.set({ ref, value }), 'set') },\n async unset(ref) { orThrow(await credentials.unset({ ref }), 'unset') },\n }\n}\n\n/**\n * The alpha face: positional arguments, bare envelope, views keyed by reference.\n * @param credentials - `ctx.remote.credentials`.\n * @returns a port speaking the ≥0.1.2-alpha contract.\n */\nfunction modernPort(credentials: ModernFace): CredentialsPort {\n return {\n async describe(ref) {\n const value = orThrow(await credentials.describe([ref]), 'describe')\n return at(value, ref) as CredentialView | undefined\n },\n async set(ref, value) { orThrow(await credentials.set(ref, value), 'set') },\n async unset(ref) { orThrow(await credentials.unset(ref), 'unset') },\n }\n}\n\n/**\n * Pick the face this host actually has.\n *\n * The alpha face is preferred: a host carrying both is mid-migration, and the\n * newer face is the one it will keep.\n * @param faces - the two candidate faces, as resolved from the client context.\n * @returns a port for whichever contract is present.\n * @throws NoCredentialsFace when neither is.\n */\nexport function resolveCredentialsPort(faces: CredentialsFaces): CredentialsPort {\n const modern = faces.remoteCredentials\n if (callable(modern, METHODS)) return modernPort(modern as ModernFace)\n\n const legacy = at(at(faces.connection, 'api'), 'credentials')\n if (callable(legacy, METHODS)) return legacyPort(legacy as LegacyFace)\n\n throw new NoCredentialsFace()\n}\n","import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { ReportEntry } from '../shared/types.js'\ntype Outcome = 'filled' | 'busy' | 'unavailable'\ninterface SessionInput { state: { getSnapshot(): { draft: string; phase: string } }; setDraft(text: string): void; focus?(): void }\ninterface Sessions {\n list: { getSnapshot(): { byId: Record<string, { id: string; retainedBy: Record<string, number> }> }; subscribe(listener: () => void): () => void }\n binding(id: string): { ctx: ClientContext } | undefined\n}\nexport const reportPrompt = (report: ReportEntry): string => `/fulltext 读取已有报告 ${report.id},总结主要发现并用 [1] 等编号对应片段,为英文标题添加中文翻译。更新该报告并交付 HTML 和 CSV,不要重新检索。`\n/** Use the native draft initializer when no Session has been selected yet. */\nexport async function handoffReport(ctx: Pick<ClientContext, 'get'>, report: ReportEntry): Promise<Outcome> {\n const sessions = ctx.get('sessions') as unknown as Sessions | undefined\n const conversation = ctx.get('conversation') as unknown as { input: { for(ctx: ClientContext): SessionInput } } | undefined\n const layout = ctx.get('layout') as unknown as { selectPanel(id: string | null): void } | undefined\n if (!sessions || !conversation || !layout) return 'unavailable'\n const currentInput = (): SessionInput | undefined => {\n const row = Object.values(sessions.list.getSnapshot().byId).find(s => (s.retainedBy.mainView ?? 0) > 0)\n const binding = row && sessions.binding(row.id)\n return binding ? conversation.input.for(binding.ctx) : undefined\n }\n const text = reportPrompt(report)\n let input = currentInput()\n if (!input) {\n const navigation = ctx.get('uiWorkspace' as never) as { startSession(workspaceId?: string, options?: { prompt: string; whenDraftExists: 'keep'; clearPreviousDraft: false }): void } | undefined\n if (!navigation?.startSession) return 'unavailable'\n // The host reuses/creates the workspace's blank Session and preserves an\n // existing draft. No submission or model request takes place here.\n navigation.startSession(undefined, { prompt: text, whenDraftExists: 'keep', clearPreviousDraft: false })\n input = await new Promise<SessionInput | undefined>(resolve => {\n let done = false, unsubscribe: () => void = () => {}\n const finish = (value: SessionInput | undefined) => { if (done) return; done = true; clearTimeout(timer); unsubscribe(); resolve(value) }\n const check = () => { const value = currentInput(); if (value) finish(value) }\n const timer = setTimeout(() => finish(undefined), 8000)\n unsubscribe = sessions.list.subscribe(check); check()\n })\n if (!input) return 'unavailable'\n const initialized = input.state.getSnapshot()\n if (initialized.draft === text) { layout.selectPanel(null); queueMicrotask(() => input?.focus?.()); return 'filled' }\n }\n const state = input.state.getSnapshot()\n if (state.draft.trim() || ['submitting', 'adjudicating', 'submitted'].includes(state.phase)) return 'busy'\n input.setDraft(text)\n if (input.state.getSnapshot().draft !== text) return 'busy'\n layout.selectPanel(null); queueMicrotask(() => input?.focus?.()); return 'filled'\n}\n","import { useEffect, useId, useRef, useState, useSyncExternalStore } from 'react'\nimport { ROUTE } from '../shared/types.js'\nimport type { ReportEntry } from '../shared/types.js'\nimport type { Controller, State } from './controller.js'\nimport { reportPrompt } from './handoff.js'\nexport function Icon({ size = 20 }: { size?: number }) {\n return <svg width={size} height={size} viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <rect width=\"100\" height=\"100\" rx=\"22\" fill=\"#0a0a0a\"/>\n <g fill=\"#f5f5f5\">\n <path d=\"M41 19C44 18 47 21 44 24C37 30 33 36 32 40C40 38 46 43 46 50C46 57 41 62 34 62C27 62 22 57 22 50C22 37 29 26 41 19Z\"/>\n <path d=\"M73 19C76 18 79 21 76 24C69 30 65 36 64 40C72 38 78 43 78 50C78 57 73 62 66 62C59 62 54 57 54 50C54 37 61 26 73 19Z\"/>\n </g>\n <rect x=\"19\" y=\"70\" width=\"62\" height=\"8\" rx=\"4\" fill=\"#9be22c\"/>\n <rect x=\"23\" y=\"83\" width=\"54\" height=\"7\" rx=\"3.5\" fill=\"#f5f5f5\"/>\n </svg>\n}\nexport function reportUrl(report: ReportEntry, format: 'html' | 'csv', download = false): string {\n const url = new URL((ROUTE + '/report').slice(1), document.baseURI)\n url.searchParams.set('id', report.id); url.searchParams.set('format', format); url.searchParams.set('v', report.updatedAt)\n if (download) url.searchParams.set('download', '1')\n return url.href\n}\nexport function keyStatus(state: State): string {\n const c = state.catalog\n if (!c) return state.loading ? '正在读取配置…' : '配置暂不可用'\n return c.keySource === 'own' ? '已配置独立 API Key' : c.keySource === 'shared' ? '正在使用已有 Ai4Scholar API Key' : '尚未配置 API Key'\n}\nexport function Settings({ controller }: { controller: Controller }) {\n const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), [key, setKey] = useState(''), keyId = useId()\n const c = state.catalog\n useEffect(() => { void controller.attach() }, [controller])\n return <section className=\"ft-settings\">\n <h2>全文搜索设置</h2><p>可以独立使用,也可以直接沿用 Ai4Scholar 的 API Key。</p>\n <div className=\"ft-key-status\"><span className=\"ft-status-dot\" data-ready={c?.configured ?? false}/>{keyStatus(state)}</div>\n {state.error ? <div className=\"ft-alert\" role=\"alert\">{state.error}</div> : null}{state.message ? <div className=\"ft-alert\" role=\"status\">{state.message}</div> : null}\n <label htmlFor={keyId}>独立 API Key</label><div className=\"ft-key-row\"><input id={keyId} type=\"password\" autoComplete=\"off\" spellCheck={false} placeholder=\"输入新 Key\" value={key} onChange={e => setKey(e.target.value)} /><button className=\"ft-button ft-button-primary\" disabled={!key.trim() || state.keyBusy || !c} onClick={() => { void controller.saveKey(key).then(ok => { if (ok) setKey('') }) }}>{state.keyBusy ? '保存中…' : '保存'}</button></div>\n <p>保存独立 Key 后,仅全文搜索使用它;移除后会恢复使用已有 Ai4Scholar Key。<a href=\"https://ai4scholar.net/?src=dsh_fulltext\" target=\"_blank\" rel=\"noopener noreferrer\">获取 API Key ↗</a></p>\n <div className=\"ft-settings-actions\"><button className=\"ft-button\" disabled={c?.keySource !== 'own' || state.keyBusy} onClick={() => { void controller.removeKey() }}>移除独立 Key</button><button className=\"ft-button\" disabled={state.loading} onClick={() => { void controller.attach() }}>刷新状态</button></div>\n <p>搜索结果会保存为本机 HTML、CSV 和原始数据。重新打开报告、报告内筛选和导出不会再次检索;搜索和可选的论文信息补全按接口返回值计费。</p>\n <p>版本 {c?.version ?? '—'} · 原文来自 Semantic Scholar 已索引内容。</p>\n </section>\n}\nexport function Workspace({ controller, handoff }: { controller: Controller; handoff(report: ReportEntry): Promise<'filled' | 'busy' | 'unavailable'> }) {\n const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), [settings, setSettings] = useState(false)\n const [library, setLibrary] = useState(false), [prompt, setPrompt] = useState(''), query = useRef<HTMLInputElement>(null), filters = useRef<HTMLDetailsElement>(null)\n const selected = state.selected, c = state.catalog\n useEffect(() => { void controller.attach() }, [controller])\n const disabled = state.busy || state.loading || !c?.configured\n const start = () => { controller.newSearch(); setSettings(false); setLibrary(false); query.current?.focus() }\n const organize = async () => {\n if (!selected) return\n const result = await handoff(selected)\n if (result === 'busy') controller.notify('当前对话已有草稿或正在提交,请先处理,再使用「AI 整理」。')\n if (result === 'unavailable') setPrompt(reportPrompt(selected))\n }\n return <main className=\"ft\">\n <header className=\"ft-head\"><div className=\"ft-title\"><Icon/><strong>全文搜索</strong><span className=\"ft-brand\">Fulltext · Ai4Scholar</span></div><div style={{ display: 'flex', gap: 7 }}>\n <button className=\"ft-button ft-library-toggle\" aria-pressed={library} onClick={() => { setLibrary(!library); setSettings(false) }}>报告</button>\n {selected || settings ? <button className=\"ft-button\" onClick={start}>新检索</button> : null}<button className=\"ft-button\" onClick={() => { setSettings(!settings); setLibrary(false); if (settings) void controller.attach() }}>{settings ? '返回' : '设置'}</button></div></header>\n {!settings ? <form className=\"ft-search\" onSubmit={event => { event.preventDefault(); if (!disabled) { setLibrary(false); setPrompt(''); if (filters.current) filters.current.open = false; void controller.search() } }}>\n <div className=\"ft-search-row\"><input className=\"ft-query\" ref={query} aria-label=\"全文检索词\" placeholder=\"查找方法、实验参数或具体论述,建议使用英文关键词\" value={state.draft.query} onChange={e => controller.edit({ query: e.target.value })} maxLength={2000} required disabled={state.busy}/>\n <label className=\"ft-count\">片段数 <select aria-label=\"片段数\" value={state.draft.limit} disabled={state.busy} onChange={e => controller.edit({ limit: Number(e.target.value) })}>{[...new Set([5, 10, 20, 50, 100, state.draft.limit])].sort((a, b) => a - b).map(n => <option key={n}>{n}</option>)}</select></label>\n {state.busy ? <button type=\"button\" className=\"ft-button\" onClick={event => { event.preventDefault(); controller.cancel() }}>取消</button> : <button className=\"ft-button ft-button-primary\" type=\"submit\" disabled={disabled || !state.draft.query.trim()}>搜索原文</button>}\n </div><details className=\"ft-options\" ref={filters}><summary>检索条件{state.draft.year || state.draft.venue || state.draft.fieldsOfStudy || state.draft.minCitationCount !== undefined ? ' · 已设置' : ''}</summary><div className=\"ft-filters\">\n <label className=\"ft-filter\">年份 / 范围<input placeholder=\"2020-2026\" aria-label=\"检索年份\" value={state.draft.year ?? ''} disabled={state.busy} onChange={e => controller.edit({ year: e.target.value })}/></label>\n <label className=\"ft-filter\">学科<input placeholder=\"Computer Science\" aria-label=\"学科\" value={state.draft.fieldsOfStudy ?? ''} disabled={state.busy} onChange={e => controller.edit({ fieldsOfStudy: e.target.value })}/></label>\n <label className=\"ft-filter\">期刊 / 会议<input placeholder=\"Nature,Science\" aria-label=\"检索期刊\" value={state.draft.venue ?? ''} disabled={state.busy} onChange={e => controller.edit({ venue: e.target.value })}/></label>\n <label className=\"ft-filter\">最低引用数<input type=\"number\" min={0} step={1} placeholder=\"不限\" aria-label=\"最低引用数\" value={state.draft.minCitationCount ?? ''} disabled={state.busy} onChange={e => controller.edit({ minCitationCount: e.target.value ? Number(e.target.value) : undefined })}/></label>\n </div><div className=\"ft-enrich\"><label><input type=\"checkbox\" checked={state.draft.enrich} disabled={state.busy} onChange={e => controller.edit({ enrich: e.target.checked })}/>补全年份、期刊和 PDF 链接</label><span>启用后会增加一次论文信息请求,按返回值计费。</span></div></details>\n {c && !c.configured ? <div className=\"ft-key-warning\">先配置 API Key,即可开始检索。<button type=\"button\" className=\"ft-button\" onClick={() => setSettings(true)}>打开设置</button></div> : null}\n {state.busy ? <div className=\"ft-loading\" role=\"status\">正在检索并生成报告…</div> : null}\n </form> : null}\n {!settings && state.error ? <div className=\"ft-alert\" role=\"alert\">{state.error}</div> : null}{!settings && state.message ? <div className=\"ft-alert\" role=\"status\">{state.message}</div> : null}\n {settings ? <Settings controller={controller}/> : <div className=\"ft-body\"><aside className={`ft-library${library ? ' ft-library-open' : ''}`} aria-label=\"已保存报告\"><div className=\"ft-library-head\">已保存报告 <button type=\"button\" className=\"ft-button\" disabled={state.loading} onClick={() => { void controller.attach() }}>刷新</button></div>\n {state.reports.map(r => <button key={r.id} className=\"ft-report-item\" aria-current={r.id === selected?.id} onClick={() => { controller.select(r.id); setLibrary(false); setPrompt('') }}><b>{r.query}</b><span>{r.count} 个片段 · {r.papers} 篇论文</span><span>{new Date(r.createdAt).toLocaleDateString('zh-CN')}{r.charged === undefined ? '' : ` · ${r.charged} 积分`}</span></button>)}\n <p className=\"ft-library-note\">{state.reports.length ? '报告保存在本机,刷新后仍可查看。' : state.loading ? '正在读取…' : '搜索后,报告会保存在这里。'}</p></aside>\n <section className=\"ft-view\" aria-label=\"报告预览\">{selected ? <><div className=\"ft-report-bar\"><div className=\"ft-report-bar-title\"><b title={selected.query}>{selected.query}</b><small>{selected.count} 个片段 · {selected.papers} 篇论文{selected.charged === undefined ? '' : ` · ${selected.charged} 积分`}</small></div>\n <div className=\"ft-report-actions\"><button className=\"ft-button\" onClick={organize}>AI 整理</button><a className=\"ft-button\" href={reportUrl(selected, 'html')} target=\"_blank\" rel=\"noopener noreferrer\">新窗口打开 ↗</a><a className=\"ft-button\" href={reportUrl(selected, 'html', true)} download>下载 HTML</a><a className=\"ft-button\" href={reportUrl(selected, 'csv', true)} download>CSV</a></div></div>\n {prompt ? <div className=\"ft-alert\"><p>复制到对话输入框后发送,可在已有原文基础上整理报告。</p><textarea className=\"ft-task-prompt\" aria-label=\"报告整理指令\" readOnly value={prompt} onFocus={e => e.target.select()}/></div> : null}\n <iframe key={selected.id + selected.updatedAt} className=\"ft-frame\" title=\"全文搜索 HTML 报告\" sandbox=\"allow-scripts allow-popups allow-popups-to-escape-sandbox\" allow=\"clipboard-write\" src={reportUrl(selected, 'html')}/></> : <div className=\"ft-empty\"><Icon size={40}/><h1>从论文原文里,找到证据</h1><p>搜索已索引的标题、摘要和正文片段。直接阅读交互报告,也可以把同一份 HTML 和 CSV 保存下来。</p><div className=\"ft-examples\">{['solid-state battery interfacial resistance', 'attention mechanism implementation', 'CRISPR off-target detection methods'].map(q => <button type=\"button\" key={q} onClick={() => { controller.edit({ query: q }); query.current?.focus() }}>{q}</button>)}</div></div>}</section>\n </div>}\n </main>\n}\n","export function installStyles(): () => void {\n const tag = document.createElement('style')\n tag.dataset.plugin = 'dsh-fulltext'\n tag.textContent = `\n.ft{--ft-text:var(--dsw-alias-label-primary,#24252a);--ft-muted:var(--dsw-alias-label-secondary,#767880);--ft-line:var(--dsw-alias-border-l3,#e1e2e6);--ft-bg:var(--dsw-alias-bg-base,#fff);--ft-fill:var(--dsw-alias-bg-l1,#f6f7f9);color:var(--ft-text);height:100%;min-height:0;min-width:0;display:flex;flex-direction:column;overflow:hidden;font:13px/1.6 system-ui,sans-serif;container:fulltext / inline-size}\n.ft *{box-sizing:border-box}.ft button,.ft input,.ft select{font:inherit}.ft button,.ft a{touch-action:manipulation}.ft button{cursor:pointer}.ft button:disabled{cursor:default;opacity:.5}.ft button:focus-visible,.ft a:focus-visible,.ft input:focus-visible,.ft select:focus-visible,.ft summary:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#597dfa);outline-offset:2px}\n.ft-head{min-height:64px;flex:none;display:flex;gap:12px;align-items:center;justify-content:space-between;padding:14px 24px;padding-left:max(24px,var(--dsh-frame-leading-clearance,0px));border-bottom:1px solid var(--ft-line)}.ft-title{display:flex;gap:9px;align-items:center;white-space:nowrap}.ft-title strong{font-size:15px;font-weight:550}.ft-brand{color:var(--ft-muted);font-size:11px;margin-left:6px}.ft-button{display:inline-flex;gap:6px;align-items:center;justify-content:center;color:var(--ft-text);background:transparent;border:1px solid var(--ft-line);border-radius:8px;padding:6px 10px;text-decoration:none;white-space:nowrap;font-size:12px;line-height:20px}.ft-button:hover{background:var(--dsw-alias-interactive-bg-hover,#8881)}.ft-button-primary{background:var(--ft-text);color:var(--ft-bg);border-color:transparent}.ft-button-primary:hover{background:var(--ft-text);opacity:.85}\n.ft-search{padding:16px 24px;border-bottom:1px solid var(--ft-line);flex:none}.ft-search-row{display:flex;gap:10px;align-items:center;max-width:1120px;margin:auto}.ft-query{flex:1;min-width:0;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:10px;padding:11px 14px;font-size:14px!important;line-height:22px}.ft-query::placeholder{color:var(--ft-muted)}.ft-count{display:flex;align-items:center;gap:6px;white-space:nowrap;color:var(--ft-muted);font-size:12px}.ft-count select,.ft-filter input,.ft-filter select{color:var(--ft-text);background:var(--ft-bg);border:1px solid var(--ft-line);border-radius:7px;padding:6px 8px;min-width:0}.ft-count select{width:66px}.ft-search-row .ft-button{min-height:44px;padding:8px 16px}.ft-options{max-width:1120px;margin:10px auto 0;color:var(--ft-muted);font-size:12px}.ft-options summary{cursor:pointer;width:fit-content}.ft-options[open] summary{margin-bottom:12px}.ft-filters{display:grid;grid-template-columns:repeat(4,minmax(90px,1fr));gap:12px}.ft-filter{display:flex;flex-direction:column;gap:5px}.ft-enrich{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:12px;align-items:center}.ft-enrich label{display:flex;align-items:center;gap:7px;color:var(--ft-text)}.ft-enrich input{accent-color:#657ee7}.ft-key-warning{max-width:1120px;margin:8px auto 0;display:flex;gap:8px;align-items:center;color:var(--ft-muted)}\n.ft-alert{padding:10px 24px;color:var(--ft-text);background:var(--ft-fill);flex:none;overflow-wrap:anywhere}.ft-alert[role=alert]{color:var(--dsw-alias-state-danger-primary,#cc5364)}.ft-body{display:flex;flex:1;min-height:0;min-width:0}.ft-library{width:220px;flex:none;padding:18px 10px;border-right:1px solid var(--ft-line);overflow:auto}.ft-library-head{display:flex;align-items:center;justify-content:space-between;padding:0 8px 12px;color:var(--ft-muted);font-size:11px;letter-spacing:.04em}.ft-library .ft-button{padding:2px 7px;font-size:11px}.ft-report-item{display:flex;flex-direction:column;text-align:left;gap:5px;width:100%;padding:12px 10px;border:0;background:transparent;color:var(--ft-text);border-radius:8px;margin-bottom:4px}.ft-report-item:hover,.ft-report-item[aria-current=true]{background:var(--dsw-alias-interactive-bg-hover,#8881)}.ft-report-item b{font-size:12px;font-weight:500;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.ft-report-item span{font-size:10px;color:var(--ft-muted)}.ft-library-note{color:var(--ft-muted);font-size:11px;padding:8px;line-height:1.8}.ft-view{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}.ft-report-bar{padding:10px 16px;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;flex:none;border-bottom:1px solid var(--ft-line)}.ft-report-bar-title{min-width:0;flex:1}.ft-report-bar-title b{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42ch}.ft-report-bar-title small{color:var(--ft-muted);font-size:11px}.ft-report-actions{display:flex;flex-wrap:wrap;gap:6px}.ft-report-actions .ft-button{font-size:11px;padding:4px 8px}.ft-frame{width:100%;flex:1;min-height:0;border:0;background:var(--ft-bg)}.ft-empty{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:32px 24px 70px;overflow:auto}.ft-empty svg{color:var(--ft-muted);margin-bottom:18px}.ft-empty h1{font-size:27px;line-height:1.4;letter-spacing:-.04em;font-weight:550;margin:0 0 12px}.ft-empty p{color:var(--ft-muted);max-width:440px;margin:0 0 22px;font-size:13px;line-height:1.8}.ft-examples{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;max-width:540px}.ft-examples button{border:1px solid var(--ft-line);border-radius:20px;background:transparent;color:var(--ft-muted);padding:7px 12px;font-size:11px}.ft-examples button:hover{color:var(--ft-text);background:var(--ft-fill)}.ft-loading{font-size:12px;color:var(--ft-muted);margin-left:8px}\n.ft-settings{padding:32px 24px;max-width:680px;width:100%;margin:0 auto;overflow:auto}.ft-settings h2{font-size:18px;font-weight:550;margin:0 0 12px}.ft-settings p{color:var(--ft-muted);font-size:13px;line-height:1.8}.ft-settings label{display:block;font-size:12px;color:var(--ft-muted);margin:20px 0 7px}.ft-key-row{display:flex;gap:8px}.ft-key-row input{flex:1;min-width:0;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:8px;padding:9px 12px}.ft-settings-actions{display:flex;flex-wrap:wrap;gap:10px;margin:18px 0}.ft-settings a{color:var(--dsw-alias-state-business-primary,#687ee1)}.ft-key-status{padding:14px 16px;background:var(--ft-fill);border:1px solid var(--ft-line);border-radius:10px;font-size:12px}.ft-status-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#8590a2;margin-right:7px}.ft-status-dot[data-ready=true]{background:#3da888}.ft-library-toggle{display:none}.ft-task-prompt{width:100%;height:100px;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:8px;padding:10px;font:12px/1.6 system-ui,sans-serif}\n@container fulltext (max-width:820px){.ft-library{width:190px}.ft-report-bar-title{flex-basis:100%;max-width:100%}.ft-report-bar-title b{max-width:100%}.ft-brand{display:none}.ft-report-actions{width:100%}.ft-filters{grid-template-columns:repeat(2,minmax(90px,1fr))}}\n@container fulltext (max-width:620px){.ft-head{padding:12px 16px;min-height:56px;padding-left:max(16px,var(--dsh-frame-leading-clearance,0px))}.ft-search{padding:12px 16px}.ft-search-row{gap:7px;flex-wrap:wrap}.ft-query{width:100%;flex-basis:100%;font-size:13px!important}.ft-search-row .ft-button{min-height:36px;padding:4px 14px}.ft-count{margin-right:auto}.ft-options{margin-top:9px}.ft-library{display:none}.ft-library.ft-library-open{display:block;width:100%;border-right:0}.ft-body:has(.ft-library-open) .ft-view{display:none}.ft-library-toggle{display:inline-flex}.ft-report-bar{padding:10px 12px}.ft-report-actions{gap:5px}.ft-report-actions .ft-button{padding:3px 6px}.ft-empty{padding:24px 20px 36px}.ft-empty h1{font-size:23px}.ft-empty p{font-size:12px}.ft-title strong{font-size:14px}.ft-title svg{width:18px;height:18px}.ft-alert{padding:10px 16px}.ft-settings{padding:24px 16px}}\n`\n document.head.appendChild(tag)\n return () => tag.remove()\n}\n","import type { ComponentType } from 'react'\nimport { useSyncExternalStore } from 'react'\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport { Controller } from './controller.js'\nimport { resolveCredentialsPort } from './credentials-port.js'\nimport { Workspace, Settings, Icon, keyStatus } from './Workspace.js'\nimport { installStyles } from './styles.js'\nimport { PANEL } from '../shared/types.js'\nimport { handoffReport } from './handoff.js'\nexport const inject = ['slots']\ninterface Slots {\n inject(name: string, callback: () => () => void): () => void\n register<P extends object>(options: { name: string; key?: string; id?: string; order?: number; label?(): string }, component: ComponentType<P>): () => void\n}\nexport function apply(ctx: ClientContext): void {\n const controller = new Controller(() => resolveCredentialsPort({ connection: ctx.get('connection'), remoteCredentials: ctx.get('remote.credentials') }))\n ctx.effect(() => installStyles(), 'fulltext: styles')\n ctx.effect(() => () => controller.dispose(), 'fulltext: state')\n const slots = ctx.slots as unknown as Slots\n const Root = () => <Workspace controller={controller} handoff={report => handoffReport(ctx, report)}/>\n slots.inject('main', () => slots.register({ name: 'main', key: PANEL }, Root))\n slots.inject('sidebar.panellist', () => slots.register({ name: 'sidebar.panellist', id: PANEL, order: 66, label: () => '全文搜索' }, () => <Icon/>))\n const Config = ({ view = 'page' }: { view?: 'summary' | 'page' }) => {\n const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot)\n return <div className=\"ft\" style={{ height: 'auto', overflow: 'visible' }}>{view === 'summary'\n ? <p style={{ margin: 0, color: 'var(--ft-muted)', fontSize: 12 }}>{keyStatus(state)} · 打开详情配置独立 Key</p>\n : <Settings controller={controller}/>}</div>\n }\n slots.inject('plugins.bundle.config', () => slots.register({ name: 'plugins.bundle.config', key: 'dsh-fulltext' }, Config))\n slots.inject('plugins.row.config', () => slots.register({ name: 'plugins.row.config', key: 'dsh-fulltext#fulltext' }, Config))\n slots.inject('settings.section', () => slots.register({ name: 'settings.section', id: PANEL, order: 191, label: () => '全文搜索' }, Config))\n void controller.attach()\n}\n"],"mappings":";;;;;;;;;EAAA,MAAa,QAAQ;EACrB,MAAa,QAAQ;;;ECkBrB,MAAa,UAAmB,OAAU,MAAc,QAAqB,SAAsC;GACjH,MAAM,WAAW,MAAM,MAAM,IAAI,IAAI,KAAK,QAAQ,OAAO,EAAE,GAAG,SAAS,OAAO,GAAG;IAC/E,QAAQ,SAAS,KAAA,IAAY,QAAQ;IAAQ,aAAa;IAAe,OAAO;IAAY;IAC5F,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI;KAAE,SAAS,EAAE,gBAAgB,mBAAmB;KAAG,MAAM,KAAK,UAAU,IAAI;IAAE;GAC9G,CAAC;GACD,IAAI,CAAC,SAAS,QAAQ,IAAI,cAAc,CAAC,EAAE,SAAS,kBAAkB,GAAG,MAAM,IAAI,MAAM,iBAAiB,SAAS,OAAO,GAAG;GAC7H,OAAO,SAAS,KAAK;EACvB;;EAEA,IAAa,aAAb,MAAwB;GAQO;GAAqD;GAPlF,QAAuB;IAAE,SAAS,CAAC;IAAG,OAAO;KAAE,OAAO;KAAI,OAAO;KAAI,QAAQ;IAAK;IAAG,SAAS;IAAM,MAAM;IAAO,SAAS;GAAM;GAChI,4BAAoB,IAAI,IAAgB;GACxC;GACA;GACA,QAAgB;GAChB,WAAmB;GACnB,WAAmB;GACnB,YAAY,aAAqD,UAAoC,SAAS;IAAjF,KAAA,cAAA;IAAqD,KAAA,UAAA;GAA6B;GAC/G,oBAA2B,KAAK;GAChC,aAAa,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":3,"file":"client.js","names":["useSyncExternalStore","useState","useId","useRef","useSyncExternalStore"],"sources":["../src/shared/types.ts","../src/client/controller.ts","../src/client/credentials-port.ts","../src/client/handoff.ts","../src/client/Workspace.tsx","../src/client/styles.ts","../src/client/index.tsx"],"sourcesContent":["export const ROUTE = '/api/fulltext'\nexport const PANEL = 'fulltext'\nexport const OWN_KEY = 'FULLTEXT_API_KEY'\nexport const SHARED_KEY = 'AI4SCHOLAR_API_KEY'\nexport interface SearchInput {\n query: string\n limit: number\n year?: string\n fieldsOfStudy?: string\n venue?: string\n minCitationCount?: number | undefined\n enrich: boolean\n}\nexport interface Snippet {\n id: string\n corpusId?: string\n paperId?: string\n title: string\n titleZh?: string\n authors: string[]\n year?: number\n venue?: string\n url?: string\n pdfUrl?: string\n text: string\n kind: 'title' | 'abstract' | 'body' | 'unknown'\n section?: string\n score?: number\n}\nexport interface Charge {\n operation: 'search' | 'metadata'\n charged?: number\n remaining?: number\n}\nexport interface Report {\n id: string\n createdAt: string\n updatedAt: string\n input: SearchInput\n snippets: Snippet[]\n summary?: string\n warnings: string[]\n charges: Charge[]\n}\nexport interface ReportEntry {\n id: string\n query: string\n createdAt: string\n updatedAt: string\n count: number\n papers: number\n charged?: number\n}\nexport const isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v)\nexport const safeUrl = (v: unknown): string | undefined => {\n if (typeof v !== 'string') return undefined\n try { const u = new URL(v); return ['http:', 'https:'].includes(u.protocol) ? u.href : undefined } catch { return undefined }\n}\nexport const paperKey = (s: Snippet): string => s.corpusId ?? s.paperId ?? s.title\nexport const paperCount = (r: Report): number => new Set(r.snippets.map(paperKey)).size\nexport const totalCharge = (r: Report): number | undefined => r.charges.some(x => x.charged !== undefined)\n ? r.charges.reduce((n, x) => n + (x.charged ?? 0), 0) : undefined\nexport const entryOf = (r: Report): ReportEntry => ({ id: r.id, query: r.input.query, createdAt: r.createdAt,\n updatedAt: r.updatedAt, count: r.snippets.length, papers: paperCount(r),\n ...(totalCharge(r) === undefined ? {} : { charged: totalCharge(r)! }) })\n","import { ROUTE } from '../shared/types.js'\nimport type { ReportEntry, SearchInput } from '../shared/types.js'\nimport type { CredentialsPort } from './credentials-port.js'\nexport interface Catalog {\n version: string; configured: boolean; keySource: 'own' | 'shared' | 'none'; keyRef: string; defaultLimit: number; reports: ReportEntry[]\n}\nexport interface State {\n catalog?: Catalog | undefined\n reports: ReportEntry[]\n selected?: ReportEntry | undefined\n draft: SearchInput\n loading: boolean\n busy: boolean\n deleting?: string | undefined\n keyBusy: boolean\n error?: string | undefined\n message?: string | undefined\n}\ntype Reply<T> = { ok: true; value: T } | { ok: false; error: string }\nexport type Method = 'POST' | 'DELETE'\nexport type Fetcher = <T>(path: string, signal: AbortSignal, body?: unknown, method?: Method) => Promise<Reply<T>>\nexport const request: Fetcher = async <T>(path: string, signal: AbortSignal, body?: unknown, method?: Method): Promise<Reply<T>> => {\n const response = await fetch(new URL(path.replace(/^\\//, ''), document.baseURI), {\n method: method ?? (body === undefined ? 'GET' : 'POST'), credentials: 'same-origin', cache: 'no-store', signal,\n ...(body === undefined ? {} : { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }),\n })\n if (!response.headers.get('content-type')?.includes('application/json')) throw new Error(`全文搜索暂不可用(HTTP ${response.status})。`)\n return response.json() as Promise<Reply<T>>\n}\n/** Persistent in-memory UI state; saved reports themselves live on the host. */\nexport class Controller {\n private state: State = { reports: [], draft: { query: '', limit: 10, enrich: true }, loading: true, busy: false, keyBusy: false }\n private listeners = new Set<() => void>()\n private active: AbortController | undefined\n private refreshRequest: AbortController | undefined\n private deleteRequest: AbortController | undefined\n private first = true\n private disposed = false\n private revision = 0\n constructor(private readonly credentials: () => CredentialsPort, private readonly fetcher: Fetcher = request) {}\n getSnapshot = (): State => this.state\n subscribe = (listener: () => void): (() => void) => { this.listeners.add(listener); return () => this.listeners.delete(listener) }\n private set(patch: Partial<State>) { if (this.disposed) return; this.state = { ...this.state, ...patch }; this.listeners.forEach(l => l()) }\n edit(patch: Partial<SearchInput>) { this.first = false; this.set({ draft: { ...this.state.draft, ...patch }, error: undefined, message: undefined }) }\n select(id: string) { const selected = this.state.reports.find(r => r.id === id); if (selected) this.set({ selected, error: undefined, message: undefined }) }\n newSearch() { this.set({ selected: undefined, error: undefined, message: undefined }) }\n async attach(): Promise<void> {\n this.refreshRequest?.abort()\n const control = new AbortController(), revision = this.revision; this.refreshRequest = control\n this.set({ loading: true })\n try {\n const reply = await this.fetcher<Catalog>(ROUTE, control.signal)\n if (control.signal.aborted || this.disposed) return\n if (!reply.ok) throw new Error(reply.error)\n const catalog = reply.value\n const reports = revision === this.revision ? catalog.reports : this.state.reports\n const selected = this.state.selected ? reports.find(r => r.id === this.state.selected!.id) ?? this.state.selected : undefined\n this.set({ catalog, reports, selected, ...(this.first ? { draft: { ...this.state.draft, limit: catalog.defaultLimit } } : {}), error: undefined })\n this.first = false\n } catch (error) { if (!control.signal.aborted) this.set({ error: error instanceof Error ? error.message : '读取报告失败。' }) }\n finally { if (this.refreshRequest === control) { this.refreshRequest = undefined; this.set({ loading: false }) } }\n }\n async search(): Promise<void> {\n if (this.state.busy || this.state.loading || !this.state.draft.query.trim()) return\n const control = new AbortController(); this.active = control\n this.set({ busy: true, error: undefined, message: undefined })\n try {\n const reply = await this.fetcher<ReportEntry>(ROUTE + '/search', control.signal, this.state.draft)\n if (control.signal.aborted || this.disposed || this.active !== control) return\n if (!reply.ok) throw new Error(reply.error)\n this.revision++\n this.set({ reports: [reply.value, ...this.state.reports.filter(r => r.id !== reply.value.id)].slice(0, 100), selected: reply.value })\n } catch (error) { if (!control.signal.aborted) this.set({ error: error instanceof Error ? error.message : '检索失败。' }) }\n finally { if (this.active === control) { this.active = undefined; this.set({ busy: false }) } }\n }\n async removeReport(id: string): Promise<boolean> {\n if (this.state.loading || this.state.busy || this.deleteRequest || !this.state.reports.some(report => report.id === id)) return false\n const control = new AbortController(); this.deleteRequest = control\n this.set({ deleting: id, error: undefined, message: undefined })\n try {\n const reply = await this.fetcher<{ id: string }>(`${ROUTE}/report?id=${encodeURIComponent(id)}`, control.signal, undefined, 'DELETE')\n if (control.signal.aborted || this.disposed || this.deleteRequest !== control) return false\n if (!reply.ok) throw new Error(reply.error)\n this.revision++\n const reports = this.state.reports.filter(report => report.id !== id)\n this.set({ reports, selected: this.state.selected?.id === id ? undefined : this.state.selected, message: '报告已删除。' })\n return true\n } catch (error) {\n if (!control.signal.aborted) this.set({ error: error instanceof Error ? error.message : '报告删除失败。' })\n return false\n } finally {\n if (this.deleteRequest === control) { this.deleteRequest = undefined; this.set({ deleting: undefined }) }\n }\n }\n cancel() {\n this.active?.abort(); this.active = undefined\n this.set({ busy: false, message: '已停止等待;已发出的接口请求仍可能计费。' })\n }\n notify(message: string) { this.set({ message }) }\n async saveKey(text: string): Promise<boolean> {\n if (!text.trim() || this.state.keyBusy || !this.state.catalog) return false\n this.set({ keyBusy: true, error: undefined, message: undefined })\n try {\n const port = this.credentials(), ref = this.state.catalog.keyRef\n if ((await port.describe(ref))?.writable === false) throw new Error('独立 Key 由环境变量或只读来源管理,请在启动环境中修改。')\n await port.set(ref, text.trim()); await this.attach(); this.set({ message: '独立 API Key 已保存。' }); return true\n } catch (error) { this.set({ error: error instanceof Error ? error.message : '保存失败。' }); return false }\n finally { this.set({ keyBusy: false }) }\n }\n async removeKey(): Promise<void> {\n if (!this.state.catalog || this.state.keyBusy) return\n this.set({ keyBusy: true, error: undefined })\n try {\n const port = this.credentials(), ref = this.state.catalog.keyRef\n if ((await port.describe(ref))?.writable === false) throw new Error('独立 Key 由环境变量或只读来源管理,请在启动环境中移除。')\n await port.unset(ref); await this.attach(); this.set({ message: '已移除独立 Key;如已配置 Ai4Scholar,将自动使用其 Key。' })\n }\n catch (error) { this.set({ error: error instanceof Error ? error.message : '移除失败。' }) }\n finally { this.set({ keyBusy: false }) }\n }\n dispose() { this.disposed = true; this.active?.abort(); this.refreshRequest?.abort(); this.deleteRequest?.abort(); this.listeners.clear() }\n}\n","/**\n * One credentials face over two incompatible dsh contracts.\n *\n * Why this exists: dsh moved the credentials domain in 0.1.2-alpha, and the two\n * shapes overlap in nothing but the data they carry.\n *\n * ≤0.1.1-rc.2 (npm `latest`, and the hosted web app)\n * ctx.get('connection').api.credentials\n * describe({ refs: [ref] }) -> { result: { ok, value: { credentials: {…} } } }\n * set({ ref, value }) unset({ ref }) event: credentials/updated\n *\n * ≥0.1.2-alpha (what DSH Desktop 2.0.4 bundles — alpha.1)\n * ctx.get('remote.credentials')\n * describe([ref]) -> { ok, value: { [ref]: view } }\n * set(ref, value) unset(ref) event: credentials/reference-updated\n *\n * `ConnectionHandle.api` is simply gone in alpha, so the card built against rc.6\n * read `undefined.credentials` on the desktop app and reported\n * \"保存失败: Cannot read properties of undefined (reading 'credentials')\".\n * The view payload is identical on both (configured / source? / writable), so\n * only the call shape and the envelope need bridging.\n *\n * The alpha face is passed in already resolved, and this module never dots into\n * `ctx.remote` to find it. `remote` is a cordis Service registering its\n * sub-domains as flat store entries under dotted names, and reading `.credentials`\n * off it goes through the traceable proxy, which rewrites the access into\n * `Reflect.get(ctx, 'remote.credentials')` — a *guarded* context read. Without\n * that exact name in `inject` the guard throws\n * \"cannot get property \"remote.credentials\" without inject\", which is what the\n * desktop app reported after the first fix. `ctx.get(name)` reads the same flat\n * store with no inject requirement, returning undefined instead of throwing when\n * the name is absent, so the caller resolves it that way.\n *\n * Resolved per call, never captured at apply() time, for two reasons:\n * - which face exists is a property of the host, not of our plugin, and on the\n * desktop app the answer is not the one the types promise;\n * - the alternative — declaring `remote.credentials` in `inject` — would make\n * cordis withhold apply() entirely on stable dsh, where that service does\n * not exist (cordis 4.0.x has no optional inject: every declared name is\n * required and checked). The card would vanish with no message at all, which\n * is a worse failure than the one being fixed.\n * @module dsh-ai4scholar/client/credentials-port\n */\n\n/** What both contracts report about a reference; identical payload on each. */\nexport interface CredentialView {\n /** Whether the Host currently resolves a value. */\n configured: boolean\n /** Winning source layer when configured; absent while unconfigured. */\n source?: string\n /** Whether a write from here can affect the reference. */\n writable: boolean\n}\n\n/** The three calls the card makes, with the version differences already absorbed. */\nexport interface CredentialsPort {\n /**\n * @param ref - the reference to describe.\n * @returns its view, or undefined when the Host knows nothing about it.\n */\n describe(ref: string): Promise<CredentialView | undefined>\n /**\n * @param ref - the reference to write.\n * @param value - the secret literal.\n */\n set(ref: string, value: string): Promise<void>\n /** @param ref - the reference to clear. */\n unset(ref: string): Promise<void>\n}\n\n/**\n * Where a port comes from. The controller holds this, not a port, so a host that\n * finishes wiring after apply() still works and a missing face is reported at\n * the moment of the click rather than at boot.\n */\nexport type CredentialsPortSource = () => CredentialsPort\n\n/** The two places a credentials face has lived, both optional at runtime. */\nexport interface CredentialsFaces {\n /** `ctx.get('connection')` — carries `.api.credentials` up to 0.1.1-rc.2. */\n connection?: unknown\n /**\n * `ctx.get('remote.credentials')` from 0.1.2-alpha — the service itself, already\n * resolved. Deliberately not `ctx.remote`: see the module note on why dotting\n * into that proxy throws on the very host this face exists to support.\n */\n remoteCredentials?: unknown\n}\n\n/** Narrow an unknown to something with a readable property, without `any`. */\nconst at = (host: unknown, key: string): unknown =>\n typeof host === 'object' && host !== null ? (host as Record<string, unknown>)[key] : undefined\n\n/** The stable face's calls, as they are shaped once `callable` has vouched for them. */\ninterface LegacyFace {\n describe(arg: { refs: string[] }): Promise<unknown>\n set(arg: { ref: string; value: string }): Promise<unknown>\n unset(arg: { ref: string }): Promise<unknown>\n}\n\n/** The alpha face's calls, likewise. */\ninterface ModernFace {\n describe(refs: string[]): Promise<unknown>\n set(ref: string, value: string): Promise<unknown>\n unset(ref: string): Promise<unknown>\n}\n\n/** Whether every named member of a candidate face is callable. */\nconst callable = (face: unknown, methods: readonly string[]): boolean =>\n methods.every((m) => typeof at(face, m) === 'function')\n\n/** The credential methods both contracts expose, under either calling convention. */\nconst METHODS = ['describe', 'set', 'unset'] as const\n\n/**\n * Error message for the case no host should produce: neither face present.\n * Names both the surface and its version, because the answer differs per build\n * of the same app and the version is what a bug report needs.\n */\nclass NoCredentialsFace extends Error {\n constructor() {\n super('this dsh build exposes no credentials API (neither connection.api.credentials nor the remote.credentials service) — the plugin cannot store the key here')\n this.name = 'NoCredentialsFace'\n }\n}\n\n/**\n * Read `{ok, value}` off either envelope depth.\n *\n * Stable nests the result one level down (`response.result`) and alpha does not,\n * so the depth is probed rather than assumed: a future build that changes only\n * the nesting keeps working.\n * @param response - whatever the call returned.\n * @returns the unwrapped outcome.\n */\nfunction unwrap(response: unknown): { ok: boolean; value: unknown; error: unknown } {\n const envelope = at(response, 'result') ?? response\n const ok = at(envelope, 'ok')\n return {\n // A void result (alpha's set/unset) is success: nothing to report is not failure.\n ok: ok === undefined ? true : ok === true,\n value: at(envelope, 'value'),\n error: at(envelope, 'error'),\n }\n}\n\n/**\n * Throw when a call reported failure, preserving the Host's own message.\n * @param response - whatever the call returned.\n * @param what - the operation, for the fallback message.\n * @returns the unwrapped value on success.\n */\nfunction orThrow(response: unknown, what: string): unknown {\n const { ok, value, error } = unwrap(response)\n if (ok) return value\n if (error instanceof Error) throw error\n const message = at(error, 'message')\n throw new Error(typeof message === 'string' ? message : `credentials ${what} failed`)\n}\n\n/**\n * The stable face: object arguments, `result` envelope, views under a\n * `credentials` key.\n * @param credentials - `connection.api.credentials`.\n * @returns a port speaking the ≤0.1.1-rc.2 contract.\n */\nfunction legacyPort(credentials: LegacyFace): CredentialsPort {\n return {\n async describe(ref) {\n const value = orThrow(await credentials.describe({ refs: [ref] }), 'describe')\n return at(at(value, 'credentials'), ref) as CredentialView | undefined\n },\n async set(ref, value) { orThrow(await credentials.set({ ref, value }), 'set') },\n async unset(ref) { orThrow(await credentials.unset({ ref }), 'unset') },\n }\n}\n\n/**\n * The alpha face: positional arguments, bare envelope, views keyed by reference.\n * @param credentials - `ctx.remote.credentials`.\n * @returns a port speaking the ≥0.1.2-alpha contract.\n */\nfunction modernPort(credentials: ModernFace): CredentialsPort {\n return {\n async describe(ref) {\n const value = orThrow(await credentials.describe([ref]), 'describe')\n return at(value, ref) as CredentialView | undefined\n },\n async set(ref, value) { orThrow(await credentials.set(ref, value), 'set') },\n async unset(ref) { orThrow(await credentials.unset(ref), 'unset') },\n }\n}\n\n/**\n * Pick the face this host actually has.\n *\n * The alpha face is preferred: a host carrying both is mid-migration, and the\n * newer face is the one it will keep.\n * @param faces - the two candidate faces, as resolved from the client context.\n * @returns a port for whichever contract is present.\n * @throws NoCredentialsFace when neither is.\n */\nexport function resolveCredentialsPort(faces: CredentialsFaces): CredentialsPort {\n const modern = faces.remoteCredentials\n if (callable(modern, METHODS)) return modernPort(modern as ModernFace)\n\n const legacy = at(at(faces.connection, 'api'), 'credentials')\n if (callable(legacy, METHODS)) return legacyPort(legacy as LegacyFace)\n\n throw new NoCredentialsFace()\n}\n","import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { ReportEntry } from '../shared/types.js'\ntype Outcome = 'filled' | 'busy' | 'unavailable'\ninterface SessionInput { state: { getSnapshot(): { draft: string; phase: string } }; setDraft(text: string): void; focus?(): void }\ninterface Sessions {\n list: { getSnapshot(): { byId: Record<string, { id: string; retainedBy: Record<string, number> }> }; subscribe(listener: () => void): () => void }\n binding(id: string): { ctx: ClientContext } | undefined\n}\nexport const reportPrompt = (report: ReportEntry): string => `/fulltext 读取已有报告 ${report.id},总结主要发现并用 [1] 等编号对应片段,为英文标题添加中文翻译。更新该报告并交付 HTML 和 CSV,不要重新检索。`\n/** Use the native draft initializer when no Session has been selected yet. */\nexport async function handoffReport(ctx: Pick<ClientContext, 'get'>, report: ReportEntry): Promise<Outcome> {\n const sessions = ctx.get('sessions') as unknown as Sessions | undefined\n const conversation = ctx.get('conversation') as unknown as { input: { for(ctx: ClientContext): SessionInput } } | undefined\n const layout = ctx.get('layout') as unknown as { selectPanel(id: string | null): void } | undefined\n if (!sessions || !conversation || !layout) return 'unavailable'\n const currentInput = (): SessionInput | undefined => {\n const row = Object.values(sessions.list.getSnapshot().byId).find(s => (s.retainedBy.mainView ?? 0) > 0)\n const binding = row && sessions.binding(row.id)\n return binding ? conversation.input.for(binding.ctx) : undefined\n }\n const text = reportPrompt(report)\n let input = currentInput()\n if (!input) {\n const navigation = ctx.get('uiWorkspace' as never) as { startSession(workspaceId?: string, options?: { prompt: string; whenDraftExists: 'keep'; clearPreviousDraft: false }): void } | undefined\n if (!navigation?.startSession) return 'unavailable'\n // The host reuses/creates the workspace's blank Session and preserves an\n // existing draft. No submission or model request takes place here.\n navigation.startSession(undefined, { prompt: text, whenDraftExists: 'keep', clearPreviousDraft: false })\n input = await new Promise<SessionInput | undefined>(resolve => {\n let done = false, unsubscribe: () => void = () => {}\n const finish = (value: SessionInput | undefined) => { if (done) return; done = true; clearTimeout(timer); unsubscribe(); resolve(value) }\n const check = () => { const value = currentInput(); if (value) finish(value) }\n const timer = setTimeout(() => finish(undefined), 8000)\n unsubscribe = sessions.list.subscribe(check); check()\n })\n if (!input) return 'unavailable'\n const initialized = input.state.getSnapshot()\n if (initialized.draft === text) { layout.selectPanel(null); queueMicrotask(() => input?.focus?.()); return 'filled' }\n }\n const state = input.state.getSnapshot()\n if (state.draft.trim() || ['submitting', 'adjudicating', 'submitted'].includes(state.phase)) return 'busy'\n input.setDraft(text)\n if (input.state.getSnapshot().draft !== text) return 'busy'\n layout.selectPanel(null); queueMicrotask(() => input?.focus?.()); return 'filled'\n}\n","import { useEffect, useId, useRef, useState, useSyncExternalStore } from 'react'\nimport { ROUTE } from '../shared/types.js'\nimport type { ReportEntry } from '../shared/types.js'\nimport type { Controller, State } from './controller.js'\nimport { reportPrompt } from './handoff.js'\nexport function Icon({ size = 20 }: { size?: number }) {\n return <svg width={size} height={size} viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <rect width=\"100\" height=\"100\" rx=\"22\" fill=\"#0a0a0a\"/>\n <g fill=\"#f5f5f5\">\n <path d=\"M41 19C44 18 47 21 44 24C37 30 33 36 32 40C40 38 46 43 46 50C46 57 41 62 34 62C27 62 22 57 22 50C22 37 29 26 41 19Z\"/>\n <path d=\"M73 19C76 18 79 21 76 24C69 30 65 36 64 40C72 38 78 43 78 50C78 57 73 62 66 62C59 62 54 57 54 50C54 37 61 26 73 19Z\"/>\n </g>\n <rect x=\"19\" y=\"70\" width=\"62\" height=\"8\" rx=\"4\" fill=\"#9be22c\"/>\n <rect x=\"23\" y=\"83\" width=\"54\" height=\"7\" rx=\"3.5\" fill=\"#f5f5f5\"/>\n </svg>\n}\nexport function reportUrl(report: ReportEntry, format: 'html' | 'csv', download = false): string {\n const url = new URL((ROUTE + '/report').slice(1), document.baseURI)\n url.searchParams.set('id', report.id); url.searchParams.set('format', format); url.searchParams.set('v', report.updatedAt)\n if (download) url.searchParams.set('download', '1')\n return url.href\n}\nexport function keyStatus(state: State): string {\n const c = state.catalog\n if (!c) return state.loading ? '正在读取配置…' : '配置暂不可用'\n return c.keySource === 'own' ? '已配置独立 API Key' : c.keySource === 'shared' ? '正在使用已有 Ai4Scholar API Key' : '尚未配置 API Key'\n}\nexport function Settings({ controller }: { controller: Controller }) {\n const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), [key, setKey] = useState(''), keyId = useId()\n const c = state.catalog\n useEffect(() => { void controller.attach() }, [controller])\n return <section className=\"ft-settings\">\n <h2>全文搜索设置</h2><p>可以独立使用,也可以直接沿用 Ai4Scholar 的 API Key。</p>\n <div className=\"ft-key-status\"><span className=\"ft-status-dot\" data-ready={c?.configured ?? false}/>{keyStatus(state)}</div>\n {state.error ? <div className=\"ft-alert\" role=\"alert\">{state.error}</div> : null}{state.message ? <div className=\"ft-alert\" role=\"status\">{state.message}</div> : null}\n <label htmlFor={keyId}>独立 API Key</label><div className=\"ft-key-row\"><input id={keyId} type=\"password\" autoComplete=\"off\" spellCheck={false} placeholder=\"输入新 Key\" value={key} onChange={e => setKey(e.target.value)} /><button className=\"ft-button ft-button-primary\" disabled={!key.trim() || state.keyBusy || !c} onClick={() => { void controller.saveKey(key).then(ok => { if (ok) setKey('') }) }}>{state.keyBusy ? '保存中…' : '保存'}</button></div>\n <p>保存独立 Key 后,仅全文搜索使用它;移除后会恢复使用已有 Ai4Scholar Key。<a href=\"https://ai4scholar.net/?src=dsh_fulltext\" target=\"_blank\" rel=\"noopener noreferrer\">获取 API Key ↗</a></p>\n <div className=\"ft-settings-actions\"><button className=\"ft-button\" disabled={c?.keySource !== 'own' || state.keyBusy} onClick={() => { void controller.removeKey() }}>移除独立 Key</button><button className=\"ft-button\" disabled={state.loading} onClick={() => { void controller.attach() }}>刷新状态</button></div>\n <p>搜索结果会保存为本机 HTML、CSV 和原始数据。重新打开报告、报告内筛选和导出不会再次检索;搜索和可选的论文信息补全按接口返回值计费。</p>\n <p>版本 {c?.version ?? '—'} · 原文来自 Semantic Scholar 已索引内容。</p>\n </section>\n}\nexport function Workspace({ controller, handoff }: { controller: Controller; handoff(report: ReportEntry): Promise<'filled' | 'busy' | 'unavailable'> }) {\n const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), [settings, setSettings] = useState(false)\n const [library, setLibrary] = useState(false), [prompt, setPrompt] = useState(''), query = useRef<HTMLInputElement>(null), filters = useRef<HTMLDetailsElement>(null)\n const selected = state.selected, c = state.catalog\n useEffect(() => { void controller.attach() }, [controller])\n const disabled = state.busy || state.loading || !c?.configured\n const start = () => { controller.newSearch(); setSettings(false); setLibrary(false); query.current?.focus() }\n const organize = async () => {\n if (!selected) return\n const result = await handoff(selected)\n if (result === 'busy') controller.notify('当前对话已有草稿或正在提交,请先处理,再使用「AI 整理」。')\n if (result === 'unavailable') setPrompt(reportPrompt(selected))\n }\n return <main className=\"ft\">\n <header className=\"ft-head\"><div className=\"ft-title\"><Icon/><strong>全文搜索</strong><span className=\"ft-brand\">Fulltext · Ai4Scholar</span></div><div style={{ display: 'flex', gap: 7 }}>\n <button className=\"ft-button ft-library-toggle\" aria-pressed={library} onClick={() => { setLibrary(!library); setSettings(false) }}>报告</button>\n {selected || settings ? <button className=\"ft-button\" onClick={start}>新检索</button> : null}<button className=\"ft-button\" onClick={() => { setSettings(!settings); setLibrary(false); if (settings) void controller.attach() }}>{settings ? '返回' : '设置'}</button></div></header>\n {!settings ? <form className=\"ft-search\" onSubmit={event => { event.preventDefault(); if (!disabled) { setLibrary(false); setPrompt(''); if (filters.current) filters.current.open = false; void controller.search() } }}>\n <div className=\"ft-search-row\"><input className=\"ft-query\" ref={query} aria-label=\"全文检索词\" placeholder=\"查找方法、实验参数或具体论述,建议使用英文关键词\" value={state.draft.query} onChange={e => controller.edit({ query: e.target.value })} maxLength={2000} required disabled={state.busy}/>\n <label className=\"ft-count\">片段数 <select aria-label=\"片段数\" value={state.draft.limit} disabled={state.busy} onChange={e => controller.edit({ limit: Number(e.target.value) })}>{[...new Set([5, 10, 20, 50, 100, state.draft.limit])].sort((a, b) => a - b).map(n => <option key={n}>{n}</option>)}</select></label>\n {state.busy ? <button type=\"button\" className=\"ft-button\" onClick={event => { event.preventDefault(); controller.cancel() }}>取消</button> : <button className=\"ft-button ft-button-primary\" type=\"submit\" disabled={disabled || !state.draft.query.trim()}>搜索原文</button>}\n </div><details className=\"ft-options\" ref={filters}><summary>检索条件{state.draft.year || state.draft.venue || state.draft.fieldsOfStudy || state.draft.minCitationCount !== undefined ? ' · 已设置' : ''}</summary><div className=\"ft-filters\">\n <label className=\"ft-filter\">年份 / 范围<input placeholder=\"2020-2026\" aria-label=\"检索年份\" value={state.draft.year ?? ''} disabled={state.busy} onChange={e => controller.edit({ year: e.target.value })}/></label>\n <label className=\"ft-filter\">学科<input placeholder=\"Computer Science\" aria-label=\"学科\" value={state.draft.fieldsOfStudy ?? ''} disabled={state.busy} onChange={e => controller.edit({ fieldsOfStudy: e.target.value })}/></label>\n <label className=\"ft-filter\">期刊 / 会议<input placeholder=\"Nature,Science\" aria-label=\"检索期刊\" value={state.draft.venue ?? ''} disabled={state.busy} onChange={e => controller.edit({ venue: e.target.value })}/></label>\n <label className=\"ft-filter\">最低引用数<input type=\"number\" min={0} step={1} placeholder=\"不限\" aria-label=\"最低引用数\" value={state.draft.minCitationCount ?? ''} disabled={state.busy} onChange={e => controller.edit({ minCitationCount: e.target.value ? Number(e.target.value) : undefined })}/></label>\n </div><div className=\"ft-enrich\"><label><input type=\"checkbox\" checked={state.draft.enrich} disabled={state.busy} onChange={e => controller.edit({ enrich: e.target.checked })}/>补全年份、期刊和 PDF 链接</label><span>启用后会增加一次论文信息请求,按返回值计费。</span></div></details>\n {c && !c.configured ? <div className=\"ft-key-warning\">先配置 API Key,即可开始检索。<button type=\"button\" className=\"ft-button\" onClick={() => setSettings(true)}>打开设置</button></div> : null}\n {state.busy ? <div className=\"ft-loading\" role=\"status\">正在检索并生成报告…</div> : null}\n </form> : null}\n {!settings && state.error ? <div className=\"ft-alert\" role=\"alert\">{state.error}</div> : null}{!settings && state.message ? <div className=\"ft-alert\" role=\"status\">{state.message}</div> : null}\n {settings ? <Settings controller={controller}/> : <div className=\"ft-body\"><aside className={`ft-library${library ? ' ft-library-open' : ''}`} aria-label=\"已保存报告\"><div className=\"ft-library-head\">已保存报告 <button type=\"button\" className=\"ft-button\" disabled={state.loading} onClick={() => { void controller.attach() }}>刷新</button></div>\n {state.reports.map(r => <div key={r.id} className={`ft-report-item${r.id === selected?.id ? ' ft-report-item-selected' : ''}`} aria-current={r.id === selected?.id}>\n <button type=\"button\" className=\"ft-report-select\" onClick={() => { controller.select(r.id); setLibrary(false); setPrompt('') }}><b>{r.query}</b><span>{r.count} 个片段 · {r.papers} 篇论文</span><span>{new Date(r.createdAt).toLocaleDateString('zh-CN')}{r.charged === undefined ? '' : ` · ${r.charged} 积分`}</span></button>\n <button type=\"button\" className=\"ft-report-delete\" aria-label={`删除报告:${r.query}`} title=\"删除报告\" disabled={state.busy || state.loading || state.deleting !== undefined} onClick={() => { if (window.confirm(`确定删除报告“${r.query}”?\\nHTML、CSV 和原始数据都会从本机移除。`)) void controller.removeReport(r.id) }}>{state.deleting === r.id ? '删除中…' : '删除'}</button>\n </div>)}\n <p className=\"ft-library-note\">{state.reports.length ? '报告保存在本机,刷新后仍可查看。' : state.loading ? '正在读取…' : '搜索后,报告会保存在这里。'}</p></aside>\n <section className=\"ft-view\" aria-label=\"报告预览\">{selected ? <><div className=\"ft-report-bar\"><div className=\"ft-report-bar-title\"><b title={selected.query}>{selected.query}</b><small>{selected.count} 个片段 · {selected.papers} 篇论文{selected.charged === undefined ? '' : ` · ${selected.charged} 积分`}</small></div>\n <div className=\"ft-report-actions\"><button className=\"ft-button\" onClick={organize}>AI 整理</button><a className=\"ft-button\" href={reportUrl(selected, 'html')} target=\"_blank\" rel=\"noopener noreferrer\">新窗口打开 ↗</a><a className=\"ft-button\" href={reportUrl(selected, 'html', true)} download>下载 HTML</a><a className=\"ft-button\" href={reportUrl(selected, 'csv', true)} download>CSV</a></div></div>\n {prompt ? <div className=\"ft-alert\"><p>复制到对话输入框后发送,可在已有原文基础上整理报告。</p><textarea className=\"ft-task-prompt\" aria-label=\"报告整理指令\" readOnly value={prompt} onFocus={e => e.target.select()}/></div> : null}\n <iframe key={selected.id + selected.updatedAt} className=\"ft-frame\" title=\"全文搜索 HTML 报告\" sandbox=\"allow-scripts allow-popups allow-popups-to-escape-sandbox\" allow=\"clipboard-write\" src={reportUrl(selected, 'html')}/></> : <div className=\"ft-empty\"><Icon size={40}/><h1>从论文原文里,找到证据</h1><p>搜索已索引的标题、摘要和正文片段。直接阅读交互报告,也可以把同一份 HTML 和 CSV 保存下来。</p><div className=\"ft-examples\">{['solid-state battery interfacial resistance', 'attention mechanism implementation', 'CRISPR off-target detection methods'].map(q => <button type=\"button\" key={q} onClick={() => { controller.edit({ query: q }); query.current?.focus() }}>{q}</button>)}</div></div>}</section>\n </div>}\n </main>\n}\n","export function installStyles(): () => void {\n const tag = document.createElement('style')\n tag.dataset.plugin = 'dsh-fulltext'\n tag.textContent = `\n.ft{--ft-text:var(--dsw-alias-label-primary,#24252a);--ft-muted:var(--dsw-alias-label-secondary,#767880);--ft-line:var(--dsw-alias-border-l3,#e1e2e6);--ft-bg:var(--dsw-alias-bg-base,#fff);--ft-fill:var(--dsw-alias-bg-l1,#f6f7f9);color:var(--ft-text);height:100%;min-height:0;min-width:0;display:flex;flex-direction:column;overflow:hidden;font:13px/1.6 system-ui,sans-serif;container:fulltext / inline-size}\n.ft *{box-sizing:border-box}.ft button,.ft input,.ft select{font:inherit}.ft button,.ft a{touch-action:manipulation}.ft button{cursor:pointer}.ft button:disabled{cursor:default;opacity:.5}.ft button:focus-visible,.ft a:focus-visible,.ft input:focus-visible,.ft select:focus-visible,.ft summary:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#597dfa);outline-offset:2px}\n.ft-head{min-height:64px;flex:none;display:flex;gap:12px;align-items:center;justify-content:space-between;padding:14px 24px;padding-left:max(24px,var(--dsh-frame-leading-clearance,0px));border-bottom:1px solid var(--ft-line)}.ft-title{display:flex;gap:9px;align-items:center;white-space:nowrap}.ft-title strong{font-size:15px;font-weight:550}.ft-brand{color:var(--ft-muted);font-size:11px;margin-left:6px}.ft-button{display:inline-flex;gap:6px;align-items:center;justify-content:center;color:var(--ft-text);background:transparent;border:1px solid var(--ft-line);border-radius:8px;padding:6px 10px;text-decoration:none;white-space:nowrap;font-size:12px;line-height:20px}.ft-button:hover{background:var(--dsw-alias-interactive-bg-hover,#8881)}.ft-button-primary{background:var(--ft-text);color:var(--ft-bg);border-color:transparent}.ft-button-primary:hover{background:var(--ft-text);opacity:.85}\n.ft-search{padding:16px 24px;border-bottom:1px solid var(--ft-line);flex:none}.ft-search-row{display:flex;gap:10px;align-items:center;max-width:1120px;margin:auto}.ft-query{flex:1;min-width:0;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:10px;padding:11px 14px;font-size:14px!important;line-height:22px}.ft-query::placeholder{color:var(--ft-muted)}.ft-count{display:flex;align-items:center;gap:6px;white-space:nowrap;color:var(--ft-muted);font-size:12px}.ft-count select,.ft-filter input,.ft-filter select{color:var(--ft-text);background:var(--ft-bg);border:1px solid var(--ft-line);border-radius:7px;padding:6px 8px;min-width:0}.ft-count select{width:66px}.ft-search-row .ft-button{min-height:44px;padding:8px 16px}.ft-options{max-width:1120px;margin:10px auto 0;color:var(--ft-muted);font-size:12px}.ft-options summary{cursor:pointer;width:fit-content}.ft-options[open] summary{margin-bottom:12px}.ft-filters{display:grid;grid-template-columns:repeat(4,minmax(90px,1fr));gap:12px}.ft-filter{display:flex;flex-direction:column;gap:5px}.ft-enrich{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:12px;align-items:center}.ft-enrich label{display:flex;align-items:center;gap:7px;color:var(--ft-text)}.ft-enrich input{accent-color:#657ee7}.ft-key-warning{max-width:1120px;margin:8px auto 0;display:flex;gap:8px;align-items:center;color:var(--ft-muted)}\n.ft-alert{padding:10px 24px;color:var(--ft-text);background:var(--ft-fill);flex:none;overflow-wrap:anywhere}.ft-alert[role=alert]{color:var(--dsw-alias-state-danger-primary,#cc5364)}.ft-body{display:flex;flex:1;min-height:0;min-width:0}.ft-library{width:220px;flex:none;padding:18px 10px;border-right:1px solid var(--ft-line);overflow:auto}.ft-library-head{display:flex;align-items:center;justify-content:space-between;padding:0 8px 12px;color:var(--ft-muted);font-size:11px;letter-spacing:.04em}.ft-library .ft-button{padding:2px 7px;font-size:11px}.ft-report-item{position:relative;display:flex;flex-direction:column;gap:5px;width:100%;padding:12px 10px;border-radius:8px;margin-bottom:4px;color:var(--ft-text);background:transparent}.ft-report-item:hover,.ft-report-item-selected{background:var(--dsw-alias-interactive-bg-hover,#8881)}.ft-report-select{display:flex;flex-direction:column;gap:5px;min-width:0;width:100%;padding:0 34px 0 0;border:0;text-align:left;color:inherit;background:transparent}.ft-report-select b{font-size:12px;font-weight:500;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.ft-report-select span{font-size:10px;color:var(--ft-muted)}.ft-report-delete{position:absolute;right:7px;top:9px;padding:2px 5px;border:0;border-radius:5px;color:var(--ft-muted);background:transparent;font-size:10px;opacity:.72}.ft-report-item:hover .ft-report-delete,.ft-report-item:focus-within .ft-report-delete,.ft-report-delete:focus-visible{opacity:1}.ft-report-delete:hover:not(:disabled){color:var(--dsw-alias-state-danger-primary,#cc5364);background:var(--ft-fill)}.ft-library-note{color:var(--ft-muted);font-size:11px;padding:8px;line-height:1.8}.ft-view{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}.ft-report-bar{padding:10px 16px;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;flex:none;border-bottom:1px solid var(--ft-line)}.ft-report-bar-title{min-width:0;flex:1}.ft-report-bar-title b{display:block;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42ch}.ft-report-bar-title small{color:var(--ft-muted);font-size:11px}.ft-report-actions{display:flex;flex-wrap:wrap;gap:6px}.ft-report-actions .ft-button{font-size:11px;padding:4px 8px}.ft-frame{width:100%;flex:1;min-height:0;border:0;background:var(--ft-bg)}.ft-empty{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:32px 24px 70px;overflow:auto}.ft-empty svg{color:var(--ft-muted);margin-bottom:18px}.ft-empty h1{font-size:27px;line-height:1.4;letter-spacing:-.04em;font-weight:550;margin:0 0 12px}.ft-empty p{color:var(--ft-muted);max-width:440px;margin:0 0 22px;font-size:13px;line-height:1.8}.ft-examples{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;max-width:540px}.ft-examples button{border:1px solid var(--ft-line);border-radius:20px;background:transparent;color:var(--ft-muted);padding:7px 12px;font-size:11px}.ft-examples button:hover{color:var(--ft-text);background:var(--ft-fill)}.ft-loading{font-size:12px;color:var(--ft-muted);margin-left:8px}\n.ft-settings{padding:32px 24px;max-width:680px;width:100%;margin:0 auto;overflow:auto}.ft-settings h2{font-size:18px;font-weight:550;margin:0 0 12px}.ft-settings p{color:var(--ft-muted);font-size:13px;line-height:1.8}.ft-settings label{display:block;font-size:12px;color:var(--ft-muted);margin:20px 0 7px}.ft-key-row{display:flex;gap:8px}.ft-key-row input{flex:1;min-width:0;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:8px;padding:9px 12px}.ft-settings-actions{display:flex;flex-wrap:wrap;gap:10px;margin:18px 0}.ft-settings a{color:var(--dsw-alias-state-business-primary,#687ee1)}.ft-key-status{padding:14px 16px;background:var(--ft-fill);border:1px solid var(--ft-line);border-radius:10px;font-size:12px}.ft-status-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#8590a2;margin-right:7px}.ft-status-dot[data-ready=true]{background:#3da888}.ft-library-toggle{display:none}.ft-task-prompt{width:100%;height:100px;background:var(--ft-bg);color:var(--ft-text);border:1px solid var(--ft-line);border-radius:8px;padding:10px;font:12px/1.6 system-ui,sans-serif}\n@container fulltext (max-width:820px){.ft-library{width:190px}.ft-report-bar-title{flex-basis:100%;max-width:100%}.ft-report-bar-title b{max-width:100%}.ft-brand{display:none}.ft-report-actions{width:100%}.ft-filters{grid-template-columns:repeat(2,minmax(90px,1fr))}}\n@container fulltext (max-width:620px){.ft-head{padding:12px 16px;min-height:56px;padding-left:max(16px,var(--dsh-frame-leading-clearance,0px))}.ft-search{padding:12px 16px}.ft-search-row{gap:7px;flex-wrap:wrap}.ft-query{width:100%;flex-basis:100%;font-size:13px!important}.ft-search-row .ft-button{min-height:36px;padding:4px 14px}.ft-count{margin-right:auto}.ft-options{margin-top:9px}.ft-library{display:none}.ft-library.ft-library-open{display:block;width:100%;border-right:0}.ft-body:has(.ft-library-open) .ft-view{display:none}.ft-library-toggle{display:inline-flex}.ft-report-bar{padding:10px 12px}.ft-report-actions{gap:5px}.ft-report-actions .ft-button{padding:3px 6px}.ft-empty{padding:24px 20px 36px}.ft-empty h1{font-size:23px}.ft-empty p{font-size:12px}.ft-title strong{font-size:14px}.ft-title svg{width:18px;height:18px}.ft-alert{padding:10px 16px}.ft-settings{padding:24px 16px}}\n`\n document.head.appendChild(tag)\n return () => tag.remove()\n}\n","import type { ComponentType } from 'react'\nimport { useSyncExternalStore } from 'react'\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport { Controller } from './controller.js'\nimport { resolveCredentialsPort } from './credentials-port.js'\nimport { Workspace, Settings, Icon, keyStatus } from './Workspace.js'\nimport { installStyles } from './styles.js'\nimport { PANEL } from '../shared/types.js'\nimport { handoffReport } from './handoff.js'\nexport const inject = ['slots']\ninterface Slots {\n inject(name: string, callback: () => () => void): () => void\n register<P extends object>(options: { name: string; key?: string; id?: string; order?: number; label?(): string }, component: ComponentType<P>): () => void\n}\nexport function apply(ctx: ClientContext): void {\n const controller = new Controller(() => resolveCredentialsPort({ connection: ctx.get('connection'), remoteCredentials: ctx.get('remote.credentials') }))\n ctx.effect(() => installStyles(), 'fulltext: styles')\n ctx.effect(() => () => controller.dispose(), 'fulltext: state')\n const slots = ctx.slots as unknown as Slots\n const Root = () => <Workspace controller={controller} handoff={report => handoffReport(ctx, report)}/>\n slots.inject('main', () => slots.register({ name: 'main', key: PANEL }, Root))\n slots.inject('sidebar.panellist', () => slots.register({ name: 'sidebar.panellist', id: PANEL, order: 66, label: () => '全文搜索' }, () => <Icon/>))\n const Config = ({ view = 'page' }: { view?: 'summary' | 'page' }) => {\n const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot)\n return <div className=\"ft\" style={{ height: 'auto', overflow: 'visible' }}>{view === 'summary'\n ? <p style={{ margin: 0, color: 'var(--ft-muted)', fontSize: 12 }}>{keyStatus(state)} · 打开详情配置独立 Key</p>\n : <Settings controller={controller}/>}</div>\n }\n slots.inject('plugins.bundle.config', () => slots.register({ name: 'plugins.bundle.config', key: 'dsh-fulltext' }, Config))\n slots.inject('plugins.row.config', () => slots.register({ name: 'plugins.row.config', key: 'dsh-fulltext#fulltext' }, Config))\n slots.inject('settings.section', () => slots.register({ name: 'settings.section', id: PANEL, order: 191, label: () => '全文搜索' }, Config))\n void controller.attach()\n}\n"],"mappings":";;;;;;;;;EAAA,MAAa,QAAQ;EACrB,MAAa,Q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
|
14
14
|
search(request: Request): Promise<Response>;
|
|
15
15
|
report(request: Request): Promise<Response>;
|
|
16
|
+
removeReport(request: Request): Promise<Response>;
|
|
16
17
|
};
|
|
17
18
|
/** Uses the same authenticated, owner-only fetch registry as native settings. */
|
|
18
19
|
export declare function applyRoutes(ctx: Context, service: FulltextSearch, store: ReportStore, status: () => Promise<Status>): void;
|
package/lib/routes.js
CHANGED
|
@@ -46,6 +46,18 @@ export function createHandlers(service, store, status) {
|
|
|
46
46
|
return json({ ok: false, error: '报告不存在或无法读取。' }, 404);
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
+
async removeReport(request) {
|
|
50
|
+
const id = new URL(request.url).searchParams.get('id');
|
|
51
|
+
if (!id || !/^[a-f0-9-]{36}$/.test(id))
|
|
52
|
+
return json({ ok: false, error: '报告不存在。' }, 404);
|
|
53
|
+
try {
|
|
54
|
+
await store.remove(id);
|
|
55
|
+
return json({ ok: true, value: { id } });
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return json({ ok: false, error: error instanceof Error ? error.message : '报告无法删除。' }, 404);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
49
61
|
};
|
|
50
62
|
}
|
|
51
63
|
/** Uses the same authenticated, owner-only fetch registry as native settings. */
|
|
@@ -57,6 +69,6 @@ export function applyRoutes(ctx, service, store, status) {
|
|
|
57
69
|
return;
|
|
58
70
|
bridge.register({ path: ROUTE, methods: ['GET'], requestBody: 'buffered', fetch: () => handlers.catalog() });
|
|
59
71
|
bridge.register({ path: `${ROUTE}/search`, methods: ['POST'], requestBody: 'buffered', fetch: request => handlers.search(request) });
|
|
60
|
-
bridge.register({ path: `${ROUTE}/report`, methods: ['GET'], requestBody: 'buffered', fetch: request => handlers.report(request) });
|
|
72
|
+
bridge.register({ path: `${ROUTE}/report`, methods: ['GET', 'DELETE'], requestBody: 'buffered', fetch: request => request.method === 'DELETE' ? handlers.removeReport(request) : handlers.report(request) });
|
|
61
73
|
});
|
|
62
74
|
}
|
package/lib/store.d.ts
CHANGED
package/lib/store.js
CHANGED
|
@@ -38,6 +38,18 @@ export class ReportStore {
|
|
|
38
38
|
throw new Error('报告数据无效。');
|
|
39
39
|
return raw;
|
|
40
40
|
}
|
|
41
|
+
/** Remove one complete saved report and its generated exports. */
|
|
42
|
+
async remove(id) {
|
|
43
|
+
this.paths(id);
|
|
44
|
+
try {
|
|
45
|
+
await rm(join(this.root, id), { recursive: true, force: false });
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (error.code === 'ENOENT')
|
|
49
|
+
throw new Error('报告不存在。');
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
41
53
|
async list() {
|
|
42
54
|
let files;
|
|
43
55
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-fulltext",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Ai4Scholar Fulltext for DeepSeek Harness: indexed full-text excerpt search, an interactive reading workspace, and offline HTML/CSV reports.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,19 +59,6 @@
|
|
|
59
59
|
"access": "public",
|
|
60
60
|
"registry": "https://registry.npmjs.org/"
|
|
61
61
|
},
|
|
62
|
-
"scripts": {
|
|
63
|
-
"build": "pnpm run build:lib && pnpm run build:client",
|
|
64
|
-
"build:lib": "tsc -p tsconfig.build.json",
|
|
65
|
-
"build:client": "tsdown && tsc -p tsconfig.client-types.json",
|
|
66
|
-
"clean": "rm -rf lib",
|
|
67
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
68
|
-
"pretest": "pnpm run build",
|
|
69
|
-
"test": "vitest run",
|
|
70
|
-
"prepare": "pnpm run build",
|
|
71
|
-
"prepublishOnly": "pnpm run clean && pnpm run typecheck && pnpm run test",
|
|
72
|
-
"postpublish": "node scripts/sync-mirror.mjs",
|
|
73
|
-
"sync-mirror": "node scripts/sync-mirror.mjs"
|
|
74
|
-
},
|
|
75
62
|
"dependencies": {},
|
|
76
63
|
"peerDependencies": {
|
|
77
64
|
"@deepseek-ai/cordis": ">=4.0.1",
|
|
@@ -112,5 +99,15 @@
|
|
|
112
99
|
"vitest": "^4.1.8"
|
|
113
100
|
},
|
|
114
101
|
"icon": "./assets/icon.svg",
|
|
115
|
-
"homepage": "https://www.npmjs.com/package/dsh-fulltext"
|
|
116
|
-
|
|
102
|
+
"homepage": "https://www.npmjs.com/package/dsh-fulltext",
|
|
103
|
+
"scripts": {
|
|
104
|
+
"build": "pnpm run build:lib && pnpm run build:client",
|
|
105
|
+
"build:lib": "tsc -p tsconfig.build.json",
|
|
106
|
+
"build:client": "tsdown && tsc -p tsconfig.client-types.json",
|
|
107
|
+
"clean": "rm -rf lib",
|
|
108
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
109
|
+
"pretest": "pnpm run build",
|
|
110
|
+
"test": "vitest run",
|
|
111
|
+
"sync-mirror": "node scripts/sync-mirror.mjs"
|
|
112
|
+
}
|
|
113
|
+
}
|