@researai/deepscientist 1.5.15 → 1.5.16

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 (193) hide show
  1. package/README.md +336 -98
  2. package/bin/ds.js +691 -91
  3. package/docs/en/00_QUICK_START.md +36 -15
  4. package/docs/en/01_SETTINGS_REFERENCE.md +33 -0
  5. package/docs/en/02_START_RESEARCH_GUIDE.md +7 -0
  6. package/docs/en/05_TUI_GUIDE.md +6 -0
  7. package/docs/en/06_RUNTIME_AND_CANVAS.md +4 -3
  8. package/docs/en/09_DOCTOR.md +11 -5
  9. package/docs/en/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +63 -13
  10. package/docs/en/15_CODEX_PROVIDER_SETUP.md +25 -8
  11. package/docs/en/19_EXTERNAL_CONTROLLER_GUIDE.md +226 -0
  12. package/docs/en/19_LOCAL_BROWSER_AUTH.md +70 -0
  13. package/docs/en/20_WORKSPACE_MODES_GUIDE.md +250 -0
  14. package/docs/en/README.md +18 -0
  15. package/docs/zh/00_QUICK_START.md +36 -15
  16. package/docs/zh/01_SETTINGS_REFERENCE.md +33 -0
  17. package/docs/zh/02_START_RESEARCH_GUIDE.md +7 -0
  18. package/docs/zh/05_TUI_GUIDE.md +6 -0
  19. package/docs/zh/09_DOCTOR.md +11 -5
  20. package/docs/zh/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +63 -13
  21. package/docs/zh/15_CODEX_PROVIDER_SETUP.md +25 -8
  22. package/docs/zh/19_EXTERNAL_CONTROLLER_GUIDE.md +226 -0
  23. package/docs/zh/19_LOCAL_BROWSER_AUTH.md +68 -0
  24. package/docs/zh/20_WORKSPACE_MODES_GUIDE.md +251 -0
  25. package/docs/zh/README.md +18 -0
  26. package/package.json +1 -1
  27. package/pyproject.toml +1 -1
  28. package/src/deepscientist/__init__.py +1 -1
  29. package/src/deepscientist/acp/envelope.py +6 -0
  30. package/src/deepscientist/artifact/service.py +647 -22
  31. package/src/deepscientist/bash_exec/service.py +234 -9
  32. package/src/deepscientist/cli.py +115 -19
  33. package/src/deepscientist/codex_cli_compat.py +232 -0
  34. package/src/deepscientist/config/models.py +2 -1
  35. package/src/deepscientist/config/service.py +31 -9
  36. package/src/deepscientist/daemon/api/handlers.py +125 -6
  37. package/src/deepscientist/daemon/api/router.py +4 -0
  38. package/src/deepscientist/daemon/app.py +715 -98
  39. package/src/deepscientist/gitops/__init__.py +10 -1
  40. package/src/deepscientist/gitops/diff.py +129 -0
  41. package/src/deepscientist/gitops/service.py +4 -1
  42. package/src/deepscientist/mcp/server.py +39 -0
  43. package/src/deepscientist/prompts/builder.py +255 -32
  44. package/src/deepscientist/quest/layout.py +15 -2
  45. package/src/deepscientist/quest/service.py +295 -43
  46. package/src/deepscientist/quest/stage_views.py +6 -1
  47. package/src/deepscientist/runners/codex.py +86 -31
  48. package/src/deepscientist/skills/__init__.py +2 -2
  49. package/src/deepscientist/skills/installer.py +196 -5
  50. package/src/deepscientist/skills/registry.py +66 -0
  51. package/src/prompts/connectors/qq.md +18 -8
  52. package/src/prompts/connectors/weixin.md +16 -6
  53. package/src/prompts/contracts/shared_interaction.md +12 -1
  54. package/src/prompts/system.md +10 -5
  55. package/src/prompts/system_copilot.md +43 -0
  56. package/src/skills/analysis-campaign/SKILL.md +1 -0
  57. package/src/skills/baseline/SKILL.md +8 -0
  58. package/src/skills/decision/SKILL.md +8 -0
  59. package/src/skills/experiment/SKILL.md +8 -0
  60. package/src/skills/figure-polish/SKILL.md +1 -0
  61. package/src/skills/finalize/SKILL.md +1 -0
  62. package/src/skills/idea/SKILL.md +1 -0
  63. package/src/skills/intake-audit/SKILL.md +8 -0
  64. package/src/skills/mentor/SKILL.md +217 -0
  65. package/src/skills/mentor/references/correction-rules.md +210 -0
  66. package/src/skills/mentor/references/knowledge-profile.md +91 -0
  67. package/src/skills/mentor/references/persona-profile.md +138 -0
  68. package/src/skills/mentor/references/taste-profile.md +128 -0
  69. package/src/skills/mentor/references/thought-style-profile.md +138 -0
  70. package/src/skills/mentor/references/work-profile.md +289 -0
  71. package/src/skills/mentor/references/workflow-profile.md +240 -0
  72. package/src/skills/optimize/SKILL.md +1 -0
  73. package/src/skills/rebuttal/SKILL.md +1 -0
  74. package/src/skills/review/SKILL.md +1 -0
  75. package/src/skills/scout/SKILL.md +8 -0
  76. package/src/skills/write/SKILL.md +1 -0
  77. package/src/tui/dist/app/AppContainer.js +19 -11
  78. package/src/tui/dist/index.js +4 -1
  79. package/src/tui/dist/lib/api.js +33 -3
  80. package/src/tui/package.json +1 -1
  81. package/src/ui/dist/assets/AiManusChatView-COFACy7V.js +204 -0
  82. package/src/ui/dist/assets/AnalysisPlugin-DnSm0GZn.js +1 -0
  83. package/src/ui/dist/assets/CliPlugin-CvwCmDQ5.js +109 -0
  84. package/src/ui/dist/assets/CodeEditorPlugin-cOqSa0xq.js +2 -0
  85. package/src/ui/dist/assets/CodeViewerPlugin-itb0tltR.js +270 -0
  86. package/src/ui/dist/assets/DocViewerPlugin-DqKkiCI6.js +7 -0
  87. package/src/ui/dist/assets/GitCommitViewerPlugin-DVgNHBCS.js +1 -0
  88. package/src/ui/dist/assets/GitDiffViewerPlugin-DxL2ezFG.js +6 -0
  89. package/src/ui/dist/assets/GitSnapshotViewer-B_RQm1YZ.js +30 -0
  90. package/src/ui/dist/assets/ImageViewerPlugin-tHqlXY3n.js +26 -0
  91. package/src/ui/dist/assets/LabCopilotPanel-ClMbq5Yu.js +14 -0
  92. package/src/ui/dist/assets/LabPlugin-L_SuE8ow.js +22 -0
  93. package/src/ui/dist/assets/LatexPlugin-B495DTXC.js +25 -0
  94. package/src/ui/dist/assets/MarkdownViewerPlugin-DG28-61B.js +128 -0
  95. package/src/ui/dist/assets/MarketplacePlugin-BiOGT-Kj.js +13 -0
  96. package/src/ui/dist/assets/{NotebookEditor-CccQYZjX.css → NotebookEditor-BHH8rdGj.css} +1 -1
  97. package/src/ui/dist/assets/NotebookEditor-BOr3x3Ej.css +1 -0
  98. package/src/ui/dist/assets/NotebookEditor-C-4Kt1p9.js +81 -0
  99. package/src/ui/dist/assets/NotebookEditor-CVsj8h_T.js +361 -0
  100. package/src/ui/dist/assets/PdfLoader-CASDQmxJ.js +16 -0
  101. package/src/ui/dist/assets/PdfLoader-Cy5jtWrr.css +1 -0
  102. package/src/ui/dist/assets/PdfMarkdownPlugin-BFhwoKsY.js +1 -0
  103. package/src/ui/dist/assets/PdfViewerPlugin-DcOzU9vd.js +17 -0
  104. package/src/ui/dist/assets/PdfViewerPlugin-nwwE-fjJ.css +1 -0
  105. package/src/ui/dist/assets/SearchPlugin-CHj7M58O.js +16 -0
  106. package/src/ui/dist/assets/SearchPlugin-DA4en4hK.css +1 -0
  107. package/src/ui/dist/assets/TextViewerPlugin-CB4DYfWO.js +54 -0
  108. package/src/ui/dist/assets/VNCViewer-CjlbyCB3.js +11 -0
  109. package/src/ui/dist/assets/bot-CFkZY-JP.js +6 -0
  110. package/src/ui/dist/assets/browser-CTB2jwNe.js +8 -0
  111. package/src/ui/dist/assets/chevron-up-Dq5ofbht.js +6 -0
  112. package/src/ui/dist/assets/code-DLC6G24T.js +6 -0
  113. package/src/ui/dist/assets/file-content-Dv4LoZec.js +1 -0
  114. package/src/ui/dist/assets/file-diff-panel-Denq-lC3.js +1 -0
  115. package/src/ui/dist/assets/file-jump-queue-DA-SdG__.js +1 -0
  116. package/src/ui/dist/assets/file-socket-Cu4Qln7Y.js +1 -0
  117. package/src/ui/dist/assets/git-commit-horizontal-BUh6G52n.js +6 -0
  118. package/src/ui/dist/assets/image-B9HUUddG.js +6 -0
  119. package/src/ui/dist/assets/index-B2B1sg-M.js +1 -0
  120. package/src/ui/dist/assets/index-Cgla8biy.css +33 -0
  121. package/src/ui/dist/assets/index-DRyx7vAc.js +1 -0
  122. package/src/ui/dist/assets/index-Gbl53BNp.js +2496 -0
  123. package/src/ui/dist/assets/index-wQ7RIIRd.js +11 -0
  124. package/src/ui/dist/assets/monaco-CiHMMNH_.js +1 -0
  125. package/src/ui/dist/assets/pdf-effect-queue-ZtnHFCAi.js +6 -0
  126. package/src/ui/dist/assets/plugin-monaco-C8UgLomw.js +19 -0
  127. package/src/ui/dist/assets/plugin-notebook-HbW2K-1c.js +169 -0
  128. package/src/ui/dist/assets/plugin-pdf-CR8hgQBV.js +357 -0
  129. package/src/ui/dist/assets/plugin-terminal-MXFIPun8.js +227 -0
  130. package/src/ui/dist/assets/popover-DL6h35vr.js +1 -0
  131. package/src/ui/dist/assets/project-sync-CsX08Qno.js +1 -0
  132. package/src/ui/dist/assets/select-DvmXt1yY.js +11 -0
  133. package/src/ui/dist/assets/sigma-7jpXazui.js +6 -0
  134. package/src/ui/dist/assets/trash-xA7kFt8i.js +11 -0
  135. package/src/ui/dist/assets/useCliAccess-DsMwDjOp.js +1 -0
  136. package/src/ui/dist/assets/useFileDiffOverlay-FuhcnKiw.js +1 -0
  137. package/src/ui/dist/assets/wrap-text-CwMn-iqb.js +11 -0
  138. package/src/ui/dist/assets/zoom-out-R-GWEhzS.js +11 -0
  139. package/src/ui/dist/index.html +5 -2
  140. package/src/ui/dist/assets/AiManusChatView-DDjbFnbt.js +0 -26597
  141. package/src/ui/dist/assets/AnalysisPlugin-Yb5IdmaU.js +0 -123
  142. package/src/ui/dist/assets/CliPlugin-e64sreyu.js +0 -31037
  143. package/src/ui/dist/assets/CodeEditorPlugin-C4D2TIkU.js +0 -427
  144. package/src/ui/dist/assets/CodeViewerPlugin-BVoNZIvC.js +0 -905
  145. package/src/ui/dist/assets/DocViewerPlugin-CLChbllo.js +0 -278
  146. package/src/ui/dist/assets/GitDiffViewerPlugin-C4xeFyFQ.js +0 -2661
  147. package/src/ui/dist/assets/ImageViewerPlugin-OiMUAcLi.js +0 -500
  148. package/src/ui/dist/assets/LabCopilotPanel-BjD2ThQF.js +0 -4104
  149. package/src/ui/dist/assets/LabPlugin-DQPg-NrB.js +0 -2677
  150. package/src/ui/dist/assets/LatexPlugin-CI05XAV9.js +0 -1792
  151. package/src/ui/dist/assets/MarkdownViewerPlugin-DpeBLYZf.js +0 -308
  152. package/src/ui/dist/assets/MarketplacePlugin-DolE58Q2.js +0 -413
  153. package/src/ui/dist/assets/NotebookEditor-7Qm2rSWD.js +0 -4214
  154. package/src/ui/dist/assets/NotebookEditor-C1kWaxKi.js +0 -84873
  155. package/src/ui/dist/assets/NotebookEditor-C3VQ7ylN.css +0 -1405
  156. package/src/ui/dist/assets/PdfLoader-BfOHw8Zw.js +0 -25468
  157. package/src/ui/dist/assets/PdfLoader-C-Y707R3.css +0 -49
  158. package/src/ui/dist/assets/PdfMarkdownPlugin-BulDREv1.js +0 -409
  159. package/src/ui/dist/assets/PdfViewerPlugin-C-daaOaL.js +0 -3095
  160. package/src/ui/dist/assets/PdfViewerPlugin-DQ11QcSf.css +0 -3627
  161. package/src/ui/dist/assets/SearchPlugin-CjpaiJ3A.js +0 -741
  162. package/src/ui/dist/assets/SearchPlugin-DDMrGDkh.css +0 -379
  163. package/src/ui/dist/assets/TextViewerPlugin-BxIyqPQC.js +0 -472
  164. package/src/ui/dist/assets/VNCViewer-HAg9mF7M.js +0 -18821
  165. package/src/ui/dist/assets/awareness-C0NPR2Dj.js +0 -292
  166. package/src/ui/dist/assets/bot-0DYntytV.js +0 -21
  167. package/src/ui/dist/assets/browser-BAcuE0Xj.js +0 -2895
  168. package/src/ui/dist/assets/code-B20Slj_w.js +0 -17
  169. package/src/ui/dist/assets/file-content-DT24KFma.js +0 -377
  170. package/src/ui/dist/assets/file-diff-panel-DK13YPql.js +0 -92
  171. package/src/ui/dist/assets/file-jump-queue-r5XKgJEV.js +0 -16
  172. package/src/ui/dist/assets/file-socket-B4T2o4nR.js +0 -58
  173. package/src/ui/dist/assets/function-B5QZkkHC.js +0 -1895
  174. package/src/ui/dist/assets/image-DSeR_sDS.js +0 -18
  175. package/src/ui/dist/assets/index-BrFje2Uk.js +0 -120
  176. package/src/ui/dist/assets/index-BwRJaoTl.js +0 -25
  177. package/src/ui/dist/assets/index-D_E4281X.js +0 -221322
  178. package/src/ui/dist/assets/index-DnYB3xb1.js +0 -159
  179. package/src/ui/dist/assets/index-G7AcWcMu.css +0 -12594
  180. package/src/ui/dist/assets/monaco-LExaAN3Y.js +0 -623
  181. package/src/ui/dist/assets/pdf-effect-queue-BJk5okWJ.js +0 -47
  182. package/src/ui/dist/assets/pdf_viewer-e0g1is2C.js +0 -8206
  183. package/src/ui/dist/assets/popover-D3Gg_FoV.js +0 -476
  184. package/src/ui/dist/assets/project-sync-C_ygLlVU.js +0 -297
  185. package/src/ui/dist/assets/select-CpAK6uWm.js +0 -1690
  186. package/src/ui/dist/assets/sigma-DEccaSgk.js +0 -22
  187. package/src/ui/dist/assets/square-check-big-uUfyVsbD.js +0 -17
  188. package/src/ui/dist/assets/trash-CXvwwSe8.js +0 -32
  189. package/src/ui/dist/assets/useCliAccess-Bnop4mgR.js +0 -957
  190. package/src/ui/dist/assets/useFileDiffOverlay-B8eUAX0I.js +0 -53
  191. package/src/ui/dist/assets/wrap-text-9vbOBpkW.js +0 -35
  192. package/src/ui/dist/assets/yjs-DncrqiZ8.js +0 -11243
  193. package/src/ui/dist/assets/zoom-out-BgVMmOW4.js +0 -34
@@ -1,741 +0,0 @@
1
- import { w as createLucideIcon, u as useI18n, r as reactExports, f as useFileTreeStore, n as useTabsStore, aA as useLabCopilotStore, ab as useOpenFile, aB as listLabAgents, aC as listLabQuests, aD as searchFiles, aE as searchLabQuest, v as BUILTIN_PLUGINS, aF as resolveAgentDisplayName, aG as resolveAgentMentionLabel, aH as resolveQuestLabel, aI as formatRelativeTime, j as jsxRuntimeExports, l as Search, X, b as cn, aJ as FileIcon } from './index-D_E4281X.js';
2
-
3
- /**
4
- * @license lucide-react v0.511.0 - ISC
5
- *
6
- * This source code is licensed under the ISC license.
7
- * See the LICENSE file in the root directory of this source tree.
8
- */
9
-
10
-
11
- const __iconNode$2 = [
12
- ["path", { d: "M20 4v7a4 4 0 0 1-4 4H4", key: "6o5b7l" }],
13
- ["path", { d: "m9 10-5 5 5 5", key: "1kshq7" }]
14
- ];
15
- const CornerDownLeft = createLucideIcon("corner-down-left", __iconNode$2);
16
-
17
- /**
18
- * @license lucide-react v0.511.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */
23
-
24
-
25
- const __iconNode$1 = [
26
- [
27
- "path",
28
- {
29
- d: "M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",
30
- key: "169xi5"
31
- }
32
- ],
33
- ["path", { d: "M15 5.764v15", key: "1pn4in" }],
34
- ["path", { d: "M9 3.236v15", key: "1uimfh" }]
35
- ];
36
- const Map$1 = createLucideIcon("map", __iconNode$1);
37
-
38
- /**
39
- * @license lucide-react v0.511.0 - ISC
40
- *
41
- * This source code is licensed under the ISC license.
42
- * See the LICENSE file in the root directory of this source tree.
43
- */
44
-
45
-
46
- const __iconNode = [
47
- ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
48
- ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
49
- ];
50
- const User = createLucideIcon("user", __iconNode);
51
-
52
- const LAB_FOCUS_EVENT = "ds:lab:focus";
53
- function getProjectIdFromContext(context) {
54
- const projectId = context.customData?.projectId;
55
- return typeof projectId === "string" ? projectId : null;
56
- }
57
- function getReadOnlyFromContext(context) {
58
- return Boolean(context.customData?.readOnly);
59
- }
60
- function SearchPlugin({ context, setTitle }) {
61
- const { t } = useI18n("search");
62
- reactExports.useEffect(() => setTitle(t("title")), [setTitle, t]);
63
- const projectId = getProjectIdFromContext(context);
64
- const readOnly = getReadOnlyFromContext(context);
65
- const initialQuery = typeof context.customData?.query === "string" ? context.customData.query : "";
66
- const nodes = useFileTreeStore((s) => s.nodes);
67
- const findNode = useFileTreeStore((s) => s.findNode);
68
- const storeProjectId = useFileTreeStore((s) => s.projectId);
69
- const isTreeLoading = useFileTreeStore((s) => s.isLoading);
70
- const loadFiles = useFileTreeStore((s) => s.loadFiles);
71
- const openTab = useTabsStore((s) => s.openTab);
72
- const setActiveTab = useTabsStore((s) => s.setActiveTab);
73
- const tabs = useTabsStore((s) => s.tabs);
74
- const activeQuestId = useLabCopilotStore((s) => s.activeQuestId);
75
- const { openFileInTab } = useOpenFile();
76
- const inputRef = reactExports.useRef(null);
77
- const [query, setQuery] = reactExports.useState(initialQuery);
78
- const [fileResults, setFileResults] = reactExports.useState([]);
79
- const [isSearching, setIsSearching] = reactExports.useState(false);
80
- const [fileError, setFileError] = reactExports.useState(null);
81
- const [truncated, setTruncated] = reactExports.useState(false);
82
- const [scope, setScope] = reactExports.useState("all");
83
- const requestSeq = reactExports.useRef(0);
84
- const [labAgents, setLabAgents] = reactExports.useState([]);
85
- const [labQuests, setLabQuests] = reactExports.useState([]);
86
- const [labLoading, setLabLoading] = reactExports.useState(false);
87
- const [labError, setLabError] = reactExports.useState(null);
88
- const [questSearchItems, setQuestSearchItems] = reactExports.useState([]);
89
- const [questSearchCursor, setQuestSearchCursor] = reactExports.useState(null);
90
- const [questSearchHasMore, setQuestSearchHasMore] = reactExports.useState(false);
91
- const [questSearchLoading, setQuestSearchLoading] = reactExports.useState(false);
92
- const [questSearchError, setQuestSearchError] = reactExports.useState(null);
93
- const questSearchSeq = reactExports.useRef(0);
94
- const questSearchIds = reactExports.useRef(/* @__PURE__ */ new Set());
95
- reactExports.useEffect(() => {
96
- inputRef.current?.focus();
97
- }, []);
98
- reactExports.useEffect(() => {
99
- if (!projectId) return;
100
- if (storeProjectId === projectId) return;
101
- void loadFiles(projectId);
102
- }, [projectId, storeProjectId, loadFiles]);
103
- reactExports.useEffect(() => {
104
- if (!projectId) {
105
- setLabAgents([]);
106
- setLabQuests([]);
107
- setLabError(null);
108
- return;
109
- }
110
- let isActive = true;
111
- setLabLoading(true);
112
- setLabError(null);
113
- Promise.all([listLabAgents(projectId), listLabQuests(projectId)]).then(([agentResponse, questResponse]) => {
114
- if (!isActive) return;
115
- setLabAgents(agentResponse.items ?? []);
116
- setLabQuests(questResponse.items ?? []);
117
- }).catch(() => {
118
- if (!isActive) return;
119
- setLabError("Lab search is unavailable right now.");
120
- setLabAgents([]);
121
- setLabQuests([]);
122
- }).finally(() => {
123
- if (!isActive) return;
124
- setLabLoading(false);
125
- });
126
- return () => {
127
- isActive = false;
128
- };
129
- }, [projectId]);
130
- const buildSearchPattern = reactExports.useCallback((raw) => {
131
- const trimmed = raw.trim();
132
- const normalized = trimmed.replace(/^\/+/, "");
133
- if (!normalized) return "";
134
- if (/[*?\[]/.test(normalized)) return normalized;
135
- return `*${normalized}*`;
136
- }, []);
137
- const questSearchConfig = reactExports.useMemo(() => {
138
- const trimmed = query.trim();
139
- if (!trimmed) {
140
- return { questId: null, queryText: "", types: void 0 };
141
- }
142
- const tokenRegex = /(\w+):(".*?"|\S+)/g;
143
- let questId = null;
144
- const types = /* @__PURE__ */ new Set();
145
- const terms = [];
146
- let cleaned = trimmed.replace(tokenRegex, (_full, key, value) => {
147
- const normalizedKey = String(key).toLowerCase();
148
- const rawValue = String(value || "").replace(/^"|"$/g, "");
149
- if (normalizedKey === "quest") {
150
- questId = rawValue || questId;
151
- return "";
152
- }
153
- if (normalizedKey === "event") {
154
- types.add("event");
155
- if (rawValue) terms.push(rawValue);
156
- return "";
157
- }
158
- if (normalizedKey === "branch") {
159
- types.add("branch");
160
- if (rawValue) terms.push(rawValue);
161
- return "";
162
- }
163
- if (rawValue) terms.push(rawValue);
164
- return "";
165
- });
166
- cleaned = cleaned.replace(tokenRegex, "").trim();
167
- if (cleaned) terms.push(cleaned);
168
- const queryText = terms.join(" ").trim();
169
- const contextQuestId = typeof context.customData?.questId === "string" ? context.customData.questId : null;
170
- const resolvedQuestId = questId || contextQuestId || activeQuestId || null;
171
- return {
172
- questId: resolvedQuestId,
173
- queryText,
174
- types: types.size ? Array.from(types).join(",") : void 0
175
- };
176
- }, [activeQuestId, context.customData?.questId, query]);
177
- reactExports.useEffect(() => {
178
- const trimmed = query.trim();
179
- if (!projectId || trimmed.length === 0) {
180
- setFileResults([]);
181
- setTruncated(false);
182
- setFileError(null);
183
- setIsSearching(false);
184
- return;
185
- }
186
- const currentSeq = requestSeq.current + 1;
187
- requestSeq.current = currentSeq;
188
- setIsSearching(true);
189
- setFileError(null);
190
- const timer = setTimeout(() => {
191
- const pattern = buildSearchPattern(trimmed);
192
- if (!pattern) {
193
- setFileResults([]);
194
- setTruncated(false);
195
- setIsSearching(false);
196
- return;
197
- }
198
- void (async () => {
199
- try {
200
- const response = await searchFiles(projectId, {
201
- pattern,
202
- include_folders: false,
203
- limit: 50,
204
- sort_by: "updated_at",
205
- sort_order: "desc"
206
- });
207
- if (requestSeq.current !== currentSeq) return;
208
- setFileResults(response.items ?? []);
209
- setTruncated(Boolean(response.truncated));
210
- } catch (err) {
211
- if (requestSeq.current !== currentSeq) return;
212
- setFileError("Search failed. Please try again.");
213
- setFileResults([]);
214
- setTruncated(false);
215
- } finally {
216
- if (requestSeq.current === currentSeq) {
217
- setIsSearching(false);
218
- }
219
- }
220
- })();
221
- }, 200);
222
- return () => {
223
- clearTimeout(timer);
224
- };
225
- }, [buildSearchPattern, projectId, query]);
226
- const fetchQuestSearch = reactExports.useCallback(
227
- async (cursor, append) => {
228
- if (!projectId) return;
229
- if (!questSearchConfig.questId) return;
230
- if (!questSearchConfig.queryText.trim()) return;
231
- setQuestSearchLoading(true);
232
- setQuestSearchError(null);
233
- try {
234
- const response = await searchLabQuest(projectId, questSearchConfig.questId, {
235
- query: questSearchConfig.queryText,
236
- types: questSearchConfig.types,
237
- limit: 20,
238
- cursor: cursor ?? void 0
239
- });
240
- const items = response.items ?? [];
241
- const nextCursor = response.next_cursor ?? null;
242
- const hasMore = Boolean(response.has_more || nextCursor);
243
- if (!append) {
244
- questSearchIds.current = /* @__PURE__ */ new Set();
245
- }
246
- setQuestSearchItems((prev) => {
247
- const next = append ? [...prev] : [];
248
- items.forEach((item) => {
249
- const id = item.item_type === "event" ? `event:${item.event?.event_id ?? ""}` : `branch:${item.branch?.node_id ?? ""}`;
250
- if (!id || questSearchIds.current.has(id)) return;
251
- questSearchIds.current.add(id);
252
- next.push(item);
253
- });
254
- return next;
255
- });
256
- setQuestSearchCursor(nextCursor);
257
- setQuestSearchHasMore(hasMore);
258
- } catch {
259
- setQuestSearchError("Quest search is unavailable right now.");
260
- setQuestSearchItems([]);
261
- setQuestSearchCursor(null);
262
- setQuestSearchHasMore(false);
263
- } finally {
264
- setQuestSearchLoading(false);
265
- }
266
- },
267
- [projectId, questSearchConfig]
268
- );
269
- reactExports.useEffect(() => {
270
- if (!projectId || scope === "files") {
271
- setQuestSearchItems([]);
272
- setQuestSearchCursor(null);
273
- setQuestSearchHasMore(false);
274
- setQuestSearchError(null);
275
- return;
276
- }
277
- const trimmed = query.trim();
278
- if (!trimmed) {
279
- setQuestSearchItems([]);
280
- setQuestSearchCursor(null);
281
- setQuestSearchHasMore(false);
282
- setQuestSearchError(null);
283
- return;
284
- }
285
- if (!questSearchConfig.questId) {
286
- setQuestSearchItems([]);
287
- setQuestSearchCursor(null);
288
- setQuestSearchHasMore(false);
289
- setQuestSearchError("Add quest:<id> to search quest graph.");
290
- return;
291
- }
292
- if (!questSearchConfig.queryText.trim()) {
293
- setQuestSearchItems([]);
294
- setQuestSearchCursor(null);
295
- setQuestSearchHasMore(false);
296
- setQuestSearchError("Add search terms after quest:<id>.");
297
- return;
298
- }
299
- const currentSeq = questSearchSeq.current + 1;
300
- questSearchSeq.current = currentSeq;
301
- const timer = setTimeout(() => {
302
- if (questSearchSeq.current !== currentSeq) return;
303
- fetchQuestSearch(null, false).catch(() => void 0);
304
- }, 200);
305
- return () => clearTimeout(timer);
306
- }, [fetchQuestSearch, projectId, query, questSearchConfig, scope]);
307
- const openResult = reactExports.useCallback(
308
- async (item) => {
309
- if (!projectId) return;
310
- let node = findNode(item.id);
311
- if (!node) {
312
- await loadFiles(projectId);
313
- node = findNode(item.id);
314
- }
315
- if (!node) return;
316
- if (node.type !== "file" && node.type !== "notebook") return;
317
- const options = { customData: { projectId } };
318
- await openFileInTab(node, options);
319
- },
320
- [findNode, loadFiles, openFileInTab, projectId]
321
- );
322
- const openLabFocus = reactExports.useCallback(
323
- (focusType, focusId, branch, eventId) => {
324
- if (!projectId) return;
325
- const focusPayload = {
326
- projectId,
327
- focusType,
328
- focusId,
329
- branch: branch ?? null,
330
- eventId: eventId ?? null
331
- };
332
- const focusWindow = window;
333
- focusWindow.__dsLabPendingFocus = focusPayload;
334
- const existing = tabs.find((tab) => {
335
- if (tab.pluginId !== BUILTIN_PLUGINS.LAB) return false;
336
- if (tab.context.type !== "custom") return false;
337
- const data = tab.context.customData;
338
- return data?.projectId === projectId;
339
- });
340
- if (existing) {
341
- setActiveTab(existing.id);
342
- window.dispatchEvent(new CustomEvent(LAB_FOCUS_EVENT, { detail: focusPayload }));
343
- return;
344
- }
345
- openTab({
346
- pluginId: BUILTIN_PLUGINS.LAB,
347
- context: {
348
- type: "custom",
349
- customData: {
350
- projectId,
351
- readOnly
352
- }
353
- },
354
- title: "Home"
355
- });
356
- window.requestAnimationFrame(() => {
357
- window.dispatchEvent(new CustomEvent(LAB_FOCUS_EVENT, { detail: focusPayload }));
358
- });
359
- },
360
- [openTab, projectId, readOnly, setActiveTab, tabs]
361
- );
362
- const canSearch = Boolean(projectId);
363
- const trimmedQuery = query.trim();
364
- const normalizedQuery = trimmedQuery.toLowerCase();
365
- const fileResultsView = reactExports.useMemo(
366
- () => fileResults.map((item) => {
367
- const node = findNode(item.id);
368
- return {
369
- item,
370
- node: node ?? void 0,
371
- name: node?.name ?? item.name,
372
- type: node?.type ?? item.type,
373
- mimeType: node?.mimeType ?? item.mime_type,
374
- path: node?.path ?? item.path ?? "—"
375
- };
376
- }),
377
- [fileResults, findNode, nodes]
378
- );
379
- const questById = reactExports.useMemo(() => {
380
- return new Map(labQuests.map((quest) => [quest.quest_id, quest]));
381
- }, [labQuests]);
382
- const matchesQuery = reactExports.useCallback(
383
- (value) => {
384
- if (!normalizedQuery) return false;
385
- if (!value) return false;
386
- return value.toLowerCase().includes(normalizedQuery);
387
- },
388
- [normalizedQuery]
389
- );
390
- const agentResults = reactExports.useMemo(() => {
391
- if (!normalizedQuery) return [];
392
- return labAgents.filter((agent) => {
393
- const name = resolveAgentDisplayName(agent);
394
- const mention = resolveAgentMentionLabel(agent);
395
- return matchesQuery(name) || matchesQuery(mention) || matchesQuery(agent.agent_id) || matchesQuery(agent.template_id);
396
- }).map((agent) => {
397
- const title = resolveAgentDisplayName(agent);
398
- const mention = resolveAgentMentionLabel(agent);
399
- const activeQuest = agent.active_quest_id ? questById.get(agent.active_quest_id) : null;
400
- const status = agent.status?.trim() ? agent.status : activeQuest ? `Quest: ${resolveQuestLabel(activeQuest)}` : "Idle";
401
- return {
402
- kind: "agent",
403
- id: agent.instance_id,
404
- title,
405
- subtitle: `${mention} · ${status}`,
406
- accent: agent.avatar_frame_color ?? void 0,
407
- agent
408
- };
409
- }).slice(0, 20);
410
- }, [labAgents, matchesQuery, normalizedQuery, questById]);
411
- const questResults = reactExports.useMemo(() => {
412
- if (!normalizedQuery) return [];
413
- return labQuests.filter((quest) => {
414
- const tags = quest.tags ?? [];
415
- return matchesQuery(quest.title) || matchesQuery(quest.description) || matchesQuery(quest.quest_id) || tags.some((tag) => matchesQuery(tag));
416
- }).map((quest) => {
417
- const title = resolveQuestLabel(quest);
418
- const subtitle = quest.description?.trim() || "Quest pipeline";
419
- return {
420
- kind: "quest",
421
- id: quest.quest_id,
422
- title,
423
- subtitle,
424
- meta: quest.tags?.join(", "),
425
- accent: "#4d7c84",
426
- quest
427
- };
428
- }).slice(0, 20);
429
- }, [labQuests, matchesQuery, normalizedQuery]);
430
- const questSearchView = reactExports.useMemo(() => {
431
- if (!questSearchItems.length || !questSearchConfig.questId) return [];
432
- return questSearchItems.map((item) => {
433
- if (item.item_type === "event") {
434
- const event = item.event ?? null;
435
- const title2 = event?.event_type || "Event";
436
- const subtitle2 = event?.reply_to_pi || event?.payload_summary || "Quest event";
437
- const meta2 = `${event?.branch_name || "main"} · ${formatRelativeTime(event?.created_at)}`;
438
- return {
439
- id: event?.event_id || `${title2}-${meta2}`,
440
- kind: "quest-event",
441
- questId: questSearchConfig.questId,
442
- title: title2,
443
- subtitle: subtitle2,
444
- meta: meta2,
445
- event,
446
- branch: null
447
- };
448
- }
449
- const branch = item.branch ?? null;
450
- const title = branch?.branch_name || "Branch";
451
- const subtitle = branch?.idea_id ? `Idea ${branch.idea_id}` : branch?.status || "Quest branch";
452
- const meta = branch?.verdict ? `Verdict: ${branch.verdict}` : null;
453
- return {
454
- id: branch?.node_id || `${title}-${subtitle}`,
455
- kind: "quest-branch",
456
- questId: questSearchConfig.questId,
457
- title,
458
- subtitle,
459
- meta: meta || void 0,
460
- event: null,
461
- branch
462
- };
463
- });
464
- }, [questSearchConfig.questId, questSearchItems]);
465
- const showFiles = scope !== "lab";
466
- const showLab = scope !== "files";
467
- const agentCount = agentResults.length;
468
- const questCount = questResults.length;
469
- const questSearchCount = questSearchView.length;
470
- const labCount = agentCount + questCount + questSearchCount;
471
- const fileCount = fileResultsView.length;
472
- const hasResults = showLab && labCount > 0 || showFiles && fileCount > 0;
473
- const topResult = reactExports.useMemo(() => {
474
- if (scope === "lab") {
475
- return questSearchView[0] ?? agentResults[0] ?? questResults[0] ?? null;
476
- }
477
- if (scope === "files") {
478
- return fileResultsView[0] ?? null;
479
- }
480
- return questSearchView[0] ?? agentResults[0] ?? questResults[0] ?? fileResultsView[0] ?? null;
481
- }, [agentResults, fileResultsView, questResults, questSearchView, scope]);
482
- const handleEnter = reactExports.useCallback(() => {
483
- if (!topResult) return;
484
- if ("item" in topResult) {
485
- void openResult(topResult.item);
486
- return;
487
- }
488
- if ("kind" in topResult) {
489
- switch (topResult.kind) {
490
- case "quest-event":
491
- openLabFocus(
492
- "quest-event",
493
- topResult.questId,
494
- topResult.event?.branch_name,
495
- topResult.event?.event_id
496
- );
497
- return;
498
- case "quest-branch":
499
- openLabFocus("quest-branch", topResult.questId, topResult.branch?.branch_name, null);
500
- return;
501
- case "agent":
502
- if (topResult.agent) {
503
- openLabFocus("agent", topResult.agent.instance_id);
504
- }
505
- return;
506
- case "quest":
507
- if (topResult.quest) {
508
- openLabFocus("quest", topResult.quest.quest_id);
509
- }
510
- return;
511
- default:
512
- return;
513
- }
514
- }
515
- }, [openLabFocus, openResult, topResult]);
516
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-surface", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-shell", children: [
517
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-header", children: [
518
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
519
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-kicker", children: t("kicker") }),
520
- /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "ds-search-title", children: t("title") }),
521
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ds-search-subtitle", children: t("subtitle") })
522
- ] }),
523
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-shortcut", children: [
524
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("shortcut") }),
525
- /* @__PURE__ */ jsxRuntimeExports.jsx("kbd", { children: "⌘K" })
526
- ] })
527
- ] }),
528
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("ds-search-field", !canSearch && "opacity-60"), children: [
529
- /* @__PURE__ */ jsxRuntimeExports.jsx(Search, { className: "h-4 w-4 text-[#6f5c46]" }),
530
- /* @__PURE__ */ jsxRuntimeExports.jsx(
531
- "input",
532
- {
533
- ref: inputRef,
534
- value: query,
535
- onChange: (e) => setQuery(e.target.value),
536
- onKeyDown: (e) => {
537
- if (e.key === "Enter") {
538
- e.preventDefault();
539
- handleEnter();
540
- }
541
- },
542
- placeholder: !canSearch ? t("placeholder_disabled") : isTreeLoading ? t("placeholder_indexing") : t("placeholder_default"),
543
- className: "ds-search-input",
544
- disabled: !canSearch
545
- }
546
- ),
547
- query ? /* @__PURE__ */ jsxRuntimeExports.jsx(
548
- "button",
549
- {
550
- type: "button",
551
- onClick: () => setQuery(""),
552
- className: "ds-search-clear",
553
- "aria-label": t("clear_search"),
554
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" })
555
- }
556
- ) : null
557
- ] }),
558
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-scope", children: [
559
- { id: "all", label: t("scope_all"), count: fileCount + labCount },
560
- { id: "files", label: t("scope_files"), count: fileCount },
561
- { id: "lab", label: t("scope_lab"), count: labCount }
562
- ].map((item) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
563
- "button",
564
- {
565
- type: "button",
566
- className: "ds-search-chip",
567
- "data-active": scope === item.id,
568
- onClick: () => setScope(item.id),
569
- children: [
570
- item.label,
571
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: item.count })
572
- ]
573
- },
574
- item.id
575
- )) }),
576
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-panel", children: trimmedQuery.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-empty", children: [
577
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { children: t("try_title") }),
578
- /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-1 list-disc pl-5", children: [
579
- /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t("try_goals") }),
580
- /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t("try_agents") }),
581
- /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t("try_paths") })
582
- ] }),
583
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-hint", children: [
584
- /* @__PURE__ */ jsxRuntimeExports.jsx(CornerDownLeft, { className: "h-3.5 w-3.5" }),
585
- t("press_enter_hint")
586
- ] })
587
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
588
- showLab ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
589
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-section", style: { "--ds-delay": "0s" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-section-title", children: [
590
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("section_agents") }),
591
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-section-meta", children: t("results_count", { count: agentCount }) })
592
- ] }) }),
593
- labLoading && agentCount === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("loading_lab_agents") }) : labError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: labError }) : agentCount === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("no_agents") }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-list", children: agentResults.map((agent, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
594
- "button",
595
- {
596
- type: "button",
597
- className: "ds-search-result",
598
- style: {
599
- "--ds-search-accent": agent.accent ?? "#c2a15c",
600
- "--ds-delay": `${index * 0.04}s`
601
- },
602
- onClick: () => {
603
- if (!agent.agent) return;
604
- openLabFocus("agent", agent.agent.instance_id);
605
- },
606
- children: [
607
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-result-mark", children: /* @__PURE__ */ jsxRuntimeExports.jsx(User, { className: "h-4 w-4" }) }),
608
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-result-body", children: [
609
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-title", children: agent.title }),
610
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-subtitle", children: agent.subtitle })
611
- ] }),
612
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-badge", children: t("badge_agent") })
613
- ]
614
- },
615
- agent.id
616
- )) }),
617
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-section", style: { "--ds-delay": "0.04s" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-section-title", children: [
618
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("section_quest_graph") }),
619
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-section-meta", children: t("results_count", { count: questSearchCount }) })
620
- ] }) }),
621
- questSearchLoading && questSearchCount === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("searching_quest_graph") }) : questSearchError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: questSearchError }) : questSearchCount === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("no_quest_graph") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-result-list", children: [
622
- questSearchView.map((result, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
623
- "button",
624
- {
625
- type: "button",
626
- className: "ds-search-result",
627
- style: {
628
- "--ds-search-accent": "#a67c52",
629
- "--ds-delay": `${index * 0.04}s`
630
- },
631
- onClick: () => {
632
- if (result.kind === "quest-event") {
633
- openLabFocus(
634
- "quest-event",
635
- result.questId,
636
- result.event?.branch_name,
637
- result.event?.event_id
638
- );
639
- return;
640
- }
641
- openLabFocus(
642
- "quest-branch",
643
- result.questId,
644
- result.branch?.branch_name,
645
- null
646
- );
647
- },
648
- children: [
649
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-result-mark", children: result.kind === "quest-event" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Search, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Map$1, { className: "h-4 w-4" }) }),
650
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-result-body", children: [
651
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-title", children: result.title }),
652
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-subtitle", children: result.subtitle }),
653
- result.meta ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-meta", children: result.meta }) : null
654
- ] }),
655
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-badge", children: result.kind === "quest-event" ? t("badge_event") : t("badge_branch") })
656
- ]
657
- },
658
- result.id
659
- )),
660
- questSearchHasMore ? /* @__PURE__ */ jsxRuntimeExports.jsx(
661
- "button",
662
- {
663
- type: "button",
664
- className: "ds-search-load",
665
- onClick: () => fetchQuestSearch(questSearchCursor, true),
666
- disabled: questSearchLoading,
667
- children: questSearchLoading ? t("loading_more") : t("load_more")
668
- }
669
- ) : null
670
- ] }),
671
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-section", style: { "--ds-delay": "0.04s" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-section-title", children: [
672
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("section_quests") }),
673
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-section-meta", children: t("results_count", { count: questCount }) })
674
- ] }) }),
675
- labLoading && questCount === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("loading_quests") }) : labError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: labError }) : questCount === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("no_quests") }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-list", children: questResults.map((quest, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
676
- "button",
677
- {
678
- type: "button",
679
- className: "ds-search-result",
680
- style: {
681
- "--ds-search-accent": quest.accent ?? "#4d7c84",
682
- "--ds-delay": `${index * 0.04}s`
683
- },
684
- onClick: () => {
685
- if (!quest.quest) return;
686
- openLabFocus("quest", quest.quest.quest_id);
687
- },
688
- children: [
689
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-result-mark", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Map$1, { className: "h-4 w-4" }) }),
690
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-result-body", children: [
691
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-title", children: quest.title }),
692
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-subtitle", children: quest.subtitle }),
693
- quest.meta ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-meta", children: quest.meta }) : null
694
- ] }),
695
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-badge", children: t("badge_quest") })
696
- ]
697
- },
698
- quest.id
699
- )) })
700
- ] }) : null,
701
- showFiles ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
702
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-section", style: { "--ds-delay": "0.08s" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-section-title", children: [
703
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("section_files") }),
704
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-section-meta", children: t("results_count", { count: fileCount }) })
705
- ] }) }),
706
- fileError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: fileError }) : isSearching ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("searching_files") }) : fileCount === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("no_files") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-result-list", children: [
707
- fileResultsView.map((file, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
708
- "button",
709
- {
710
- type: "button",
711
- className: "ds-search-result",
712
- style: { "--ds-delay": `${index * 0.03}s` },
713
- onClick: () => void openResult(file.item),
714
- children: [
715
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-result-mark", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
716
- FileIcon,
717
- {
718
- type: file.type,
719
- mimeType: file.mimeType,
720
- name: file.name,
721
- className: "h-4 w-4"
722
- }
723
- ) }),
724
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ds-search-result-body", children: [
725
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-title", children: file.name }),
726
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-result-subtitle", children: file.path })
727
- ] }),
728
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ds-search-badge", children: t("badge_file") })
729
- ]
730
- },
731
- file.item.id
732
- )),
733
- truncated ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("truncated") }) : null
734
- ] })
735
- ] }) : null,
736
- !hasResults && !isSearching && !labLoading && !fileError && !labError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ds-search-status", children: t("no_results") }) : null
737
- ] }) })
738
- ] }) });
739
- }
740
-
741
- export { SearchPlugin as default };