dsh-plugin-marginalia 0.0.0-stage → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marginalia Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # Marginalia (`dsh-plugin-marginalia`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **旁注问 · Marginalia** — A DeepSeek Harness (DSH) right-sidebar plugin for asking side-channel questions about your active conversation or sending prompts directly to the main chat.
4
+
5
+ ## Features
6
+
7
+ - **Right-Sidebar Entry & Header Quick-Launch**: Adds a **Marginalia** entry to the right sidebar's Guide tab and a one-click icon button in the session header utilities bar (`conversation.session.header.utilities`).
8
+ - **Side-Ask Mode (旁注提问)**: Ask follow-up or clarifying questions using the active session's recent conversation context and model via a local Host SSE endpoint (`/api/marginalia/ask`), without interrupting or cluttering the main conversation thread.
9
+ - **Direct Main-Chat Mode (直发主对话)**: Switch to **To Main Chat** (or click **Send to main** on any message) to queue or steer a prompt directly into the main session.
10
+ - **Persistent Per-Session Thread**: Side-Ask history is saved per session in `localStorage`, with copy, clear, stop-streaming, and light/dark theme support using native `--dsw-alias-*` tokens.
11
+
12
+ ## Installation
13
+
14
+ ### From Local Directory (Development)
15
+ In DSH Web/Desktop: **Plugins** → **Add plugin** → select the `dsh-plugin-marginalia` directory.
16
+
17
+ ### From npm / DSH Plugin Market
18
+ ```bash
19
+ npm install dsh-plugin-marginalia
20
+ ```
21
+ Or install via a DSH Plugin Market index that lists `dsh-plugin-marginalia`.
22
+
23
+ ## Publishing to Marketplaces
24
+
25
+ 1. **npm Registry**:
26
+ ```bash
27
+ cd dsh-plugin-marginalia
28
+ npm publish --access public
29
+ ```
30
+ 2. **GitHub + DSH Plugin Market Index**:
31
+ - Push this directory to a public GitHub repository.
32
+ - Add the entry from `market-index.example.json` (with your repository URL, commit hash, and npm version) to any `dsh-plugin-market-index` v1 JSON feed.
package/client.js ADDED
@@ -0,0 +1,896 @@
1
+ window.__ModuleLoader__.load({
2
+ id: 'dsh-plugin-marginalia',
3
+ factory(require) {
4
+ const React = require('react');
5
+ const h = React.createElement;
6
+
7
+ const PLUGIN_ID = 'dsh-plugin-marginalia';
8
+ const TAB_KIND = 'marginalia';
9
+ const STORAGE_PREFIX = 'dsh.marginalia.v1.';
10
+ const MAX_STORED_MESSAGES = 40;
11
+
12
+ const en = {
13
+ 'tab.title': 'Marginalia',
14
+ 'guide.title': 'Marginalia',
15
+ 'guide.description': 'Ask side-channel questions about the main conversation',
16
+ 'header.tooltip': 'Ask Marginalia (Sidebar Q&A)',
17
+ 'mode.side': 'Side-Ask',
18
+ 'mode.main': 'To Main Chat',
19
+ 'context.on': 'With main context',
20
+ 'context.off': 'No main context',
21
+ 'clear': 'Clear',
22
+ 'empty.title': 'Ask anything without interrupting',
23
+ 'empty.subtitle.side': 'Side-Ask reads the main conversation context and answers here in the sidebar without cluttering the main thread.',
24
+ 'empty.subtitle.main': 'Send a prompt directly into the main conversation queue from the sidebar.',
25
+ 'chip.summarize': 'Summarize progress so far',
26
+ 'chip.explain': 'Explain the latest response',
27
+ 'chip.next': 'What should we do next?',
28
+ 'placeholder.side': 'Ask a side question about this conversation…',
29
+ 'placeholder.main': 'Send a message to the main conversation…',
30
+ 'send': 'Send',
31
+ 'stop': 'Stop',
32
+ 'copy': 'Copy',
33
+ 'copied': 'Copied',
34
+ 'promote': 'Send to main',
35
+ 'sentToMain': 'Sent to main conversation',
36
+ 'thinking': 'Thinking…',
37
+ 'error.noSession': 'Open or start a conversation first.',
38
+ 'error.sendFailed': 'Failed to send request',
39
+ 'hint.enter': 'Enter to send · Shift+Enter for newline',
40
+ };
41
+
42
+ const zh = {
43
+ 'tab.title': '旁注问',
44
+ 'guide.title': '旁注问 Marginalia',
45
+ 'guide.description': '在侧边栏向主对话提问,不打断主流程',
46
+ 'header.tooltip': '打开旁注问 (Marginalia)',
47
+ 'mode.side': '旁注提问',
48
+ 'mode.main': '直发主对话',
49
+ 'context.on': '携带主对话上下文',
50
+ 'context.off': '仅独立提问',
51
+ 'clear': '清空',
52
+ 'empty.title': '随时旁注提问,不打扰主对话',
53
+ 'empty.subtitle.side': '「旁注提问」会读取当前主对话上下文并在此处独立回答,不会污染或打断主对话。',
54
+ 'empty.subtitle.main': '「直发主对话」会将你的问题直接排队或插队发送到主会话中。',
55
+ 'chip.summarize': '总结目前为止的进展',
56
+ 'chip.explain': '解释一下刚才的回复',
57
+ 'chip.next': '接下来建议做什么?',
58
+ 'placeholder.side': '针对当前主对话提个旁注问题…',
59
+ 'placeholder.main': '直接发送消息到主对话…',
60
+ 'send': '发送',
61
+ 'stop': '停止',
62
+ 'copy': '复制',
63
+ 'copied': '已复制',
64
+ 'promote': '发到主对话',
65
+ 'sentToMain': '已发送到主对话',
66
+ 'thinking': '思考中…',
67
+ 'error.noSession': '请先打开或创建一个会话。',
68
+ 'error.sendFailed': '发送失败',
69
+ 'hint.enter': 'Enter 发送 · Shift+Enter 换行',
70
+ };
71
+
72
+ const CSS = `
73
+ .mg-header-btn {
74
+ display: inline-flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ width: 28px;
78
+ height: 28px;
79
+ padding: 0;
80
+ border: none;
81
+ border-radius: 8px;
82
+ background: transparent;
83
+ color: var(--dsw-alias-label-secondary);
84
+ cursor: pointer;
85
+ transition: background-color 0.15s ease, color 0.15s ease;
86
+ }
87
+ .mg-header-btn:hover {
88
+ background: var(--dsw-alias-bg-layer-2);
89
+ color: var(--dsw-alias-label-primary);
90
+ }
91
+ .mg-root {
92
+ display: flex;
93
+ flex-direction: column;
94
+ height: 100%;
95
+ min-height: 0;
96
+ background: var(--dsw-alias-bg-base);
97
+ color: var(--dsw-alias-label-primary);
98
+ font-size: 13px;
99
+ line-height: 1.5;
100
+ }
101
+ .mg-toolbar {
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: space-between;
105
+ gap: 8px;
106
+ padding: 10px 12px;
107
+ border-bottom: 1px solid var(--dsw-alias-border-l1);
108
+ flex-wrap: wrap;
109
+ }
110
+ .mg-seg {
111
+ display: inline-flex;
112
+ padding: 2px;
113
+ border-radius: 8px;
114
+ background: var(--dsw-alias-bg-layer-2);
115
+ border: 1px solid var(--dsw-alias-border-l1);
116
+ }
117
+ .mg-seg-btn {
118
+ border: none;
119
+ background: transparent;
120
+ color: var(--dsw-alias-label-secondary);
121
+ font-size: 12px;
122
+ font-weight: 500;
123
+ padding: 4px 10px;
124
+ border-radius: 6px;
125
+ cursor: pointer;
126
+ transition: background-color 0.15s ease, color 0.15s ease;
127
+ }
128
+ .mg-seg-btn.is-active {
129
+ background: var(--dsw-alias-bg-base);
130
+ color: var(--dsw-alias-label-primary);
131
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
132
+ }
133
+ .mg-toolbar-right {
134
+ display: inline-flex;
135
+ align-items: center;
136
+ gap: 6px;
137
+ }
138
+ .mg-pill-btn {
139
+ border: 1px solid var(--dsw-alias-border-l1);
140
+ background: var(--dsw-alias-bg-layer-1);
141
+ color: var(--dsw-alias-label-secondary);
142
+ font-size: 11.5px;
143
+ padding: 3px 8px;
144
+ border-radius: 999px;
145
+ cursor: pointer;
146
+ transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
147
+ }
148
+ .mg-pill-btn:hover {
149
+ border-color: var(--dsw-alias-border-l2);
150
+ color: var(--dsw-alias-label-primary);
151
+ }
152
+ .mg-pill-btn.is-on {
153
+ border-color: var(--dsw-alias-brand-primary);
154
+ color: var(--dsw-alias-brand-primary);
155
+ }
156
+ .mg-scroll {
157
+ flex: 1;
158
+ min-height: 0;
159
+ overflow-y: auto;
160
+ padding: 12px;
161
+ display: flex;
162
+ flex-direction: column;
163
+ gap: 10px;
164
+ }
165
+ .mg-empty {
166
+ margin: auto 0;
167
+ padding: 18px 12px;
168
+ text-align: center;
169
+ display: flex;
170
+ flex-direction: column;
171
+ align-items: center;
172
+ gap: 10px;
173
+ }
174
+ .mg-empty-title {
175
+ font-size: 14px;
176
+ font-weight: 600;
177
+ color: var(--dsw-alias-label-primary);
178
+ }
179
+ .mg-empty-sub {
180
+ font-size: 12px;
181
+ color: var(--dsw-alias-label-secondary);
182
+ max-width: 280px;
183
+ }
184
+ .mg-chips {
185
+ display: flex;
186
+ flex-wrap: wrap;
187
+ justify-content: center;
188
+ gap: 6px;
189
+ margin-top: 4px;
190
+ }
191
+ .mg-chip {
192
+ border: 1px solid var(--dsw-alias-border-l1);
193
+ background: var(--dsw-alias-bg-layer-1);
194
+ color: var(--dsw-alias-label-primary);
195
+ font-size: 12px;
196
+ padding: 5px 10px;
197
+ border-radius: 999px;
198
+ cursor: pointer;
199
+ transition: border-color 0.15s ease, background-color 0.15s ease;
200
+ }
201
+ .mg-chip:hover {
202
+ border-color: var(--dsw-alias-brand-primary);
203
+ background: var(--dsw-alias-bg-layer-2);
204
+ }
205
+ .mg-msg {
206
+ display: flex;
207
+ flex-direction: column;
208
+ gap: 4px;
209
+ }
210
+ .mg-msg.is-user {
211
+ align-items: flex-end;
212
+ }
213
+ .mg-msg.is-assistant {
214
+ align-items: flex-start;
215
+ }
216
+ .mg-bubble {
217
+ max-width: 92%;
218
+ padding: 8px 11px;
219
+ border-radius: 12px;
220
+ white-space: pre-wrap;
221
+ word-break: break-word;
222
+ }
223
+ .mg-msg.is-user .mg-bubble {
224
+ background: var(--dsw-alias-bg-layer-2);
225
+ border: 1px solid var(--dsw-alias-border-l1);
226
+ color: var(--dsw-alias-label-primary);
227
+ }
228
+ .mg-msg.is-assistant .mg-bubble {
229
+ background: var(--dsw-alias-bg-layer-1);
230
+ border: 1px solid var(--dsw-alias-border-l1);
231
+ color: var(--dsw-alias-label-primary);
232
+ }
233
+ .mg-msg.is-error .mg-bubble {
234
+ border-color: var(--dsw-alias-state-error-primary);
235
+ color: var(--dsw-alias-state-error-primary);
236
+ }
237
+ .mg-msg-meta {
238
+ display: flex;
239
+ align-items: center;
240
+ gap: 8px;
241
+ font-size: 11px;
242
+ color: var(--dsw-alias-label-secondary);
243
+ padding: 0 2px;
244
+ }
245
+ .mg-action-link {
246
+ border: none;
247
+ background: transparent;
248
+ color: var(--dsw-alias-label-secondary);
249
+ font-size: 11px;
250
+ padding: 0;
251
+ cursor: pointer;
252
+ }
253
+ .mg-action-link:hover {
254
+ color: var(--dsw-alias-brand-primary);
255
+ }
256
+ .mg-notice {
257
+ margin: 0 12px 6px;
258
+ padding: 6px 10px;
259
+ border-radius: 8px;
260
+ font-size: 12px;
261
+ background: var(--dsw-alias-bg-layer-2);
262
+ border: 1px solid var(--dsw-alias-border-l1);
263
+ color: var(--dsw-alias-state-success-primary);
264
+ }
265
+ .mg-notice.is-error {
266
+ color: var(--dsw-alias-state-error-primary);
267
+ border-color: var(--dsw-alias-state-error-primary);
268
+ }
269
+ .mg-header-btn:focus-visible,
270
+ .mg-seg-btn:focus-visible,
271
+ .mg-pill-btn:focus-visible,
272
+ .mg-chip:focus-visible,
273
+ .mg-action-link:focus-visible,
274
+ .mg-send-btn:focus-visible,
275
+ .mg-stop-btn:focus-visible {
276
+ outline: 2px solid var(--dsw-alias-brand-primary);
277
+ outline-offset: 1px;
278
+ }
279
+ .mg-composer {
280
+ padding: 10px 12px 12px;
281
+ border-top: 1px solid var(--dsw-alias-border-l1);
282
+ background: var(--dsw-alias-bg-base);
283
+ }
284
+ .mg-input-box {
285
+ display: flex;
286
+ flex-direction: column;
287
+ gap: 8px;
288
+ padding: 8px 10px;
289
+ border-radius: 12px;
290
+ border: 1px solid var(--dsw-alias-border-l1);
291
+ background: var(--dsw-alias-bg-layer-1);
292
+ }
293
+ .mg-input-box:focus-within {
294
+ border-color: var(--dsw-alias-brand-primary);
295
+ }
296
+ .mg-textarea {
297
+ width: 100%;
298
+ min-height: 44px;
299
+ max-height: 150px;
300
+ resize: none;
301
+ border: none;
302
+ outline: none;
303
+ background: transparent;
304
+ color: var(--dsw-alias-label-primary);
305
+ font-family: inherit;
306
+ font-size: 13px;
307
+ line-height: 1.45;
308
+ }
309
+ .mg-textarea::placeholder {
310
+ color: var(--dsw-alias-label-secondary);
311
+ }
312
+ .mg-composer-foot {
313
+ display: flex;
314
+ align-items: center;
315
+ justify-content: space-between;
316
+ gap: 8px;
317
+ }
318
+ .mg-hint {
319
+ font-size: 11px;
320
+ color: var(--dsw-alias-label-secondary);
321
+ }
322
+ .mg-send-btn {
323
+ border: none;
324
+ border-radius: 8px;
325
+ padding: 5px 12px;
326
+ font-size: 12px;
327
+ font-weight: 500;
328
+ cursor: pointer;
329
+ background: var(--dsw-alias-brand-primary);
330
+ color: #ffffff;
331
+ transition: opacity 0.15s ease;
332
+ }
333
+ .mg-send-btn:disabled {
334
+ opacity: 0.45;
335
+ cursor: not-allowed;
336
+ }
337
+ .mg-stop-btn {
338
+ border: 1px solid var(--dsw-alias-border-l2);
339
+ border-radius: 8px;
340
+ padding: 5px 12px;
341
+ font-size: 12px;
342
+ font-weight: 500;
343
+ cursor: pointer;
344
+ background: var(--dsw-alias-bg-layer-2);
345
+ color: var(--dsw-alias-label-primary);
346
+ }
347
+ `;
348
+
349
+ function MarginaliaGlyph(props) {
350
+ const size = props?.size || 16;
351
+ return h(
352
+ 'svg',
353
+ {
354
+ width: size,
355
+ height: size,
356
+ viewBox: '0 0 24 24',
357
+ fill: 'none',
358
+ stroke: 'currentColor',
359
+ strokeWidth: 1.8,
360
+ strokeLinecap: 'round',
361
+ strokeLinejoin: 'round',
362
+ className: props?.className,
363
+ 'aria-hidden': true,
364
+ },
365
+ h('rect', { x: 3.5, y: 4, width: 9.5, height: 16, rx: 2 }),
366
+ h('path', { d: 'M6.5 8.5h3.5M6.5 12h3.5M6.5 15.5h2' }),
367
+ h('path', { d: 'M14 7.5a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-1.8L15 17.5V15.5a1.5 1.5 0 0 1-1-1.4V7.5z' }),
368
+ );
369
+ }
370
+
371
+ function loadStoredMessages(sessionId) {
372
+ if (!sessionId) return [];
373
+ try {
374
+ const raw = window.localStorage.getItem(STORAGE_PREFIX + sessionId);
375
+ if (!raw) return [];
376
+ const parsed = JSON.parse(raw);
377
+ return Array.isArray(parsed) ? parsed : [];
378
+ } catch {
379
+ return [];
380
+ }
381
+ }
382
+
383
+ function saveStoredMessages(sessionId, messages) {
384
+ if (!sessionId) return;
385
+ try {
386
+ const compact = messages.slice(-MAX_STORED_MESSAGES).map((m) => ({
387
+ id: m.id,
388
+ role: m.role,
389
+ text: m.text,
390
+ model: m.model,
391
+ error: m.error,
392
+ }));
393
+ window.localStorage.setItem(STORAGE_PREFIX + sessionId, JSON.stringify(compact));
394
+ } catch {
395
+ // Ignore storage quota errors.
396
+ }
397
+ }
398
+
399
+ function makeId() {
400
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
401
+ return crypto.randomUUID();
402
+ }
403
+ return 'mg-' + Date.now() + '-' + Math.random().toString(36).slice(2, 8);
404
+ }
405
+
406
+ return {
407
+ inject: ['slots', 'locale', 'sidebarRight', 'sidebarRightTabs', 'remote'],
408
+ apply(ctx) {
409
+ ctx.effect(() => ctx.locale.register('marginalia', { en, zh }), 'marginalia: locale');
410
+ const t = ctx.locale.bind('marginalia');
411
+
412
+ ctx.effect(() => {
413
+ const styleEl = document.createElement('style');
414
+ styleEl.setAttribute('data-marginalia-styles', 'true');
415
+ styleEl.textContent = CSS;
416
+ document.head.appendChild(styleEl);
417
+ return () => {
418
+ styleEl.remove();
419
+ };
420
+ }, 'marginalia: styles');
421
+
422
+ ctx.effect(
423
+ () =>
424
+ ctx.sidebarRightTabs.register({
425
+ id: PLUGIN_ID,
426
+ kind: TAB_KIND,
427
+ priority: 'extension',
428
+ keepMounted: true,
429
+ title: () => t('tab.title'),
430
+ guide: [
431
+ {
432
+ id: 'open',
433
+ order: 45,
434
+ title: () => t('guide.title'),
435
+ description: () => t('guide.description'),
436
+ icon: MarginaliaGlyph,
437
+ },
438
+ ],
439
+ }),
440
+ 'marginalia: tab-type',
441
+ );
442
+
443
+ function HeaderTrigger() {
444
+ const [, setTick] = React.useState(0);
445
+ React.useEffect(() => ctx.locale.subscribe(() => setTick((v) => v + 1)), []);
446
+ const label = t('header.tooltip');
447
+ return h(
448
+ 'button',
449
+ {
450
+ type: 'button',
451
+ className: 'mg-header-btn',
452
+ title: label,
453
+ 'aria-label': label,
454
+ onClick: () => {
455
+ ctx.sidebarRight.openTab(TAB_KIND);
456
+ },
457
+ },
458
+ h(MarginaliaGlyph, { size: 16 }),
459
+ );
460
+ }
461
+
462
+ function MarginaliaBody(props) {
463
+ const sessionId = props?.sessionId;
464
+ const sessionStatus = typeof props?.useSessionStatus === 'function' ? props.useSessionStatus() : undefined;
465
+ const isMainRunning = Boolean(sessionStatus?.running);
466
+
467
+ const [, setLocaleTick] = React.useState(0);
468
+ React.useEffect(() => ctx.locale.subscribe(() => setLocaleTick((v) => v + 1)), []);
469
+
470
+ const [mode, setMode] = React.useState('side');
471
+ const [includeContext, setIncludeContext] = React.useState(true);
472
+ const [messages, setMessages] = React.useState(() => loadStoredMessages(sessionId));
473
+ const [draft, setDraft] = React.useState('');
474
+ const [streaming, setStreaming] = React.useState(false);
475
+ const [copiedId, setCopiedId] = React.useState(null);
476
+ const [notice, setNotice] = React.useState(null);
477
+
478
+ const abortRef = React.useRef(null);
479
+ const scrollRef = React.useRef(null);
480
+ const textareaRef = React.useRef(null);
481
+
482
+ React.useEffect(() => {
483
+ if (abortRef.current) {
484
+ abortRef.current.abort();
485
+ abortRef.current = null;
486
+ }
487
+ setStreaming(false);
488
+ setMessages(loadStoredMessages(sessionId));
489
+ }, [sessionId]);
490
+
491
+ React.useEffect(() => {
492
+ if (!streaming) {
493
+ saveStoredMessages(sessionId, messages);
494
+ }
495
+ }, [sessionId, messages, streaming]);
496
+
497
+ React.useEffect(() => {
498
+ if (scrollRef.current) {
499
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
500
+ }
501
+ }, [messages, streaming]);
502
+
503
+ React.useEffect(() => {
504
+ return () => {
505
+ if (abortRef.current) {
506
+ abortRef.current.abort();
507
+ abortRef.current = null;
508
+ }
509
+ };
510
+ }, []);
511
+
512
+ function showNotice(text, isError) {
513
+ const entry = { text, isError: Boolean(isError) };
514
+ setNotice(entry);
515
+ window.setTimeout(() => {
516
+ setNotice((curr) => (curr === entry ? null : curr));
517
+ }, 2400);
518
+ }
519
+
520
+ async function sendToMainChat(text) {
521
+ const trimmed = text.trim();
522
+ if (!trimmed) return;
523
+ if (!sessionId) {
524
+ showNotice(t('error.noSession'), true);
525
+ return;
526
+ }
527
+ const promptFn = ctx.remote?.session?.prompt;
528
+ if (typeof promptFn !== 'function') {
529
+ showNotice(t('error.sendFailed'), true);
530
+ return;
531
+ }
532
+ try {
533
+ await promptFn({
534
+ requestId: makeId(),
535
+ sessionId,
536
+ mode: isMainRunning ? 'steer' : 'queue',
537
+ content: [{ type: 'text', text: trimmed }],
538
+ });
539
+ showNotice(t('sentToMain'), false);
540
+ } catch (err) {
541
+ const msg = err instanceof Error ? err.message : String(err);
542
+ showNotice(msg || t('error.sendFailed'), true);
543
+ }
544
+ }
545
+
546
+ async function handleSubmit(overrideText) {
547
+ const text = (typeof overrideText === 'string' ? overrideText : draft).trim();
548
+ if (!text || streaming) return;
549
+
550
+ if (mode === 'main') {
551
+ setDraft('');
552
+ await sendToMainChat(text);
553
+ return;
554
+ }
555
+
556
+ if (!overrideText) setDraft('');
557
+ const userMsg = { id: makeId(), role: 'user', text };
558
+ const assistantId = makeId();
559
+ const assistantMsg = { id: assistantId, role: 'assistant', text: '' };
560
+
561
+ const priorHistory = messages
562
+ .filter((m) => !m.error && m.text)
563
+ .map((m) => ({ role: m.role, text: m.text }));
564
+
565
+ setMessages((prev) => [...prev, userMsg, assistantMsg]);
566
+ setStreaming(true);
567
+
568
+ const controller = new AbortController();
569
+ abortRef.current = controller;
570
+
571
+ try {
572
+ const res = await fetch('/api/marginalia/ask', {
573
+ method: 'POST',
574
+ credentials: 'same-origin',
575
+ headers: { 'Content-Type': 'application/json' },
576
+ body: JSON.stringify({
577
+ sessionId: sessionId || '',
578
+ question: text,
579
+ includeContext,
580
+ history: priorHistory,
581
+ }),
582
+ signal: controller.signal,
583
+ });
584
+
585
+ if (!res.ok || !res.body) {
586
+ let errMsg = t('error.sendFailed');
587
+ try {
588
+ const errJson = await res.json();
589
+ if (errJson?.error) errMsg = errJson.error;
590
+ } catch {
591
+ // Ignore JSON parse failure.
592
+ }
593
+ setMessages((prev) =>
594
+ prev.map((m) => (m.id === assistantId ? { ...m, text: errMsg, error: true } : m)),
595
+ );
596
+ return;
597
+ }
598
+
599
+ const reader = res.body.getReader();
600
+ const decoder = new TextDecoder();
601
+ let buffer = '';
602
+ let modelLabel = '';
603
+
604
+ while (true) {
605
+ const { done, value } = await reader.read();
606
+ if (done) break;
607
+ buffer += decoder.decode(value, { stream: true });
608
+ const frames = buffer.split('\n\n');
609
+ buffer = frames.pop() || '';
610
+ for (const frame of frames) {
611
+ const line = frame.trim();
612
+ if (!line.startsWith('data:')) continue;
613
+ const jsonText = line.slice(5).trim();
614
+ if (!jsonText) continue;
615
+ let ev;
616
+ try {
617
+ ev = JSON.parse(jsonText);
618
+ } catch {
619
+ continue;
620
+ }
621
+ if (ev.type === 'meta' && ev.model) {
622
+ modelLabel = ev.model;
623
+ } else if (ev.type === 'delta' && ev.text) {
624
+ setMessages((prev) =>
625
+ prev.map((m) =>
626
+ m.id === assistantId
627
+ ? { ...m, text: m.text + ev.text, model: modelLabel || m.model }
628
+ : m,
629
+ ),
630
+ );
631
+ } else if (ev.type === 'error') {
632
+ setMessages((prev) =>
633
+ prev.map((m) =>
634
+ m.id === assistantId
635
+ ? { ...m, text: ev.message || t('error.sendFailed'), error: true }
636
+ : m,
637
+ ),
638
+ );
639
+ }
640
+ }
641
+ }
642
+ } catch (err) {
643
+ if (!controller.signal.aborted) {
644
+ const msg = err instanceof Error ? err.message : String(err);
645
+ setMessages((prev) =>
646
+ prev.map((m) =>
647
+ m.id === assistantId ? { ...m, text: msg || t('error.sendFailed'), error: true } : m,
648
+ ),
649
+ );
650
+ }
651
+ } finally {
652
+ abortRef.current = null;
653
+ setStreaming(false);
654
+ setMessages((prev) => prev.filter((m) => !(m.id === assistantId && !m.text)));
655
+ }
656
+ }
657
+
658
+ function handleStop() {
659
+ if (abortRef.current) {
660
+ abortRef.current.abort();
661
+ abortRef.current = null;
662
+ }
663
+ setStreaming(false);
664
+ setMessages((prev) => prev.filter((m) => !(m.role === 'assistant' && !m.text)));
665
+ }
666
+
667
+ function handleCopy(msg) {
668
+ if (!msg?.text || !navigator.clipboard) return;
669
+ navigator.clipboard.writeText(msg.text).then(() => {
670
+ setCopiedId(msg.id);
671
+ window.setTimeout(() => {
672
+ setCopiedId((curr) => (curr === msg.id ? null : curr));
673
+ }, 1600);
674
+ }).catch(() => {});
675
+ }
676
+
677
+ const chips = [t('chip.summarize'), t('chip.explain'), t('chip.next')];
678
+
679
+ return h(
680
+ 'div',
681
+ { className: 'mg-root' },
682
+ h(
683
+ 'div',
684
+ { className: 'mg-toolbar' },
685
+ h(
686
+ 'div',
687
+ { className: 'mg-seg', role: 'tablist' },
688
+ h(
689
+ 'button',
690
+ {
691
+ type: 'button',
692
+ role: 'tab',
693
+ 'aria-selected': mode === 'side',
694
+ className: 'mg-seg-btn' + (mode === 'side' ? ' is-active' : ''),
695
+ onClick: () => setMode('side'),
696
+ },
697
+ t('mode.side'),
698
+ ),
699
+ h(
700
+ 'button',
701
+ {
702
+ type: 'button',
703
+ role: 'tab',
704
+ 'aria-selected': mode === 'main',
705
+ className: 'mg-seg-btn' + (mode === 'main' ? ' is-active' : ''),
706
+ onClick: () => setMode('main'),
707
+ },
708
+ t('mode.main'),
709
+ ),
710
+ ),
711
+ h(
712
+ 'div',
713
+ { className: 'mg-toolbar-right' },
714
+ mode === 'side'
715
+ ? h(
716
+ 'button',
717
+ {
718
+ type: 'button',
719
+ className: 'mg-pill-btn' + (includeContext ? ' is-on' : ''),
720
+ onClick: () => setIncludeContext((v) => !v),
721
+ },
722
+ includeContext ? t('context.on') : t('context.off'),
723
+ )
724
+ : null,
725
+ messages.length > 0 && !streaming
726
+ ? h(
727
+ 'button',
728
+ {
729
+ type: 'button',
730
+ className: 'mg-pill-btn',
731
+ onClick: () => {
732
+ setMessages([]);
733
+ saveStoredMessages(sessionId, []);
734
+ },
735
+ },
736
+ t('clear'),
737
+ )
738
+ : null,
739
+ ),
740
+ ),
741
+ h(
742
+ 'div',
743
+ { className: 'mg-scroll', ref: scrollRef },
744
+ messages.length === 0
745
+ ? h(
746
+ 'div',
747
+ { className: 'mg-empty' },
748
+ h('div', { className: 'mg-empty-title' }, t('empty.title')),
749
+ h(
750
+ 'div',
751
+ { className: 'mg-empty-sub' },
752
+ mode === 'side' ? t('empty.subtitle.side') : t('empty.subtitle.main'),
753
+ ),
754
+ mode === 'side'
755
+ ? h(
756
+ 'div',
757
+ { className: 'mg-chips' },
758
+ chips.map((chip) =>
759
+ h(
760
+ 'button',
761
+ {
762
+ key: chip,
763
+ type: 'button',
764
+ className: 'mg-chip',
765
+ onClick: () => handleSubmit(chip),
766
+ },
767
+ chip,
768
+ ),
769
+ ),
770
+ )
771
+ : null,
772
+ )
773
+ : messages.map((msg) =>
774
+ h(
775
+ 'div',
776
+ {
777
+ key: msg.id,
778
+ className:
779
+ 'mg-msg ' +
780
+ (msg.role === 'user' ? 'is-user' : 'is-assistant') +
781
+ (msg.error ? ' is-error' : ''),
782
+ },
783
+ h(
784
+ 'div',
785
+ { className: 'mg-bubble' },
786
+ msg.text || (streaming && msg.role === 'assistant' ? t('thinking') : ''),
787
+ ),
788
+ msg.text
789
+ ? h(
790
+ 'div',
791
+ { className: 'mg-msg-meta' },
792
+ msg.model ? h('span', null, msg.model) : null,
793
+ h(
794
+ 'button',
795
+ {
796
+ type: 'button',
797
+ className: 'mg-action-link',
798
+ onClick: () => handleCopy(msg),
799
+ },
800
+ copiedId === msg.id ? t('copied') : t('copy'),
801
+ ),
802
+ !msg.error
803
+ ? h(
804
+ 'button',
805
+ {
806
+ type: 'button',
807
+ className: 'mg-action-link',
808
+ onClick: () => sendToMainChat(msg.text),
809
+ },
810
+ t('promote'),
811
+ )
812
+ : null,
813
+ )
814
+ : null,
815
+ ),
816
+ ),
817
+ ),
818
+ notice
819
+ ? h('div', { className: 'mg-notice' + (notice.isError ? ' is-error' : '') }, notice.text)
820
+ : null,
821
+ h(
822
+ 'div',
823
+ { className: 'mg-composer' },
824
+ h(
825
+ 'div',
826
+ { className: 'mg-input-box' },
827
+ h('textarea', {
828
+ ref: textareaRef,
829
+ className: 'mg-textarea',
830
+ value: draft,
831
+ placeholder: mode === 'side' ? t('placeholder.side') : t('placeholder.main'),
832
+ onChange: (e) => setDraft(e.target.value),
833
+ onKeyDown: (e) => {
834
+ if (e.nativeEvent?.isComposing || e.isComposing) return;
835
+ if (e.key === 'Enter' && !e.shiftKey) {
836
+ e.preventDefault();
837
+ handleSubmit();
838
+ }
839
+ },
840
+ }),
841
+ h(
842
+ 'div',
843
+ { className: 'mg-composer-foot' },
844
+ h('span', { className: 'mg-hint' }, t('hint.enter')),
845
+ streaming
846
+ ? h(
847
+ 'button',
848
+ {
849
+ type: 'button',
850
+ className: 'mg-stop-btn',
851
+ onClick: handleStop,
852
+ },
853
+ t('stop'),
854
+ )
855
+ : h(
856
+ 'button',
857
+ {
858
+ type: 'button',
859
+ className: 'mg-send-btn',
860
+ disabled: !draft.trim(),
861
+ onClick: () => handleSubmit(),
862
+ },
863
+ t('send'),
864
+ ),
865
+ ),
866
+ ),
867
+ ),
868
+ );
869
+ }
870
+
871
+ ctx.slots.inject('sidebar.right.pane.tab', () =>
872
+ ctx.slots.register(
873
+ {
874
+ name: 'sidebar.right.pane.tab',
875
+ key: PLUGIN_ID,
876
+ locale: 'marginalia',
877
+ },
878
+ MarginaliaBody,
879
+ ),
880
+ );
881
+
882
+ ctx.slots.inject('conversation.session.header.utilities', () =>
883
+ ctx.slots.register(
884
+ {
885
+ name: 'conversation.session.header.utilities',
886
+ id: 'marginalia-trigger',
887
+ order: 20,
888
+ label: () => t('header.tooltip'),
889
+ },
890
+ HeaderTrigger,
891
+ ),
892
+ );
893
+ },
894
+ };
895
+ },
896
+ });
@@ -0,0 +1,4 @@
1
+ - insert:
2
+ - id: marginalia
3
+ name: dsh-plugin-marginalia
4
+ config: {}
package/icon.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">
2
+ <rect x="6" y="7" width="14" height="22" rx="3" stroke="#5B7CFA" stroke-width="2.2" />
3
+ <path d="M9.5 12.5H16.5M9.5 17H15M9.5 21.5H13.5" stroke="#5B7CFA" stroke-width="2" stroke-linecap="round" />
4
+ <path d="M21 10.5C21 9.11929 22.1193 8 23.5 8H28.5C29.8807 8 31 9.11929 31 10.5V19.5C31 20.8807 29.8807 22 28.5 22H25.2L22 24.8V22H23.5C22.1193 22 21 20.8807 21 19.5V10.5Z" fill="#3B82F6" fill-opacity="0.16" stroke="#3B82F6" stroke-width="2" stroke-linejoin="round" />
5
+ <path d="M26 12.2L26.7 13.8L28.3 14.5L26.7 15.2L26 16.8L25.3 15.2L23.7 14.5L25.3 13.8L26 12.2Z" fill="#3B82F6" />
6
+ </svg>
package/index.js ADDED
@@ -0,0 +1,260 @@
1
+ /**
2
+ * Host plugin for Marginalia: exposes an authenticated SSE endpoint `/api/marginalia/ask`
3
+ * that answers side-channel questions using the active session's conversation context
4
+ * and configured model without mutating the main session log.
5
+ */
6
+
7
+ export const inject = ['connection', 'sessions', 'llm', 'agentDefaultModel'];
8
+
9
+ const MAX_CONTEXT_MESSAGES = 24;
10
+ const MAX_CONTEXT_CHARS = 24000;
11
+ const MAX_HISTORY_TURNS = 12;
12
+
13
+ function extractBlockText(blocks) {
14
+ if (!Array.isArray(blocks)) return '';
15
+ const parts = [];
16
+ for (const block of blocks) {
17
+ if (!block || typeof block !== 'object') continue;
18
+ if (block.type === 'text' && typeof block.text === 'string') {
19
+ parts.push(block.text);
20
+ } else if (block.type === 'tool-call' && typeof block.name === 'string') {
21
+ parts.push(`[Tool call: ${block.name}]`);
22
+ } else if (block.type === 'image') {
23
+ parts.push('[Image]');
24
+ } else if (block.type === 'file' && block.attachment?.name) {
25
+ parts.push(`[File: ${block.attachment.name}]`);
26
+ }
27
+ }
28
+ return parts.join('\n').trim();
29
+ }
30
+
31
+ function formatMessagesTranscript(messages) {
32
+ const lines = [];
33
+ const slice = messages.slice(-MAX_CONTEXT_MESSAGES);
34
+ for (const msg of slice) {
35
+ if (!msg || typeof msg !== 'object') continue;
36
+ if (msg.role === 'user') {
37
+ const text = extractBlockText(msg.content);
38
+ if (text) lines.push(`User: ${text}`);
39
+ } else if (msg.role === 'assistant') {
40
+ const text = extractBlockText(msg.content);
41
+ if (text) lines.push(`Assistant: ${text}`);
42
+ } else if (msg.role === 'tool') {
43
+ const text = extractBlockText(msg.content);
44
+ if (text) {
45
+ const clipped = text.length > 600 ? `${text.slice(0, 600)}…` : text;
46
+ lines.push(`ToolResult: ${clipped}`);
47
+ }
48
+ }
49
+ }
50
+ let joined = lines.join('\n\n');
51
+ if (joined.length > MAX_CONTEXT_CHARS) {
52
+ joined = '…(earlier messages omitted)…\n\n' + joined.slice(-MAX_CONTEXT_CHARS);
53
+ }
54
+ return joined;
55
+ }
56
+
57
+ function formatColdRecordsTranscript(records) {
58
+ const lines = [];
59
+ for (const rec of records) {
60
+ const ev = rec?.event;
61
+ if (!ev || typeof ev !== 'object') continue;
62
+ if (ev.type === 'user/message') {
63
+ const text = extractBlockText(ev.data?.content);
64
+ if (text) lines.push(`User: ${text}`);
65
+ } else if (ev.type === 'assistant/message') {
66
+ const text = extractBlockText(ev.data?.message?.content);
67
+ if (text) lines.push(`Assistant: ${text}`);
68
+ }
69
+ }
70
+ let joined = lines.join('\n\n');
71
+ if (joined.length > MAX_CONTEXT_CHARS) {
72
+ joined = '…(earlier messages omitted)…\n\n' + joined.slice(-MAX_CONTEXT_CHARS);
73
+ }
74
+ return joined;
75
+ }
76
+
77
+ function sseLine(payload) {
78
+ return `data: ${JSON.stringify(payload)}\n\n`;
79
+ }
80
+
81
+ export function apply(ctx) {
82
+ ctx.effect(() => {
83
+ const disposeRoute = ctx.connection.fetch.register({
84
+ path: '/api/marginalia/ask',
85
+ methods: ['POST'],
86
+ requestBody: 'buffered',
87
+ async fetch(request) {
88
+ let body;
89
+ try {
90
+ body = await request.json();
91
+ } catch {
92
+ return Response.json({ error: 'Invalid JSON request body' }, { status: 400 });
93
+ }
94
+
95
+ const sessionId = typeof body?.sessionId === 'string' ? body.sessionId.trim() : '';
96
+ const question = typeof body?.question === 'string' ? body.question.trim() : '';
97
+ const includeContext = body?.includeContext !== false;
98
+ const rawHistory = Array.isArray(body?.history) ? body.history : [];
99
+
100
+ if (!question) {
101
+ return Response.json({ error: 'Question is required' }, { status: 400 });
102
+ }
103
+
104
+ let transcript = '';
105
+ let modelConfig;
106
+
107
+ if (sessionId) {
108
+ const liveSession = ctx.sessions.get(sessionId);
109
+ if (liveSession) {
110
+ modelConfig = liveSession.requestHeader()?.config;
111
+ if (includeContext) {
112
+ transcript = formatMessagesTranscript(liveSession.deriveMessages());
113
+ }
114
+ } else if (includeContext) {
115
+ const sc = ctx.get('sessionController');
116
+ if (sc && typeof sc.events === 'function') {
117
+ try {
118
+ const page = await sc.events(
119
+ { address: { kind: 'session', sessionId }, maxMessages: MAX_CONTEXT_MESSAGES },
120
+ request.signal,
121
+ );
122
+ if (Array.isArray(page?.records)) {
123
+ transcript = formatColdRecordsTranscript(page.records);
124
+ }
125
+ } catch {
126
+ // Best effort; proceed without transcript if cold read fails.
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ if (!modelConfig?.provider || !modelConfig?.model) {
133
+ modelConfig = ctx.agentDefaultModel.currentSelection();
134
+ }
135
+
136
+ if (!modelConfig?.provider || !modelConfig?.model) {
137
+ return Response.json(
138
+ { error: 'No active model configured. Select or configure a model first.' },
139
+ { status: 400 },
140
+ );
141
+ }
142
+
143
+ const systemParts = [
144
+ 'You are Marginalia, a concise side-channel Q&A assistant docked in the right sidebar of DeepSeek Harness.',
145
+ 'The user is asking a side question about their ongoing main conversation without wanting to interrupt or clutter the main thread.',
146
+ 'Answer clearly, directly, and in the same language as the user\'s question.',
147
+ ];
148
+ if (includeContext && transcript) {
149
+ systemParts.push(
150
+ 'Here is the recent transcript of the main conversation for reference:\n\n<main_conversation>\n' +
151
+ transcript +
152
+ '\n</main_conversation>',
153
+ );
154
+ } else if (includeContext) {
155
+ systemParts.push('The main conversation currently has no messages yet.');
156
+ }
157
+
158
+ const messages = [];
159
+ for (const item of rawHistory.slice(-MAX_HISTORY_TURNS)) {
160
+ if (!item || typeof item !== 'object') continue;
161
+ const role = item.role === 'assistant' ? 'assistant' : item.role === 'user' ? 'user' : null;
162
+ const text = typeof item.text === 'string' ? item.text.trim() : '';
163
+ if (!role || !text) continue;
164
+ messages.push({
165
+ role,
166
+ content: [{ type: 'text', text }],
167
+ });
168
+ }
169
+ messages.push({
170
+ role: 'user',
171
+ content: [{ type: 'text', text: question }],
172
+ });
173
+
174
+ let prepared;
175
+ try {
176
+ prepared = await ctx.llm.prepareCall(
177
+ {
178
+ provider: modelConfig.provider,
179
+ model: modelConfig.model,
180
+ ...(modelConfig.reasoningEffort ? { reasoningEffort: modelConfig.reasoningEffort } : {}),
181
+ },
182
+ request.signal,
183
+ );
184
+ } catch (err) {
185
+ const message = err instanceof Error ? err.message : String(err);
186
+ return Response.json({ error: message || 'Failed to prepare model call' }, { status: 500 });
187
+ }
188
+
189
+ const encoder = new TextEncoder();
190
+ const stream = new ReadableStream({
191
+ async start(controller) {
192
+ const send = (obj) => {
193
+ try {
194
+ controller.enqueue(encoder.encode(sseLine(obj)));
195
+ } catch {
196
+ // Stream already closed.
197
+ }
198
+ };
199
+ send({
200
+ type: 'meta',
201
+ provider: prepared.config.provider,
202
+ model: prepared.config.model,
203
+ hasContext: Boolean(transcript),
204
+ });
205
+ try {
206
+ const chunks = prepared.stream({
207
+ provider: prepared.config.provider,
208
+ model: prepared.config.model,
209
+ ...(prepared.config.reasoningEffort ? { reasoningEffort: prepared.config.reasoningEffort } : {}),
210
+ system: systemParts.join('\n\n'),
211
+ messages,
212
+ signal: request.signal,
213
+ });
214
+ for await (const chunk of chunks) {
215
+ if (request.signal.aborted) break;
216
+ if (chunk.type === 'text-delta' && chunk.text) {
217
+ send({ type: 'delta', text: chunk.text });
218
+ } else if (chunk.type === 'reasoning-delta' && chunk.text) {
219
+ send({ type: 'reasoning', text: chunk.text });
220
+ } else if (chunk.type === 'finish') {
221
+ if (chunk.reason?.kind === 'error') {
222
+ send({
223
+ type: 'error',
224
+ message: chunk.reason.failure?.message || 'Model stream error',
225
+ });
226
+ }
227
+ }
228
+ }
229
+ send({ type: 'done' });
230
+ } catch (err) {
231
+ if (!request.signal.aborted) {
232
+ const message = err instanceof Error ? err.message : String(err);
233
+ send({ type: 'error', message: message || 'Stream failed' });
234
+ }
235
+ } finally {
236
+ try {
237
+ controller.close();
238
+ } catch {
239
+ // Ignore double close.
240
+ }
241
+ }
242
+ },
243
+ });
244
+
245
+ return new Response(stream, {
246
+ status: 200,
247
+ headers: {
248
+ 'Content-Type': 'text/event-stream; charset=utf-8',
249
+ 'Cache-Control': 'no-cache, no-transform',
250
+ 'X-Accel-Buffering': 'no',
251
+ },
252
+ });
253
+ },
254
+ });
255
+
256
+ return () => {
257
+ void disposeRoute();
258
+ };
259
+ }, 'dsh-plugin-marginalia: route');
260
+ }
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Marginalia",
4
+ "description": "Ask side-channel questions about the active conversation from the right sidebar without interrupting or cluttering the main thread, or send a prompt directly to the main chat. Open Marginalia from the header utility button in any session or from the right sidebar's Guide tab. Side-Ask queries use the session's current model and recent conversation context via the local Host; disabling the plugin removes the sidebar tab, header button, and local endpoint."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "旁注问 (Marginalia)",
4
+ "description": "在右侧边栏中随时向主对话提问:支持「旁注提问」(基于当前主对话上下文和模型进行独立问答,不打断也不污染主对话)以及「直发主对话」(将问题直接排队或插队发送到主会话)。可在任意会话顶部右侧工具栏点击 Marginalia 图标,或在右侧边栏导航页打开。停用插件后将移除侧边栏标签页、顶栏入口与本地问答接口。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "dsh-plugin-marginalia",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Marginalia: Ask side-channel questions about the main conversation or send prompts directly from the right sidebar.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/yangdw2024/dsh-plugin-marginalia.git"
10
+ },
11
+ "homepage": "https://github.com/yangdw2024/dsh-plugin-marginalia#readme",
12
+ "keywords": [
13
+ "deepseek-harness",
14
+ "dsh-plugin",
15
+ "dsh-bundle",
16
+ "sidebar",
17
+ "marginalia",
18
+ "qa"
19
+ ],
20
+ "engines": {
21
+ "dsh": ">=0.2.0"
22
+ },
23
+ "exports": {
24
+ ".": "./index.js",
25
+ "./client": "./client.js",
26
+ "./locale/*.json": "./locale/*.json",
27
+ "./icon": "./icon.svg"
28
+ },
29
+ "files": [
30
+ "index.js",
31
+ "client.js",
32
+ "cordis.patch.yml",
33
+ "locale/*.json",
34
+ "icon.svg",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "dsh": {
39
+ "bundle": {
40
+ "patch": "./cordis.patch.yml"
41
+ },
42
+ "client": {
43
+ "platform": "web",
44
+ "immediately": true,
45
+ "inject": [
46
+ "@deepseek-ai/dsh-client-ui-sidebar-right",
47
+ "@deepseek-ai/dsh-client-ui-conversation",
48
+ "@deepseek-ai/dsh-client-locale",
49
+ "@deepseek-ai/dsh-api-session-controller"
50
+ ]
51
+ }
52
+ }
53
+ }