dsh-content-search-ad 0.25.2 → 0.26.1
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/client.js +58 -2
- package/index.js +1 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -19,7 +19,7 @@ window.__ModuleLoader__.load({
|
|
|
19
19
|
/** Locale namespace owned by this plugin. */
|
|
20
20
|
const NS = 'contentSearch'
|
|
21
21
|
/** Plugin version, shown in the panel so a running build can be identified. */
|
|
22
|
-
const PLUGIN_VERSION = '0.
|
|
22
|
+
const PLUGIN_VERSION = '0.26.1'
|
|
23
23
|
/** Tab-type identity; the body slot registers under the same key. */
|
|
24
24
|
const TAB_ID = 'dsh-content-search-ad/panel'
|
|
25
25
|
/** Page kind opened by the guide card and the strip's add control. */
|
|
@@ -1161,6 +1161,8 @@ window.__ModuleLoader__.load({
|
|
|
1161
1161
|
? memory.anchorSessionId
|
|
1162
1162
|
: focusSessionId
|
|
1163
1163
|
const inputRef = React.useRef(null)
|
|
1164
|
+
const chatListRef = React.useRef(null)
|
|
1165
|
+
const chatStickRef = React.useRef(true)
|
|
1164
1166
|
const [query, setQuery] = React.useState(memory.query)
|
|
1165
1167
|
const [phase, setPhase] = React.useState(memory.query.trim().length > 0 ? 'loading' : 'idle')
|
|
1166
1168
|
const [rows, setRows] = React.useState(memory.rows)
|
|
@@ -1249,6 +1251,57 @@ window.__ModuleLoader__.load({
|
|
|
1249
1251
|
return () => clearInterval(timer)
|
|
1250
1252
|
}, [focusSessionId])
|
|
1251
1253
|
|
|
1254
|
+
// The list is a log: keep the newest question in view, unless the user has
|
|
1255
|
+
// scrolled up on purpose to read older ones.
|
|
1256
|
+
React.useEffect(() => {
|
|
1257
|
+
const node = chatListRef.current
|
|
1258
|
+
if (node === null) return
|
|
1259
|
+
if (!chatStickRef.current) return
|
|
1260
|
+
node.scrollTop = node.scrollHeight
|
|
1261
|
+
}, [questions])
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
// A prompt is appended to the transcript the moment it is sent: watch for
|
|
1265
|
+
// new chat nodes so the list updates then, not on the next poll.
|
|
1266
|
+
React.useEffect(() => {
|
|
1267
|
+
if (typeof MutationObserver !== 'function' || typeof document === 'undefined') return undefined
|
|
1268
|
+
if (typeof focusSessionId !== 'string' || focusSessionId.length === 0) return undefined
|
|
1269
|
+
let timer = 0
|
|
1270
|
+
const refresh = () => {
|
|
1271
|
+
if (timer !== 0) return
|
|
1272
|
+
timer = setTimeout(() => {
|
|
1273
|
+
timer = 0
|
|
1274
|
+
const controller = new AbortController()
|
|
1275
|
+
fetchQuestions(focusSessionId, controller.signal).then((outcome) => {
|
|
1276
|
+
if (controller.signal.aborted) return
|
|
1277
|
+
setQuestions((current) => (current.length === outcome.questions.length ? current : outcome.questions))
|
|
1278
|
+
setQuestionCount(outcome.count)
|
|
1279
|
+
}).catch(() => {})
|
|
1280
|
+
}, 600)
|
|
1281
|
+
}
|
|
1282
|
+
const observer = new MutationObserver((records) => {
|
|
1283
|
+
for (const record of records) {
|
|
1284
|
+
const added = record.addedNodes
|
|
1285
|
+
for (let index = 0; index < added.length; index += 1) {
|
|
1286
|
+
const node = added[index]
|
|
1287
|
+
if (node === null || node.nodeType !== 1) continue
|
|
1288
|
+
if (typeof node.matches === 'function' && node.matches('[data-chat-node-key]')) {
|
|
1289
|
+
refresh()
|
|
1290
|
+
return
|
|
1291
|
+
}
|
|
1292
|
+
if (typeof node.querySelector === 'function' && node.querySelector('[data-chat-node-key]') !== null) {
|
|
1293
|
+
refresh()
|
|
1294
|
+
return
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
})
|
|
1299
|
+
observer.observe(document.body, { childList: true, subtree: true })
|
|
1300
|
+
return () => {
|
|
1301
|
+
observer.disconnect()
|
|
1302
|
+
if (timer !== 0) clearTimeout(timer)
|
|
1303
|
+
}
|
|
1304
|
+
}, [focusSessionId])
|
|
1252
1305
|
// The zoom buttons move this; the choice is remembered per browser.
|
|
1253
1306
|
const stepFont = React.useCallback((delta) => {
|
|
1254
1307
|
setFontPx((value) => {
|
|
@@ -1633,7 +1686,10 @@ window.__ModuleLoader__.load({
|
|
|
1633
1686
|
questions.length > 0
|
|
1634
1687
|
? h('div', { className: 'dcs-chat' },
|
|
1635
1688
|
h('p', { className: 'dcs-section dcs-chat-head' }, t('questions.title', { n: questionCount })),
|
|
1636
|
-
h('div', { className: 'dcs-chat-list'
|
|
1689
|
+
h('div', { className: 'dcs-chat-list', ref: chatListRef, onScroll: (event) => {
|
|
1690
|
+
const node = event.currentTarget
|
|
1691
|
+
chatStickRef.current = node.scrollHeight - node.scrollTop - node.clientHeight < 48
|
|
1692
|
+
} }, questions.map((question, index) => {
|
|
1637
1693
|
const hit = trimmed.length > 0 && matchesQuery(question.text, query)
|
|
1638
1694
|
return h('button', {
|
|
1639
1695
|
key: String(question.seq) + ':' + index,
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-content-search-ad",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "DeepSeek Harness (DSH) plugin: full-text search over every conversation's prose from a right sidebar tab, with a jump-to-match detail view.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "zmq6931",
|