dsh-content-search-ad 0.23.0 → 0.24.0

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 (4) hide show
  1. package/README.md +23 -4
  2. package/client.js +69 -16
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -63,10 +63,29 @@ is a subsequence, which turns the list into match-everything noise.
63
63
  - Ordering is legible: more hits first, then the most recent match. Title-only
64
64
  matches come last.
65
65
  - **Recent searches** appear in the empty state; one click re-runs one.
66
- - **This chat** is listed under them: every question **you** asked in the current
67
- conversation, one row each (injected context and tool output are filtered out
68
- by the message source). Clicking a row scrolls to that message in the
69
- transcript and marks it red, paging history first when it is not loaded yet.
66
+
67
+ ## Two frames
68
+
69
+ The panel is split in two, and the lower frame never moves:
70
+
71
+ ```
72
+ ┌ search field + scope ─────────────────────┐
73
+ │ results │ ← search output, scrolls
74
+ ├ This chat · 24 questions ──────────────────┤
75
+ │ the questions you asked, oldest first │ ← fixed list, scrolls on its own
76
+ │ … │
77
+ ├──────────────────────────────── v0.24.0 ───┤
78
+ ```
79
+
80
+ - The lower frame lists every question **you** asked in the current conversation
81
+ (injected context and tool output are filtered out by the message source). It
82
+ refreshes itself every few seconds, so a prompt you send shows up without
83
+ reopening the panel.
84
+ - Typing a query does **not** filter or reorder that list: matching rows are
85
+ highlighted in place, and clicking any row still jumps to it in the transcript.
86
+ - The running version is printed in the footer of both the list and the detail
87
+ view, so a build can be identified (and rolled back) without opening the
88
+ plugin's files.
70
89
 
71
90
  ## The detail view
72
91
 
package/client.js CHANGED
@@ -18,6 +18,8 @@ window.__ModuleLoader__.load({
18
18
  //#region contract
19
19
  /** Locale namespace owned by this plugin. */
20
20
  const NS = 'contentSearch'
21
+ /** Plugin version, shown in the panel so a running build can be identified. */
22
+ const PLUGIN_VERSION = '0.24.0'
21
23
  /** Tab-type identity; the body slot registers under the same key. */
22
24
  const TAB_ID = 'dsh-content-search-ad/panel'
23
25
  /** Page kind opened by the guide card and the strip's add control. */
@@ -170,6 +172,29 @@ window.__ModuleLoader__.load({
170
172
  return String(text === undefined || text === null ? '' : text).replace(/\s+/gu, ' ').trim()
171
173
  }
172
174
 
175
+ /** Positive terms of a query, the same shape the Host parses. */
176
+ function queryTerms(raw) {
177
+ const text = String(raw === undefined || raw === null ? '' : raw)
178
+ const terms = []
179
+ const pattern = /(-?)"([^"]*)"|(-?)(\S+)/gu
180
+ let match = pattern.exec(text)
181
+ while (match !== null) {
182
+ const negative = (match[1] !== undefined ? match[1] : match[3]) === '-'
183
+ const value = String(match[2] !== undefined ? match[2] : match[4]).toLowerCase()
184
+ if (!negative && value.length > 0) terms.push(value)
185
+ match = pattern.exec(text)
186
+ }
187
+ return terms
188
+ }
189
+
190
+ /** Whether every positive term of the query appears in the text. */
191
+ function matchesQuery(text, raw) {
192
+ const terms = queryTerms(raw)
193
+ if (terms.length === 0) return false
194
+ const haystack = normalize(text)
195
+ return terms.every((term) => haystack.includes(term))
196
+ }
197
+
173
198
  /** Drop the ellipsis the Host puts around an excerpt. */
174
199
  function trimEllipsis(text) {
175
200
  return oneLine(text).replace(/^…+/u, '').replace(/…+$/u, '').trim()
@@ -766,7 +791,13 @@ window.__ModuleLoader__.load({
766
791
  .dcs-count{flex:0 0 auto;padding:0 6px;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover-accent,var(--dsw-alias-bg-layer-3));font-size:11px;line-height:17px;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary)}
767
792
  .dcs-row-snippet{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:12px;line-height:1.55;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}
768
793
  .dcs-row-meta{font-size:11px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
769
- .dcs-chevron{flex:0 0 auto;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1}.dcs-questions{display:flex;flex-direction:column;gap:2px;padding:0 6px 6px}
794
+ .dcs-chevron{flex:0 0 auto;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1}.dcs-results{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 6px 10px}
795
+ .dcs-chat{flex:0 0 auto;display:flex;flex-direction:column;max-height:42%;border-top:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}
796
+ .dcs-chat-head{flex:0 0 auto;margin:8px 10px 4px}
797
+ .dcs-chat-list{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 6px 8px;display:flex;flex-direction:column;gap:2px}
798
+ .dcs-question[data-hit="true"]{background:var(--dsw-alias-interactive-bg-hover-accent,var(--dsw-alias-bg-layer-3));color:var(--dsw-alias-label-primary);font-weight:600}
799
+ .dcs-version{flex:0 0 auto;font-variant-numeric:tabular-nums;opacity:.7}
800
+ .dcs-questions{display:flex;flex-direction:column;gap:2px;padding:0 6px 6px}
770
801
  .dcs-question{width:100%;box-sizing:border-box;padding:6px 8px;border:0;border-radius:var(--dsw-radius-sm);background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;line-height:1.5;text-align:left;cursor:pointer;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
771
802
  .dcs-question:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
772
803
  .dcs-recent{display:flex;flex-wrap:wrap;gap:6px;padding:0 10px 4px}
@@ -1162,6 +1193,21 @@ window.__ModuleLoader__.load({
1162
1193
  return () => controller.abort()
1163
1194
  }, [focusSessionId])
1164
1195
 
1196
+ // The question list is live: a new prompt the user sends shows up without
1197
+ // reopening the panel. Cheap enough — the Host reads the in-memory log.
1198
+ React.useEffect(() => {
1199
+ if (typeof focusSessionId !== 'string' || focusSessionId.length === 0) return undefined
1200
+ const timer = setInterval(() => {
1201
+ const controller = new AbortController()
1202
+ fetchQuestions(focusSessionId, controller.signal).then((outcome) => {
1203
+ if (controller.signal.aborted) return
1204
+ setQuestions((current) => (current.length === outcome.questions.length ? current : outcome.questions))
1205
+ setQuestionCount(outcome.count)
1206
+ }).catch(() => {})
1207
+ }, 8000)
1208
+ return () => clearInterval(timer)
1209
+ }, [focusSessionId])
1210
+
1165
1211
  const trimmed = query.trim()
1166
1212
 
1167
1213
  React.useEffect(() => {
@@ -1378,6 +1424,9 @@ window.__ModuleLoader__.load({
1378
1424
  ? h('p', { className: 'dcs-detail-status' }, t('detail.missing'))
1379
1425
  : null,
1380
1426
  ),
1427
+ h('div', { className: 'dcs-foot' },
1428
+ h('span', { key: 'spacer' }, ''),
1429
+ h('span', { key: 'version', className: 'dcs-version' }, 'v' + PLUGIN_VERSION)),
1381
1430
  )
1382
1431
  }
1383
1432
 
@@ -1410,19 +1459,6 @@ window.__ModuleLoader__.load({
1410
1459
  },
1411
1460
  }, value))))
1412
1461
  }
1413
- if (questions.length > 0) {
1414
- body.push(h('p', { key: 'questions-title', className: 'dcs-section' },
1415
- t('questions.title', { n: questionCount })))
1416
- body.push(h('div', { key: 'questions', className: 'dcs-questions' }, questions.map((question, index) => h('button', {
1417
- key: String(question.seq) + ':' + index,
1418
- type: 'button',
1419
- className: 'dcs-question',
1420
- title: question.text,
1421
- onClick: () => {
1422
- revealText(focusSessionId, question.anchor, question.seq)
1423
- },
1424
- }, question.text))))
1425
- }
1426
1462
  } else if (phase === 'ready' && ordered.length === 0) {
1427
1463
  body.push(h('p', { key: 'empty', className: 'dcs-note' }, t('hint.empty')))
1428
1464
  } else {
@@ -1524,8 +1560,25 @@ window.__ModuleLoader__.load({
1524
1560
  onClick: () => setScope(value),
1525
1561
  }, t('scope.' + value)))),
1526
1562
  ),
1527
- h('div', { className: 'dcs-body', role: 'listbox', 'aria-label': t('field.label') }, body),
1528
- footer.length > 0 ? h('div', { className: 'dcs-foot' }, footer) : null,
1563
+ h('div', { className: 'dcs-results', role: 'listbox', 'aria-label': t('field.label') }, body),
1564
+ questions.length > 0
1565
+ ? h('div', { className: 'dcs-chat' },
1566
+ h('p', { className: 'dcs-section dcs-chat-head' }, t('questions.title', { n: questionCount })),
1567
+ h('div', { className: 'dcs-chat-list' }, questions.map((question, index) => {
1568
+ const hit = trimmed.length > 0 && matchesQuery(question.text, query)
1569
+ return h('button', {
1570
+ key: String(question.seq) + ':' + index,
1571
+ type: 'button',
1572
+ className: 'dcs-question',
1573
+ 'data-hit': hit ? 'true' : 'false',
1574
+ title: question.text,
1575
+ onClick: () => revealText(focusSessionId, question.anchor, question.seq),
1576
+ }, hit ? highlight(question.text, query, 'q' + index) : question.text)
1577
+ })))
1578
+ : null,
1579
+ h('div', { className: 'dcs-foot' },
1580
+ h('span', { key: 'hint' }, footer),
1581
+ h('span', { key: 'version', className: 'dcs-version' }, 'v' + PLUGIN_VERSION)),
1529
1582
  )
1530
1583
  }
1531
1584
  //#endregion
package/index.js CHANGED
@@ -64,7 +64,7 @@ const FUZZY_MAX_CHARS = 12
64
64
  /** Shortest query, in code points, still worth a fuzzy pass. */
65
65
  const FUZZY_MIN_CHARS = 4
66
66
 
67
- const VERSION = '0.23.0'
67
+ const VERSION = '0.24.0'
68
68
 
69
69
  //#region http helpers
70
70
  function writeJson(res, status, value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-content-search-ad",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
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",