@researai/deepscientist 1.5.9 → 1.5.12

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.
Files changed (165) hide show
  1. package/README.md +112 -99
  2. package/assets/branding/connector-qq.png +0 -0
  3. package/assets/branding/connector-rokid.png +0 -0
  4. package/assets/branding/connector-weixin.png +0 -0
  5. package/assets/branding/projects.png +0 -0
  6. package/bin/ds.js +519 -63
  7. package/docs/assets/branding/projects.png +0 -0
  8. package/docs/en/00_QUICK_START.md +338 -68
  9. package/docs/en/01_SETTINGS_REFERENCE.md +14 -0
  10. package/docs/en/02_START_RESEARCH_GUIDE.md +180 -4
  11. package/docs/en/04_LINGZHU_CONNECTOR_GUIDE.md +62 -179
  12. package/docs/en/09_DOCTOR.md +66 -5
  13. package/docs/en/10_WEIXIN_CONNECTOR_GUIDE.md +137 -0
  14. package/docs/en/11_LICENSE_AND_RISK.md +256 -0
  15. package/docs/en/12_GUIDED_WORKFLOW_TOUR.md +446 -0
  16. package/docs/en/13_CORE_ARCHITECTURE_GUIDE.md +297 -0
  17. package/docs/en/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +506 -0
  18. package/docs/en/15_CODEX_PROVIDER_SETUP.md +284 -0
  19. package/docs/en/99_ACKNOWLEDGEMENTS.md +4 -1
  20. package/docs/en/README.md +83 -0
  21. package/docs/images/lingzhu/rokid-agent-platform-create.png +0 -0
  22. package/docs/images/weixin/weixin-plugin-entry.png +0 -0
  23. package/docs/images/weixin/weixin-plugin-entry.svg +33 -0
  24. package/docs/images/weixin/weixin-qr-confirm.svg +30 -0
  25. package/docs/images/weixin/weixin-quest-media-flow.svg +44 -0
  26. package/docs/images/weixin/weixin-settings-bind.svg +57 -0
  27. package/docs/zh/00_QUICK_START.md +345 -72
  28. package/docs/zh/01_SETTINGS_REFERENCE.md +14 -0
  29. package/docs/zh/02_START_RESEARCH_GUIDE.md +181 -3
  30. package/docs/zh/04_LINGZHU_CONNECTOR_GUIDE.md +62 -193
  31. package/docs/zh/09_DOCTOR.md +68 -5
  32. package/docs/zh/10_WEIXIN_CONNECTOR_GUIDE.md +144 -0
  33. package/docs/zh/11_LICENSE_AND_RISK.md +256 -0
  34. package/docs/zh/12_GUIDED_WORKFLOW_TOUR.md +442 -0
  35. package/docs/zh/13_CORE_ARCHITECTURE_GUIDE.md +296 -0
  36. package/docs/zh/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +506 -0
  37. package/docs/zh/15_CODEX_PROVIDER_SETUP.md +285 -0
  38. package/docs/zh/99_ACKNOWLEDGEMENTS.md +4 -1
  39. package/docs/zh/README.md +129 -0
  40. package/install.sh +0 -34
  41. package/package.json +2 -2
  42. package/pyproject.toml +1 -1
  43. package/src/deepscientist/__init__.py +1 -1
  44. package/src/deepscientist/annotations.py +343 -0
  45. package/src/deepscientist/artifact/arxiv.py +484 -37
  46. package/src/deepscientist/artifact/service.py +574 -108
  47. package/src/deepscientist/arxiv_library.py +275 -0
  48. package/src/deepscientist/bash_exec/monitor.py +7 -5
  49. package/src/deepscientist/bash_exec/service.py +93 -21
  50. package/src/deepscientist/bridges/builtins.py +2 -0
  51. package/src/deepscientist/bridges/connectors.py +447 -0
  52. package/src/deepscientist/channels/__init__.py +2 -0
  53. package/src/deepscientist/channels/builtins.py +3 -1
  54. package/src/deepscientist/channels/local.py +3 -3
  55. package/src/deepscientist/channels/qq.py +8 -8
  56. package/src/deepscientist/channels/qq_gateway.py +1 -1
  57. package/src/deepscientist/channels/relay.py +14 -8
  58. package/src/deepscientist/channels/weixin.py +59 -0
  59. package/src/deepscientist/channels/weixin_ilink.py +388 -0
  60. package/src/deepscientist/config/models.py +23 -2
  61. package/src/deepscientist/config/service.py +539 -67
  62. package/src/deepscientist/connector/__init__.py +4 -0
  63. package/src/deepscientist/connector/connector_profiles.py +481 -0
  64. package/src/deepscientist/connector/lingzhu_support.py +668 -0
  65. package/src/deepscientist/connector/qq_profiles.py +206 -0
  66. package/src/deepscientist/connector/weixin_support.py +663 -0
  67. package/src/deepscientist/connector_profiles.py +1 -374
  68. package/src/deepscientist/connector_runtime.py +2 -0
  69. package/src/deepscientist/daemon/api/handlers.py +165 -5
  70. package/src/deepscientist/daemon/api/router.py +13 -1
  71. package/src/deepscientist/daemon/app.py +1444 -67
  72. package/src/deepscientist/doctor.py +4 -5
  73. package/src/deepscientist/gitops/diff.py +120 -29
  74. package/src/deepscientist/lingzhu_support.py +1 -182
  75. package/src/deepscientist/mcp/server.py +135 -7
  76. package/src/deepscientist/prompts/builder.py +128 -11
  77. package/src/deepscientist/qq_profiles.py +1 -196
  78. package/src/deepscientist/quest/node_traces.py +23 -0
  79. package/src/deepscientist/quest/service.py +359 -74
  80. package/src/deepscientist/quest/stage_views.py +71 -5
  81. package/src/deepscientist/runners/codex.py +170 -19
  82. package/src/deepscientist/runners/runtime_overrides.py +6 -0
  83. package/src/deepscientist/shared.py +33 -14
  84. package/src/deepscientist/weixin_support.py +1 -0
  85. package/src/prompts/connectors/lingzhu.md +3 -1
  86. package/src/prompts/connectors/qq.md +2 -1
  87. package/src/prompts/connectors/weixin.md +231 -0
  88. package/src/prompts/contracts/shared_interaction.md +4 -1
  89. package/src/prompts/system.md +61 -9
  90. package/src/skills/analysis-campaign/SKILL.md +46 -6
  91. package/src/skills/analysis-campaign/references/campaign-plan-template.md +21 -8
  92. package/src/skills/baseline/SKILL.md +1 -1
  93. package/src/skills/decision/SKILL.md +1 -1
  94. package/src/skills/experiment/SKILL.md +1 -1
  95. package/src/skills/finalize/SKILL.md +1 -1
  96. package/src/skills/idea/SKILL.md +1 -1
  97. package/src/skills/intake-audit/SKILL.md +1 -1
  98. package/src/skills/rebuttal/SKILL.md +74 -1
  99. package/src/skills/rebuttal/references/response-letter-template.md +55 -11
  100. package/src/skills/review/SKILL.md +118 -1
  101. package/src/skills/review/references/experiment-todo-template.md +23 -0
  102. package/src/skills/review/references/review-report-template.md +16 -0
  103. package/src/skills/review/references/revision-log-template.md +4 -0
  104. package/src/skills/scout/SKILL.md +1 -1
  105. package/src/skills/write/SKILL.md +168 -7
  106. package/src/skills/write/references/paper-experiment-matrix-template.md +131 -0
  107. package/src/tui/package.json +1 -1
  108. package/src/ui/dist/assets/{AiManusChatView-BKZ103sn.js → AiManusChatView-CnJcXynW.js} +156 -48
  109. package/src/ui/dist/assets/{AnalysisPlugin-mTTzGAlK.js → AnalysisPlugin-DeyzPEhV.js} +1 -1
  110. package/src/ui/dist/assets/{CliPlugin-BH58n3GY.js → CliPlugin-CB1YODQn.js} +164 -9
  111. package/src/ui/dist/assets/{CodeEditorPlugin-BKGRUH7e.js → CodeEditorPlugin-B-xicq1e.js} +8 -8
  112. package/src/ui/dist/assets/{CodeViewerPlugin-BMADwFWJ.js → CodeViewerPlugin-DT54ysXa.js} +5 -5
  113. package/src/ui/dist/assets/{DocViewerPlugin-ZOnTIHLN.js → DocViewerPlugin-DQtKT-VD.js} +3 -3
  114. package/src/ui/dist/assets/{GitDiffViewerPlugin-CQ7h1Djm.js → GitDiffViewerPlugin-hqHbCfnv.js} +20 -21
  115. package/src/ui/dist/assets/{ImageViewerPlugin-GVS5MsnC.js → ImageViewerPlugin-OcVo33jV.js} +5 -5
  116. package/src/ui/dist/assets/{LabCopilotPanel-BZNv1JML.js → LabCopilotPanel-DdGwhEUV.js} +11 -11
  117. package/src/ui/dist/assets/{LabPlugin-TWcJsdQA.js → LabPlugin-Ciz1gDaX.js} +2 -1
  118. package/src/ui/dist/assets/{LatexPlugin-DIjHiR2x.js → LatexPlugin-BhmjNQRC.js} +37 -11
  119. package/src/ui/dist/assets/{MarkdownViewerPlugin-D3ooGAH0.js → MarkdownViewerPlugin-BzdVH9Bx.js} +4 -4
  120. package/src/ui/dist/assets/{MarketplacePlugin-DfVfE9hN.js → MarketplacePlugin-DmyHspXt.js} +3 -3
  121. package/src/ui/dist/assets/{NotebookEditor-DDl0_Mc0.js → NotebookEditor-BMXKrDRk.js} +1 -1
  122. package/src/ui/dist/assets/{NotebookEditor-s8JhzuX1.js → NotebookEditor-BTVYRGkm.js} +12 -12
  123. package/src/ui/dist/assets/{PdfLoader-C2Sf6SJM.js → PdfLoader-CvcjJHXv.js} +14 -7
  124. package/src/ui/dist/assets/{PdfMarkdownPlugin-CXFLoIsa.js → PdfMarkdownPlugin-DW2ej8Vk.js} +73 -6
  125. package/src/ui/dist/assets/{PdfViewerPlugin-BYTmz2fK.js → PdfViewerPlugin-CmlDxbhU.js} +103 -34
  126. package/src/ui/dist/assets/PdfViewerPlugin-DQ11QcSf.css +3627 -0
  127. package/src/ui/dist/assets/{SearchPlugin-CjWBI1O9.js → SearchPlugin-DAjQZPSv.js} +1 -1
  128. package/src/ui/dist/assets/{TextViewerPlugin-DdOBU3-S.js → TextViewerPlugin-C-nVAZb_.js} +5 -4
  129. package/src/ui/dist/assets/{VNCViewer-B8HGgLwQ.js → VNCViewer-D7-dIYon.js} +10 -10
  130. package/src/ui/dist/assets/bot-C_G4WtNI.js +21 -0
  131. package/src/ui/dist/assets/branding/logo-rokid.png +0 -0
  132. package/src/ui/dist/assets/browser-BAcuE0Xj.js +2895 -0
  133. package/src/ui/dist/assets/{code-BWAY76JP.js → code-Cd7WfiWq.js} +1 -1
  134. package/src/ui/dist/assets/{file-content-C1NwU5oQ.js → file-content-B57zsL9y.js} +1 -1
  135. package/src/ui/dist/assets/{file-diff-panel-CywslwB9.js → file-diff-panel-DVoheLFq.js} +1 -1
  136. package/src/ui/dist/assets/{file-socket-B4kzuOBQ.js → file-socket-B5kXFxZP.js} +1 -1
  137. package/src/ui/dist/assets/{image-D-NZM-6P.js → image-LLOjkMHF.js} +1 -1
  138. package/src/ui/dist/assets/{index-DGIYDuTv.css → index-BQG-1s2o.css} +40 -13
  139. package/src/ui/dist/assets/{index-DHZJ_0TI.js → index-C3r2iGrp.js} +12 -12
  140. package/src/ui/dist/assets/{index-7Chr1g9c.js → index-CLQauncb.js} +15050 -9561
  141. package/src/ui/dist/assets/index-Dxa2eYMY.js +25 -0
  142. package/src/ui/dist/assets/{index-BdM1Gqfr.js → index-hOUOWbW2.js} +2 -2
  143. package/src/ui/dist/assets/{monaco-Cb2uKKe6.js → monaco-BGGAEii3.js} +1 -1
  144. package/src/ui/dist/assets/{pdf-effect-queue-DSw_D3RV.js → pdf-effect-queue-DlEr1_y5.js} +16 -1
  145. package/src/ui/dist/assets/pdf.worker.min-yatZIOMy.mjs +21 -0
  146. package/src/ui/dist/assets/{popover-Bg72DGgT.js → popover-CWJbJuYY.js} +1 -1
  147. package/src/ui/dist/assets/{project-sync-Ce_0BglY.js → project-sync-CRJiucYO.js} +18 -77
  148. package/src/ui/dist/assets/select-CoHB7pvH.js +1690 -0
  149. package/src/ui/dist/assets/{sigma-DPaACDrh.js → sigma-D5aJWR8J.js} +1 -1
  150. package/src/ui/dist/assets/{index-CDxNdQdz.js → square-check-big-DUK_mnkS.js} +2 -13
  151. package/src/ui/dist/assets/{trash-BvTgE5__.js → trash-ChU3SEE3.js} +1 -1
  152. package/src/ui/dist/assets/{useCliAccess-CgPeMOwP.js → useCliAccess-BrJBV3tY.js} +1 -1
  153. package/src/ui/dist/assets/{useFileDiffOverlay-xPhz7P5B.js → useFileDiffOverlay-C2OQaVWc.js} +1 -1
  154. package/src/ui/dist/assets/{wrap-text-C3Un3YQr.js → wrap-text-C7Qqh-om.js} +1 -1
  155. package/src/ui/dist/assets/{zoom-out-BgxLa0Ri.js → zoom-out-rtX0FKya.js} +1 -1
  156. package/src/ui/dist/index.html +2 -2
  157. package/src/ui/dist/assets/AutoFigurePlugin-BGxN8Umr.css +0 -3056
  158. package/src/ui/dist/assets/AutoFigurePlugin-C_wWw4AP.js +0 -8149
  159. package/src/ui/dist/assets/PdfViewerPlugin-BJXtIwj_.css +0 -260
  160. package/src/ui/dist/assets/Stepper-B0Dd8CxK.js +0 -158
  161. package/src/ui/dist/assets/bibtex-CKaefIN2.js +0 -189
  162. package/src/ui/dist/assets/file-utils-H2fjA46S.js +0 -109
  163. package/src/ui/dist/assets/message-square-BzjLiXir.js +0 -16
  164. package/src/ui/dist/assets/pdfjs-DU1YE8WO.js +0 -3
  165. package/src/ui/dist/assets/tooltip-C_mA6R0w.js +0 -108
@@ -1,12 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-7Chr1g9c.js","assets/index-DGIYDuTv.css"])))=>i.map(i=>d[i]);
2
- import { z as createLucideIcon, r as reactExports, u as useI18n, j as jsxRuntimeExports, Y as Download, b as cn, k as FileText, l as Search, X, m as ChevronUp, n as ChevronDown, I as create, s as apiClient, aQ as useQueryClient, aL as useQuery, bQ as useMutation, bR as Card, a3 as Button, bS as DropdownMenu, bT as DropdownMenuTrigger, bU as DropdownMenuContent, bV as DropdownMenuLabel, bW as DropdownMenuItem, bX as SegmentedControl, bt as CircleHelp, bY as Textarea, i as isCliFileId, o as useTabsStore, f as useFileTreeStore, a as useWorkspaceSurfaceStore, p as useToast, q as useArxivStore, x as useAuthStore, c as copyToClipboard, N as toFilesResourcePath, t as BUILTIN_PLUGINS, bZ as getFile, b_ as listProjectMembers, _ as __vitePreload, D as Sparkles, T as TriangleAlert, b$ as DropdownMenuRadioGroup, c0 as DropdownMenuRadioItem, c1 as MarkdownPreview } from './index-7Chr1g9c.js';
3
- import { a as acquireFileSocket } from './file-socket-B4kzuOBQ.js';
4
- import { i as isPdfEffectHandled, m as markPdfEffectHandled, c as consumePdfEffects } from './pdf-effect-queue-DSw_D3RV.js';
5
- import { I as InfoTriangleIcon, g as generateBibTeX, A as ArxivInfoModal } from './bibtex-CKaefIN2.js';
6
- import { Z as ZOOM_LEVELS, R as Rnd, g as getPageFromElement, a as PdfLoader, b as PDF_CMAP_URL, c as PDF_WORKER_SRC, d as PdfHighlighter } from './PdfLoader-C2Sf6SJM.js';
7
- import { M as MessageSquare } from './message-square-BzjLiXir.js';
8
- import { Z as ZoomOut, a as ZoomIn } from './zoom-out-BgxLa0Ri.js';
9
- import { S as SquareCheckBig } from './index-CDxNdQdz.js';
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CLQauncb.js","assets/index-BQG-1s2o.css"])))=>i.map(i=>d[i]);
2
+ import { w as createLucideIcon, r as reactExports, u as useI18n, j as jsxRuntimeExports, a3 as Download, I as InfoTriangleIcon, b as cn, k as FileText, l as Search, X, m as ChevronDown, Q as create, t as apiClient, aT as useQueryClient, aN as useQuery, bR as useMutation, bS as Card, aO as Button, bT as DropdownMenu, bU as DropdownMenuTrigger, bV as DropdownMenuContent, bW as DropdownMenuLabel, bX as DropdownMenuItem, bY as SegmentedControl, br as CircleHelp, bZ as Textarea, i as isCliFileId, b_ as isQuestNodeId, b$ as getQuestNodeProjectId, n as useTabsStore, f as useFileTreeStore, a as useWorkspaceSurfaceStore, o as useToast, p as useArxivStore, z as useAuthStore, s as generateBibTeX, c as copyToClipboard, W as toFilesResourcePath, v as BUILTIN_PLUGINS, c0 as getFile, c1 as listProjectMembers, _ as __vitePreload, A as ArxivInfoModal, c2 as createFileObjectUrl, N as Sparkles, T as TriangleAlert, c3 as DropdownMenuRadioGroup, c4 as DropdownMenuRadioItem, c5 as MarkdownPreview } from './index-CLQauncb.js';
3
+ import { a as acquireFileSocket } from './file-socket-B5kXFxZP.js';
4
+ import { M as MessageSquare, i as isPdfEffectHandled, m as markPdfEffectHandled, c as consumePdfEffects } from './pdf-effect-queue-DlEr1_y5.js';
5
+ import { Z as ZOOM_LEVELS, R as Rnd, g as getPageFromElement, a as PdfLoader, e as PDF_CMAP_PACKED, b as PDF_CMAP_URL, c as PDF_WORKER_SRC, d as PdfHighlighter } from './PdfLoader-CvcjJHXv.js';
6
+ import { Z as ZoomOut, a as ZoomIn } from './zoom-out-rtX0FKya.js';
7
+ import { C as ChevronUp } from './index-Dxa2eYMY.js';
8
+ import { S as SquareCheckBig } from './square-check-big-DUK_mnkS.js';
10
9
 
11
10
  /**
12
11
  * @license lucide-react v0.511.0 - ISC
@@ -250,6 +249,8 @@ const Toolbar = reactExports.memo(function Toolbar2({
250
249
  infoDisabled = false,
251
250
  markdownActive,
252
251
  onMarkdownToggle,
252
+ markdownLabel,
253
+ markdownTitle,
253
254
  reviewOpinionActive,
254
255
  onReviewOpinionToggle,
255
256
  reviewOpinionLabel,
@@ -258,6 +259,8 @@ const Toolbar = reactExports.memo(function Toolbar2({
258
259
  const { t } = useI18n("pdf_viewer");
259
260
  const isMarkdownActive = Boolean(markdownActive);
260
261
  const canToggleMarkdown = typeof onMarkdownToggle === "function";
262
+ const markdownButtonLabel = markdownLabel?.trim() || t("markdown");
263
+ const markdownButtonTitle = markdownTitle?.trim() || t("open_markdown");
261
264
  const isReviewOpinionActive = Boolean(reviewOpinionActive);
262
265
  const canToggleReviewOpinion = typeof onReviewOpinionToggle === "function";
263
266
  const reviewOpinionButtonLabel = reviewOpinionLabel?.trim() || t("review_opinion");
@@ -328,10 +331,10 @@ const Toolbar = reactExports.memo(function Toolbar2({
328
331
  "bg-background hover:bg-muted/60 border-border",
329
332
  isMarkdownActive && "bg-primary/10 text-primary border-primary/20"
330
333
  ),
331
- title: t("open_markdown"),
334
+ title: markdownButtonTitle,
332
335
  children: [
333
336
  /* @__PURE__ */ jsxRuntimeExports.jsx(FileText, { className: "w-4 h-4" }),
334
- t("markdown")
337
+ markdownButtonLabel
335
338
  ]
336
339
  }
337
340
  ) : null,
@@ -2170,15 +2173,27 @@ function PdfViewerPlugin({
2170
2173
  const externalPdfUrl = typeof context.customData?.externalPdfUrl === "string" ? context.customData.externalPdfUrl.trim() : "";
2171
2174
  const hasExternalPdfUrl = externalPdfUrl.length > 0;
2172
2175
  const apiBaseUrl = (apiClient.defaults.baseURL || "").replace(/\/$/, "");
2176
+ const isQuestFile = isQuestNodeId(fileId);
2177
+ const questProjectIdFromFileId = reactExports.useMemo(
2178
+ () => fileId && isQuestFile ? getQuestNodeProjectId(fileId) : null,
2179
+ [fileId, isQuestFile]
2180
+ );
2181
+ const projectIdFromContext = reactExports.useMemo(() => {
2182
+ const candidate = typeof context.customData?.projectId === "string" ? context.customData.projectId.trim() : "";
2183
+ return candidate || null;
2184
+ }, [context.customData]);
2173
2185
  const [cliPdfUrl, setCliPdfUrl] = reactExports.useState(null);
2174
2186
  const [cliPdfLoading, setCliPdfLoading] = reactExports.useState(false);
2175
2187
  const [cliPdfError, setCliPdfError] = reactExports.useState(null);
2176
- const pdfUrl = hasExternalPdfUrl ? externalPdfUrl : isCliFile ? cliPdfUrl || "" : fileId ? `${apiBaseUrl}/api/v1/files/${fileId}/content` : (
2188
+ const [questPdfUrl, setQuestPdfUrl] = reactExports.useState(null);
2189
+ const [questPdfLoading, setQuestPdfLoading] = reactExports.useState(false);
2190
+ const [questPdfError, setQuestPdfError] = reactExports.useState(null);
2191
+ const pdfUrl = hasExternalPdfUrl ? externalPdfUrl : isCliFile ? cliPdfUrl || "" : isQuestFile ? questPdfUrl || "" : fileId ? `${apiBaseUrl}/api/v1/files/${fileId}/content` : (
2177
2192
  // Demo: Use a sample PDF for testing
2178
2193
  "https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf"
2179
2194
  );
2180
2195
  const token = typeof window !== "undefined" ? localStorage.getItem("ds_access_token") : null;
2181
- const httpHeaders = token && (hasExternalPdfUrl || !isCliFile && fileId) ? { Authorization: `Bearer ${token}` } : void 0;
2196
+ const httpHeaders = token && (hasExternalPdfUrl || !isCliFile && !isQuestFile && fileId) ? { Authorization: `Bearer ${token}` } : void 0;
2182
2197
  const {
2183
2198
  scale,
2184
2199
  setScale,
@@ -2208,7 +2223,12 @@ function PdfViewerPlugin({
2208
2223
  const { addToast } = useToast();
2209
2224
  const arxivItems = useArxivStore((s) => s.items);
2210
2225
  const arxivErrors = useArxivStore((s) => s.errors);
2211
- const annotationsFileId = isCliFile || !fileId ? "" : fileId;
2226
+ const arxivFromContext = reactExports.useMemo(() => {
2227
+ const customData = context.customData;
2228
+ return customData?.arxiv ?? null;
2229
+ }, [context.customData]);
2230
+ const isArxivPdf = Boolean(arxivFromContext) || Boolean(fileId && arxivItems.some((item) => item.fileId === fileId));
2231
+ const annotationsFileId = isCliFile || !fileId || isReadOnlyMode ? "" : fileId;
2212
2232
  const { annotations, createAnnotation, updateAnnotation, deleteAnnotation } = useAnnotations(annotationsFileId);
2213
2233
  const currentUser = useAuthStore((s) => s.user);
2214
2234
  const [projectId, setProjectId] = reactExports.useState(null);
@@ -2274,16 +2294,17 @@ function PdfViewerPlugin({
2274
2294
  },
2275
2295
  [clampReviewSidebarWidth, isResizableAnnotationWorkspace]
2276
2296
  );
2277
- const arxivFromContext = reactExports.useMemo(() => {
2278
- const customData = context.customData;
2279
- return customData?.arxiv ?? null;
2280
- }, [context.customData]);
2281
2297
  const arxivPaper = reactExports.useMemo(() => {
2282
2298
  if (arxivFromContext) return arxivFromContext;
2283
2299
  if (!fileId) return null;
2284
2300
  return arxivItems.find((item) => item.fileId === fileId) || null;
2285
2301
  }, [arxivFromContext, arxivItems, fileId]);
2286
2302
  const arxivError = arxivPaper ? arxivErrors[arxivPaper.arxivId] : void 0;
2303
+ const supportsMarkdownView = Boolean(
2304
+ fileId && !isCliFile && (!isArxivPdf || arxivPaper?.overview?.trim() || arxivPaper?.abstract?.trim())
2305
+ );
2306
+ const markdownButtonLabel = isArxivPdf ? t("summary") : t("markdown");
2307
+ const markdownButtonTitle = isArxivPdf ? t("open_summary") : t("open_markdown");
2287
2308
  reactExports.useEffect(() => {
2288
2309
  sidebarVisibleRef.current = sidebarVisible;
2289
2310
  }, [sidebarVisible]);
@@ -2316,7 +2337,7 @@ function PdfViewerPlugin({
2316
2337
  return void 0;
2317
2338
  }, [context.resourcePath, fileId, findNode]);
2318
2339
  const loadPdfMarkdown = reactExports.useCallback(async () => {
2319
- if (!fileId || isCliFile) return null;
2340
+ if (!fileId || isCliFile || isArxivPdf) return null;
2320
2341
  const cached = markdownCacheRef.current[fileId];
2321
2342
  if (cached) return cached;
2322
2343
  const inflight = markdownLoadPromiseRef.current[fileId];
@@ -2336,10 +2357,10 @@ function PdfViewerPlugin({
2336
2357
  });
2337
2358
  markdownLoadPromiseRef.current[fileId] = request;
2338
2359
  return request;
2339
- }, [fileId, isCliFile]);
2360
+ }, [fileId, isArxivPdf, isCliFile]);
2340
2361
  const enrichReferenceWithMarkdown = reactExports.useCallback(
2341
2362
  async (referenceId, selectedText) => {
2342
- if (!fileId || isCliFile) return;
2363
+ if (!fileId || isCliFile || isArxivPdf) return;
2343
2364
  try {
2344
2365
  const markdown = await loadPdfMarkdown();
2345
2366
  const excerpt = locateMarkdownExcerpt(markdown || "", selectedText);
@@ -2353,12 +2374,12 @@ function PdfViewerPlugin({
2353
2374
  });
2354
2375
  }
2355
2376
  },
2356
- [fileId, isCliFile, loadPdfMarkdown, updateWorkspaceReference]
2377
+ [fileId, isArxivPdf, isCliFile, loadPdfMarkdown, updateWorkspaceReference]
2357
2378
  );
2358
2379
  reactExports.useEffect(() => {
2359
- if (!fileId || isCliFile) return;
2380
+ if (!fileId || isCliFile || isArxivPdf) return;
2360
2381
  void loadPdfMarkdown().catch(() => void 0);
2361
- }, [fileId, isCliFile, loadPdfMarkdown]);
2382
+ }, [fileId, isArxivPdf, isCliFile, loadPdfMarkdown]);
2362
2383
  const handleAskCopilotFromSelection = reactExports.useCallback(
2363
2384
  (content, position) => {
2364
2385
  const selectedText = String(content?.text || "").trim();
@@ -2384,7 +2405,7 @@ function PdfViewerPlugin({
2384
2405
  pageNumber: position.pageNumber,
2385
2406
  selectedText,
2386
2407
  markdownExcerpt: void 0,
2387
- excerptStatus: fileId && !isCliFile ? "loading" : "idle",
2408
+ excerptStatus: fileId && !isCliFile && !isArxivPdf ? "loading" : "idle",
2388
2409
  rects: position.rects?.map((rect) => ({
2389
2410
  left: rect.x1,
2390
2411
  top: rect.y1,
@@ -2395,7 +2416,7 @@ function PdfViewerPlugin({
2395
2416
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
2396
2417
  });
2397
2418
  window.dispatchEvent(new CustomEvent("ds:copilot:focus", { detail: { focus: true } }));
2398
- if (fileId && !isCliFile) {
2419
+ if (fileId && !isCliFile && !isArxivPdf) {
2399
2420
  void enrichReferenceWithMarkdown(referenceId, selectedText);
2400
2421
  }
2401
2422
  },
@@ -2404,6 +2425,7 @@ function PdfViewerPlugin({
2404
2425
  enrichReferenceWithMarkdown,
2405
2426
  fileId,
2406
2427
  fileName,
2428
+ isArxivPdf,
2407
2429
  isCliFile,
2408
2430
  resolveWorkspaceResourcePath,
2409
2431
  tabId
@@ -2437,12 +2459,17 @@ function PdfViewerPlugin({
2437
2459
  });
2438
2460
  }, [currentPage, isReadOnlyMode, tabId, updateWorkspaceTabState]);
2439
2461
  reactExports.useEffect(() => {
2462
+ const resolvedProjectId = projectIdFromContext || questProjectIdFromFileId;
2463
+ if (resolvedProjectId) {
2464
+ setProjectId(resolvedProjectId);
2465
+ return;
2466
+ }
2440
2467
  if (!fileId || isCliFile) return;
2441
2468
  getFile(fileId).then((f) => {
2442
2469
  if (f?.project_id) setProjectId(String(f.project_id));
2443
2470
  }).catch(() => {
2444
2471
  });
2445
- }, [fileId, hasExternalPdfUrl, isCliFile]);
2472
+ }, [fileId, hasExternalPdfUrl, isCliFile, projectIdFromContext, questProjectIdFromFileId]);
2446
2473
  reactExports.useEffect(() => {
2447
2474
  if (!fileId || !isCliFile) {
2448
2475
  setCliPdfUrl(null);
@@ -2456,8 +2483,8 @@ function PdfViewerPlugin({
2456
2483
  setCliPdfError(null);
2457
2484
  const loadCliPdf = async () => {
2458
2485
  try {
2459
- const { createFileObjectUrl } = await __vitePreload(async () => { const { createFileObjectUrl } = await import('./index-7Chr1g9c.js').then(n => n.el);return { createFileObjectUrl }},true?__vite__mapDeps([0,1]):void 0);
2460
- objectUrl = await createFileObjectUrl(fileId);
2486
+ const { createFileObjectUrl: createFileObjectUrl2 } = await __vitePreload(async () => { const { createFileObjectUrl: createFileObjectUrl2 } = await import('./index-CLQauncb.js').then(n => n.el);return { createFileObjectUrl: createFileObjectUrl2 }},true?__vite__mapDeps([0,1]):void 0);
2487
+ objectUrl = await createFileObjectUrl2(fileId);
2461
2488
  if (cancelled) {
2462
2489
  URL.revokeObjectURL(objectUrl);
2463
2490
  return;
@@ -2481,6 +2508,43 @@ function PdfViewerPlugin({
2481
2508
  }
2482
2509
  };
2483
2510
  }, [fileId, isCliFile]);
2511
+ reactExports.useEffect(() => {
2512
+ if (!fileId || !isQuestFile || isCliFile) {
2513
+ setQuestPdfUrl(null);
2514
+ setQuestPdfLoading(false);
2515
+ setQuestPdfError(null);
2516
+ return;
2517
+ }
2518
+ let cancelled = false;
2519
+ let objectUrl = null;
2520
+ setQuestPdfLoading(true);
2521
+ setQuestPdfError(null);
2522
+ const loadQuestPdf = async () => {
2523
+ try {
2524
+ objectUrl = await createFileObjectUrl(fileId);
2525
+ if (cancelled) {
2526
+ URL.revokeObjectURL(objectUrl);
2527
+ return;
2528
+ }
2529
+ setQuestPdfUrl(objectUrl);
2530
+ } catch (err) {
2531
+ if (!cancelled) {
2532
+ setQuestPdfError("Failed to load PDF document.");
2533
+ }
2534
+ } finally {
2535
+ if (!cancelled) {
2536
+ setQuestPdfLoading(false);
2537
+ }
2538
+ }
2539
+ };
2540
+ void loadQuestPdf();
2541
+ return () => {
2542
+ cancelled = true;
2543
+ if (objectUrl) {
2544
+ URL.revokeObjectURL(objectUrl);
2545
+ }
2546
+ };
2547
+ }, [fileId, isCliFile, isQuestFile]);
2484
2548
  reactExports.useEffect(() => {
2485
2549
  if (!projectId) return;
2486
2550
  const userId = currentUser?.id;
@@ -2877,7 +2941,7 @@ function PdfViewerPlugin({
2877
2941
  return;
2878
2942
  }
2879
2943
  (async () => {
2880
- const { downloadFileById } = await __vitePreload(async () => { const { downloadFileById } = await import('./index-7Chr1g9c.js').then(n => n.el);return { downloadFileById }},true?__vite__mapDeps([0,1]):void 0);
2944
+ const { downloadFileById } = await __vitePreload(async () => { const { downloadFileById } = await import('./index-CLQauncb.js').then(n => n.el);return { downloadFileById }},true?__vite__mapDeps([0,1]):void 0);
2881
2945
  await downloadFileById(fileId, fileName);
2882
2946
  })();
2883
2947
  }, [fileId, fileName, pdfUrl]);
@@ -2891,16 +2955,19 @@ function PdfViewerPlugin({
2891
2955
  ...context,
2892
2956
  customData: {
2893
2957
  ...context.customData || {},
2894
- pdfView: "markdown"
2958
+ pdfView: isArxivPdf ? "summary" : "markdown"
2895
2959
  }
2896
2960
  });
2897
- }, [context, fileId, isCliFile, openMarkdownViewFromHost, tabId, updateTabPlugin]);
2961
+ }, [context, fileId, isArxivPdf, isCliFile, openMarkdownViewFromHost, tabId, updateTabPlugin]);
2898
2962
  if (shouldRedirectToNotebook) {
2899
2963
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center bg-muted/20", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-muted-foreground", children: "Switching to Markdown editor..." }) });
2900
2964
  }
2901
2965
  if (isCliFile && (cliPdfLoading || cliPdfError) && !cliPdfUrl) {
2902
2966
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full flex items-center justify-center bg-background", children: cliPdfError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-muted-foreground", children: cliPdfError }) : /* @__PURE__ */ jsxRuntimeExports.jsx(PdfSpinner, {}) });
2903
2967
  }
2968
+ if (isQuestFile && (questPdfLoading || questPdfError) && !questPdfUrl) {
2969
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full flex items-center justify-center bg-background", children: questPdfError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-muted-foreground", children: questPdfError }) : /* @__PURE__ */ jsxRuntimeExports.jsx(PdfSpinner, {}) });
2970
+ }
2904
2971
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col bg-background", children: [
2905
2972
  /* @__PURE__ */ jsxRuntimeExports.jsx(
2906
2973
  Toolbar,
@@ -2914,7 +2981,9 @@ function PdfViewerPlugin({
2914
2981
  onSidebarToggle: toggleSidebar,
2915
2982
  onDownload: handleDownload,
2916
2983
  onInfo: arxivPaper ? () => setInfoOpen(true) : void 0,
2917
- onMarkdownToggle: openMarkdownViewFromHost || fileId && !isCliFile ? handleOpenMarkdown : void 0,
2984
+ onMarkdownToggle: openMarkdownViewFromHost || supportsMarkdownView ? handleOpenMarkdown : void 0,
2985
+ markdownLabel: markdownButtonLabel,
2986
+ markdownTitle: markdownButtonTitle,
2918
2987
  reviewOpinionActive: reviewOpinionActiveFromHost,
2919
2988
  onReviewOpinionToggle: reviewOpinionAvailableFromHost && openReviewOpinionViewFromHost ? openReviewOpinionViewFromHost : void 0,
2920
2989
  reviewOpinionLabel: reviewOpinionLabelFromHost,
@@ -2934,7 +3003,7 @@ function PdfViewerPlugin({
2934
3003
  httpHeaders,
2935
3004
  workerSrc: PDF_WORKER_SRC,
2936
3005
  cMapUrl: PDF_CMAP_URL,
2937
- cMapPacked: true,
3006
+ cMapPacked: PDF_CMAP_PACKED,
2938
3007
  beforeLoad: /* @__PURE__ */ jsxRuntimeExports.jsx(PdfSpinner, {}),
2939
3008
  children: (pdfDocument) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2940
3009
  PdfHighlighterSurface,