dsh-content-search-ad 0.28.0 → 0.29.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/README.md +11 -2
- package/client.js +64 -31
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,12 +74,15 @@ The panel is split in two, and the lower frame never moves:
|
|
|
74
74
|
├ This chat list · 24 ────────────────────────────┤
|
|
75
75
|
│ every question you asked, oldest first │ ← fixed frame, scrolls alone
|
|
76
76
|
│ … │
|
|
77
|
-
├──────────────── [A−] [A+] ──────── v0.
|
|
77
|
+
├──────────────── [A−] [A+] ──────── v0.29.x ─────┤
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
- The lower frame is titled **This chat list** and holds every question **you**
|
|
81
81
|
asked in the current conversation (injected context and tool output are
|
|
82
82
|
filtered out by the message source).
|
|
83
|
+
- Each question is one bordered block and shows its **full text** (rows wrap and
|
|
84
|
+
grow; up to 4000 characters are carried for display), so a prompt that starts
|
|
85
|
+
with pasted code is readable instead of clipped.
|
|
83
86
|
- It reads the **raw session log** once per conversation, so a conversation that
|
|
84
87
|
was compacted still lists its older prompts; a cache plus the cheap surface
|
|
85
88
|
read keep later refreshes fast.
|
|
@@ -87,7 +90,13 @@ The panel is split in two, and the lower frame never moves:
|
|
|
87
90
|
for the new chat node), and the frame keeps the newest question in view unless
|
|
88
91
|
you have scrolled up to read older ones. A 20 s poll is the fallback.
|
|
89
92
|
- Typing a query does **not** filter or reorder that list: matching rows are
|
|
90
|
-
highlighted in place
|
|
93
|
+
highlighted in place.
|
|
94
|
+
- Clicking a row jumps to that question and paints the **whole message** red.
|
|
95
|
+
The jump is resolved by the question's **ordinal** among the conversation's
|
|
96
|
+
prompts (the transcript renders user messages as bubbles in the same order),
|
|
97
|
+
which keeps two near-identical prompts apart; text anchors are only the
|
|
98
|
+
fallback, and history is paged first when the message is outside the rendered
|
|
99
|
+
window. When nothing can be found the frame says so instead of doing nothing.
|
|
91
100
|
- **A− / A+** in the footer change the panel's text size between 12 and 24 px and
|
|
92
101
|
the choice is remembered per browser. Every size in the panel is in `em`, so
|
|
93
102
|
text, padding and control heights scale together.
|
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.29.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. */
|
|
@@ -1125,43 +1125,76 @@ window.__ModuleLoader__.load({
|
|
|
1125
1125
|
return [anchor, tail, whole.slice(0, 60), middle, whole.slice(0, 30), anchor.slice(0, 24)]
|
|
1126
1126
|
}
|
|
1127
1127
|
|
|
1128
|
+
/**
|
|
1129
|
+
/** The user message bubbles the transcript has rendered, in document order. */
|
|
1130
|
+
function userBubbles() {
|
|
1131
|
+
if (typeof document === 'undefined') return []
|
|
1132
|
+
return Array.from(document.querySelectorAll('[data-message-bubble]'))
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* The bubble for one question, by its ordinal in the conversation.
|
|
1137
|
+
*
|
|
1138
|
+
* The transcript renders a window ending at the newest message, so bubble `i`
|
|
1139
|
+
* is question `total - bubbles + i`. Returns `undefined` when that message is
|
|
1140
|
+
* not rendered yet, which is the signal to page history first.
|
|
1141
|
+
*/
|
|
1142
|
+
function bubbleForQuestion(index, total) {
|
|
1143
|
+
const bubbles = userBubbles()
|
|
1144
|
+
const offset = Math.max(0, total - bubbles.length)
|
|
1145
|
+
const target = index - offset
|
|
1146
|
+
if (target < 0 || target >= bubbles.length) return undefined
|
|
1147
|
+
return bubbles[target]
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/** Mark one whole node and bring it into view. */
|
|
1151
|
+
function paintNode(node) {
|
|
1152
|
+
if (node === undefined || node === null) return false
|
|
1153
|
+
const ranges = rangesForNode(node)
|
|
1154
|
+
if (ranges.length === 0) return false
|
|
1155
|
+
CSS.highlights.set(ACTIVE_NAME, new Highlight(...ranges))
|
|
1156
|
+
revealElement(node)
|
|
1157
|
+
return true
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1128
1160
|
/**
|
|
1129
1161
|
* Center one question in the transcript, paging history to it when needed.
|
|
1130
1162
|
*
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1163
|
+
* Order matters: two prompts can read almost identically (`……代码…你觉得呢`),
|
|
1164
|
+
* so the ordinal among the conversation's questions decides first, and text
|
|
1165
|
+
* anchors are only the fallback for when the bubble list disagrees.
|
|
1166
|
+
* Resolves to whether the message was found.
|
|
1134
1167
|
*/
|
|
1135
|
-
async function revealText(sessionId, anchor, seq, text) {
|
|
1136
|
-
if (typeof anchor !== 'string' || anchor.length < 4) return false
|
|
1168
|
+
async function revealText(sessionId, anchor, seq, text, index, total) {
|
|
1137
1169
|
ensureHighlightStyle()
|
|
1138
1170
|
if (!highlightSupported()) return false
|
|
1171
|
+
const ordinal = typeof index === 'number' && Number.isFinite(index)
|
|
1172
|
+
&& typeof total === 'number' && Number.isFinite(total)
|
|
1139
1173
|
const needles = anchorCandidates(anchor, text)
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1174
|
+
|
|
1175
|
+
for (let round = 0; round < 2; round += 1) {
|
|
1176
|
+
if (ordinal) {
|
|
1177
|
+
const node = bubbleForQuestion(index, total)
|
|
1178
|
+
if (node !== undefined && paintNode(node)) return true
|
|
1179
|
+
}
|
|
1180
|
+
const found = findAnchorAny(indexTranscript(true), needles)
|
|
1181
|
+
if (found !== undefined) {
|
|
1182
|
+
const host = found.element !== null && typeof found.element.closest === 'function'
|
|
1183
|
+
? found.element.closest('[data-message-bubble]') || found.element.closest('[data-chat-node-key]')
|
|
1184
|
+
: null
|
|
1185
|
+
if (paintNode(host !== null ? host : found.element)) return true
|
|
1186
|
+
}
|
|
1187
|
+
if (round === 0) {
|
|
1188
|
+
let paged = false
|
|
1189
|
+
try {
|
|
1190
|
+
paged = await pageToHit(sessionId, seq)
|
|
1191
|
+
} catch {
|
|
1192
|
+
paged = false
|
|
1193
|
+
}
|
|
1194
|
+
if (!paged) break
|
|
1195
|
+
}
|
|
1159
1196
|
}
|
|
1160
|
-
|
|
1161
|
-
const retry = findAnchorAny(indexTranscript(true), needles)
|
|
1162
|
-
if (retry === undefined) return false
|
|
1163
|
-
paint(retry)
|
|
1164
|
-
return true
|
|
1197
|
+
return false
|
|
1165
1198
|
}
|
|
1166
1199
|
//#region component
|
|
1167
1200
|
/**
|
|
@@ -1758,7 +1791,7 @@ window.__ModuleLoader__.load({
|
|
|
1758
1791
|
title: question.text,
|
|
1759
1792
|
onClick: () => {
|
|
1760
1793
|
setLocateNote('')
|
|
1761
|
-
revealText(focusSessionId, question.anchor, question.seq, question.text)
|
|
1794
|
+
revealText(focusSessionId, question.anchor, question.seq, question.text, index, questions.length)
|
|
1762
1795
|
.then((ok) => {
|
|
1763
1796
|
if (!ok) setLocateNote(t('detail.missing'))
|
|
1764
1797
|
})
|
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.29.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",
|