@wwwfz/dsh-agent-bridge 0.8.2 → 0.9.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/README.md +105 -91
- package/THIRD_PARTY_NOTICES.md +67 -0
- package/package.json +2 -2
- package/src/assets.js +70 -13
- package/src/catalog.js +328 -27
- package/src/client.js +317 -4
- package/src/export.js +238 -9
- package/src/index.js +24 -0
- package/src/projects.js +232 -23
- package/src/session-import.js +14 -0
- package/src/session-trace.js +121 -0
- package/src/skill-handoff.js +1327 -0
- package/src/skill-package.js +417 -0
- package/src/skill-provider.js +249 -0
- package/web/markdown.js +225 -0
- package/web/panel.css +111 -6
- package/web/panel.html +32 -1
- package/web/panel.js +819 -44
- package/web/vendor/markdown-it-LICENSE.txt +156 -0
- package/web/vendor/markdown-it.mjs +3064 -0
package/web/markdown.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import MarkdownIt from './vendor/markdown-it.mjs'
|
|
2
|
+
|
|
3
|
+
const maxNesting = 48
|
|
4
|
+
const parser = new MarkdownIt({ html: false, linkify: true, maxNesting })
|
|
5
|
+
parser.linkify.set({ fuzzyLink: false, fuzzyEmail: false })
|
|
6
|
+
// Destinations are handled by the DOM renderer below, never by an HTML renderer.
|
|
7
|
+
// Retain the label even when a destination is disallowed.
|
|
8
|
+
parser.validateLink = () => true
|
|
9
|
+
|
|
10
|
+
// The bundled parser validates inline and reference-style syntax. Capture the
|
|
11
|
+
// consumed span there rather than searching the rendered labels or destinations.
|
|
12
|
+
for (const [name, type] of [['link', 'link_open'], ['image', 'image']]) {
|
|
13
|
+
const { fn, alt } = parser.inline.ruler.__rules__.find(rule => rule.name === name)
|
|
14
|
+
const isLink = name === 'link'
|
|
15
|
+
parser.inline.ruler.at(name, (state, silent) => {
|
|
16
|
+
if (silent || !state.env.captureLinks) return fn(state, silent)
|
|
17
|
+
const start = state.pos
|
|
18
|
+
const index = state.tokens.length
|
|
19
|
+
if (!fn(state, false)) return false
|
|
20
|
+
const token = state.tokens.slice(index).find(token => token.type === type)
|
|
21
|
+
if (token) {
|
|
22
|
+
const bracket = isLink ? start : start + 1
|
|
23
|
+
const labelEnd = state.md.helpers.parseLinkLabel(state, bracket, isLink) + 1
|
|
24
|
+
token.meta = { ...token.meta, span: { start, bracket, labelEnd, end: state.pos } }
|
|
25
|
+
}
|
|
26
|
+
return true
|
|
27
|
+
}, { alt })
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const referenceRule = parser.block.ruler.__rules__.find(rule => rule.name === 'reference')
|
|
31
|
+
const parseReference = referenceRule.fn
|
|
32
|
+
parser.block.ruler.at('reference', (state, start, end, silent) => {
|
|
33
|
+
if (!parseReference(state, start, end, silent)) return false
|
|
34
|
+
if (!silent && state.env.captureLinks) {
|
|
35
|
+
for (let line = start; line < state.line; line++) {
|
|
36
|
+
const position = state.bMarks[line] + state.tShift[line]
|
|
37
|
+
const column = position - state.src.lastIndexOf('\n', position - 1) - 1
|
|
38
|
+
state.env.definitionLines.push({ line, column })
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return true
|
|
42
|
+
}, { alt: referenceRule.alt })
|
|
43
|
+
|
|
44
|
+
const externalHref = /^(?:https?:\/\/|mailto:)[^\s\u0000-\u001f]+$/i
|
|
45
|
+
const markdownLimit = 96 * 1024
|
|
46
|
+
|
|
47
|
+
export const isMarkdownFile = file => typeof file === 'string' && /\.(?:md|markdown|mdx)$/i.test(file)
|
|
48
|
+
export const isRelativeReference = href => Boolean(href && !/^(?:[/?#\\]|[a-z][a-z\d+.-]*:)/i.test(href))
|
|
49
|
+
|
|
50
|
+
export function parseMarkdown(source) {
|
|
51
|
+
return parser.parse(source.slice(0, markdownLimit), {})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function relativeMarkdownLinks(source) {
|
|
55
|
+
return [...new Set(parseMarkdown(source).flatMap(token => (token.children ?? [])
|
|
56
|
+
.filter(child => child.type === 'link_open')
|
|
57
|
+
.map(child => child.attrGet('href'))
|
|
58
|
+
.filter(isRelativeReference)))]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function sourceLines(source) {
|
|
62
|
+
let offset = 0
|
|
63
|
+
return source.split(/(\r\n|\r|\n)/).flatMap((part, index) => {
|
|
64
|
+
const start = offset
|
|
65
|
+
offset += part.length
|
|
66
|
+
return index % 2 ? [] : [{ text: part, start }]
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Paragraphs and headings retain a line map even inside quotes and lists. In
|
|
71
|
+
// tables the row has the line map, and the block parser removes escapes on pipes.
|
|
72
|
+
function tableLine(line) {
|
|
73
|
+
const offsets = []
|
|
74
|
+
let text = ''
|
|
75
|
+
for (let index = 0; index < line.text.length; index++) {
|
|
76
|
+
offsets.push(line.start + index)
|
|
77
|
+
if (line.text[index] === '\\' && line.text[index + 1] === '|') index++
|
|
78
|
+
text += line.text[index]
|
|
79
|
+
}
|
|
80
|
+
offsets.push(line.start + line.text.length)
|
|
81
|
+
return { text, offsets }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function inlinePositions(content, lines, first, table) {
|
|
85
|
+
const positions = []
|
|
86
|
+
const pieces = content.split('\n')
|
|
87
|
+
for (const [index, piece] of pieces.entries()) {
|
|
88
|
+
const line = table ?? lines[first + index]
|
|
89
|
+
if (!line) return undefined
|
|
90
|
+
// Indentation can contain spaces inserted by Markdown-it to expand a tab.
|
|
91
|
+
const body = piece.trimStart()
|
|
92
|
+
const column = line.text.indexOf(body, table?.column ?? 0)
|
|
93
|
+
if (column < 0) return undefined
|
|
94
|
+
const indent = piece.length - body.length
|
|
95
|
+
for (let index = 0; index <= piece.length; index++) {
|
|
96
|
+
const position = column + Math.max(0, index - indent)
|
|
97
|
+
positions.push(line.offsets ? line.offsets[position] : line.start + position)
|
|
98
|
+
}
|
|
99
|
+
if (table) table.column = column + body.length
|
|
100
|
+
}
|
|
101
|
+
return positions
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function markdownExportSpans(source) {
|
|
105
|
+
const lines = sourceLines(source)
|
|
106
|
+
const env = { captureLinks: true, definitionLines: [] }
|
|
107
|
+
const tokens = parser.parse(source.slice(0, markdownLimit), env)
|
|
108
|
+
const links = []
|
|
109
|
+
// Leave original line endings and surrounding list/quote prefixes.
|
|
110
|
+
const definitions = env.definitionLines.map(({ line, column }) => ({
|
|
111
|
+
start: lines[line].start + column, end: lines[line].start + lines[line].text.length,
|
|
112
|
+
}))
|
|
113
|
+
let table
|
|
114
|
+
for (const token of tokens) {
|
|
115
|
+
if (token.type === 'tr_open') table = { ...tableLine(lines[token.map[0]]), column: 0 }
|
|
116
|
+
if (token.type === 'tr_close') table = undefined
|
|
117
|
+
if (token.type !== 'inline' || (!token.map && !table)) continue
|
|
118
|
+
const positions = inlinePositions(token.content, lines, token.map?.[0], table)
|
|
119
|
+
if (!positions) continue
|
|
120
|
+
for (const child of token.children) {
|
|
121
|
+
const span = child.meta?.span
|
|
122
|
+
if (!span) continue
|
|
123
|
+
const href = child.attrGet(child.type === 'image' ? 'src' : 'href')
|
|
124
|
+
const relative = child.type === 'link_open' && isRelativeReference(href)
|
|
125
|
+
if (!relative && !child.meta.label) continue
|
|
126
|
+
const start = positions[span.start]
|
|
127
|
+
const labelEnd = positions[span.labelEnd]
|
|
128
|
+
const end = positions[span.end]
|
|
129
|
+
if (source[positions[span.bracket]] === '[' && source[labelEnd - 1] === ']' && end >= labelEnd) {
|
|
130
|
+
links.push({ start, labelEnd, end, href, relative, title: child.attrGet('title') })
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { links, definitions }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const classes = {
|
|
138
|
+
paragraph: 'md-paragraph', heading: 'md-heading', bullet_list: 'md-list', ordered_list: 'md-list',
|
|
139
|
+
blockquote: 'md-quote', table: 'md-table',
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function renderMarkdown(source, document = globalThis.document, referenceLink) {
|
|
143
|
+
const fragment = document.createDocumentFragment()
|
|
144
|
+
const stack = [fragment]
|
|
145
|
+
const element = (tag, className, content) => {
|
|
146
|
+
const node = document.createElement(tag)
|
|
147
|
+
if (className) node.className = className
|
|
148
|
+
if (content !== undefined) node.textContent = content
|
|
149
|
+
return node
|
|
150
|
+
}
|
|
151
|
+
function render(tokens) {
|
|
152
|
+
for (const token of tokens) {
|
|
153
|
+
if (token.hidden) continue
|
|
154
|
+
const parent = stack.at(-1)
|
|
155
|
+
if (token.nesting === -1) {
|
|
156
|
+
stack.pop()
|
|
157
|
+
continue
|
|
158
|
+
}
|
|
159
|
+
if (token.nesting === 1) {
|
|
160
|
+
const type = token.type.slice(0, -5)
|
|
161
|
+
let node
|
|
162
|
+
if (type === 'link') {
|
|
163
|
+
const href = token.attrGet('href')
|
|
164
|
+
if (externalHref.test(href)) {
|
|
165
|
+
node = element('a', 'md-link')
|
|
166
|
+
node.setAttribute('href', href)
|
|
167
|
+
node.setAttribute('target', '_blank')
|
|
168
|
+
node.setAttribute('rel', 'noopener noreferrer')
|
|
169
|
+
} else if (referenceLink && isRelativeReference(href)) {
|
|
170
|
+
const reference = referenceLink(href)
|
|
171
|
+
if (reference) {
|
|
172
|
+
parent.append(reference.container)
|
|
173
|
+
stack.push(reference.label)
|
|
174
|
+
continue
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
const tag = type === 'heading' ? `h${Math.min(6, Number(token.tag[1]) + 1)}` : token.tag
|
|
179
|
+
node = element(tag, classes[type])
|
|
180
|
+
const start = token.attrGet('start')
|
|
181
|
+
if (start && /^\d+$/.test(start)) node.setAttribute('start', start)
|
|
182
|
+
const alignment = /^text-align:(left|center|right)$/.exec(token.attrGet('style'))
|
|
183
|
+
if (alignment) node.className = `md-align-${alignment[1]}`
|
|
184
|
+
}
|
|
185
|
+
if (!node) {
|
|
186
|
+
stack.push(parent)
|
|
187
|
+
continue
|
|
188
|
+
}
|
|
189
|
+
if (type === 'table') {
|
|
190
|
+
const wrap = element('div', 'md-table-wrap')
|
|
191
|
+
wrap.append(node)
|
|
192
|
+
parent.append(wrap)
|
|
193
|
+
} else parent.append(node)
|
|
194
|
+
stack.push(node)
|
|
195
|
+
continue
|
|
196
|
+
}
|
|
197
|
+
if (token.type === 'inline') {
|
|
198
|
+
const first = token.children?.[0]
|
|
199
|
+
const task = stack.findLast(node => node.tagName?.toLowerCase() === 'li')
|
|
200
|
+
const marker = task && first?.type === 'text' && /^\[([ xX])\]\s+/.exec(first.content)
|
|
201
|
+
if (marker && !task.className) {
|
|
202
|
+
task.className = 'md-task'
|
|
203
|
+
const box = element('span', 'md-task-box', marker[1] === ' ' ? '☐' : '☑')
|
|
204
|
+
parent.append(box)
|
|
205
|
+
render([{ ...first, content: first.content.slice(marker[0].length) }, ...token.children.slice(1)])
|
|
206
|
+
} else if (token.children) render(token.children)
|
|
207
|
+
} else if (token.type === 'text') parent.append(document.createTextNode(token.content))
|
|
208
|
+
else if (token.type === 'code_inline') parent.append(element('code', 'md-code', token.content))
|
|
209
|
+
else if (token.type === 'fence' || token.type === 'code_block') {
|
|
210
|
+
const pre = element('pre', 'md-block')
|
|
211
|
+
const language = /^[\w+-]+/.exec(token.info.trim())?.[0]
|
|
212
|
+
pre.append(element('code', language ? `language-${language}` : '', token.content))
|
|
213
|
+
parent.append(pre)
|
|
214
|
+
} else if (token.type === 'hardbreak') parent.append(element('br'))
|
|
215
|
+
else if (token.type === 'softbreak') parent.append(document.createTextNode('\n'))
|
|
216
|
+
else if (token.type === 'hr') parent.append(element('hr', 'md-rule'))
|
|
217
|
+
else if (token.type === 'image') parent.append(element('span', 'md-image', token.content))
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const tokens = parseMarkdown(source)
|
|
221
|
+
if (tokens.some(token => token.level >= maxNesting - 1)) {
|
|
222
|
+
fragment.append(element('p', 'md-paragraph', source.slice(0, markdownLimit)))
|
|
223
|
+
} else render(tokens)
|
|
224
|
+
return fragment
|
|
225
|
+
}
|
package/web/panel.css
CHANGED
|
@@ -362,7 +362,7 @@ details[open] > summary .disclosure-chevron { transform: rotate(90deg); }
|
|
|
362
362
|
.global-note { padding: 3px 9px 5px; }
|
|
363
363
|
.global-library .asset-list { margin: 0 5px 5px; max-block-size: min(37dvh, 345px); }
|
|
364
364
|
.asset-row {
|
|
365
|
-
display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap:
|
|
365
|
+
display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 5px; min-block-size: 47px; padding: 5px 7px;
|
|
366
366
|
border: 1px solid transparent; border-block-end-color: var(--line); border-radius: 8px;
|
|
367
367
|
transition: background var(--quick) var(--ease), border-color var(--quick) var(--ease);
|
|
368
368
|
}
|
|
@@ -379,6 +379,33 @@ details[open] > summary .disclosure-chevron { transform: rotate(90deg); }
|
|
|
379
379
|
.selection-feedback { padding-inline: 4px; font-size: .8rem; }
|
|
380
380
|
.asset-view { flex: none; font-size: .78rem; }
|
|
381
381
|
.asset-view .icon { inline-size: 13px; block-size: 13px; }
|
|
382
|
+
.asset-open { min-block-size: 25px; min-inline-size: 25px; padding: 3px; background: transparent; color: var(--muted); }
|
|
383
|
+
.asset-open:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
|
|
384
|
+
.asset-open .icon { inline-size: 14px; block-size: 14px; }
|
|
385
|
+
.skill-status { display: inline-flex; align-items: center; padding: 1px 6px; border: 1px solid var(--line); border-radius: 999px; font-size: .7rem; }
|
|
386
|
+
.skill-status[data-state='callable'], .skill-status[data-state='native'], .skill-status[data-state='active'] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
|
|
387
|
+
.skill-status[data-state='enable'], .skill-status[data-state='available'], .skill-status[data-state='pending'] { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }
|
|
388
|
+
.skill-status[data-state='handoff'] { color: var(--muted); }
|
|
389
|
+
.skill-status[data-state='unverified'] { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }
|
|
390
|
+
.skill-status[data-state='disabled'] { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
|
|
391
|
+
.asset-status-note { inline-size: 100%; color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }
|
|
392
|
+
.skill-choice-panel { display: grid; gap: 7px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
|
|
393
|
+
.skill-choice-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
|
|
394
|
+
.skill-choice-heading strong { font-size: .84rem; }
|
|
395
|
+
.skill-choice-heading span { color: var(--muted); font-size: .74rem; }
|
|
396
|
+
.skill-choice-list { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
397
|
+
.skill-choice { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
|
|
398
|
+
.skill-choice:has(input:checked) { border-color: var(--selected-line); background: var(--selected); }
|
|
399
|
+
.skill-choice:has(input:disabled) { color: var(--muted); }
|
|
400
|
+
.skill-choice input { margin: 0; inline-size: 14px; block-size: 14px; accent-color: var(--primary); }
|
|
401
|
+
.skill-choice-text { display: grid; gap: 1px; min-width: 0; }
|
|
402
|
+
.skill-choice-name { font-size: .8rem; font-weight: 650; overflow-wrap: anywhere; }
|
|
403
|
+
.skill-choice-note { color: var(--muted); font-size: .7rem; overflow-wrap: anywhere; }
|
|
404
|
+
.skill-manager { display: grid; gap: 10px; }
|
|
405
|
+
.skill-manager-meta { display: grid; gap: 5px; }
|
|
406
|
+
.skill-manager-meta div { display: flex; gap: 8px; font-size: .78rem; }
|
|
407
|
+
.skill-manager-meta span { flex: none; color: var(--muted); }
|
|
408
|
+
.skill-manager-meta code { min-width: 0; overflow-wrap: anywhere; }
|
|
382
409
|
|
|
383
410
|
.draft-actions { display: flex; align-items: flex-start; gap: 7px; }
|
|
384
411
|
.handoff { flex: 1; }
|
|
@@ -394,7 +421,7 @@ details[open] > summary .disclosure-chevron { transform: rotate(90deg); }
|
|
|
394
421
|
.queue-empty { padding: 4px 3px; }
|
|
395
422
|
.history { display: flex; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; }
|
|
396
423
|
|
|
397
|
-
.primary, .secondary, .icon-button, .clear-search, .path-copy, .queue-remove, .asset-view {
|
|
424
|
+
.primary, .secondary, .icon-button, .clear-search, .path-copy, .path-open, .queue-remove, .asset-view, .asset-open {
|
|
398
425
|
display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-inline-size: 0; border: 1px solid transparent; border-radius: 8px;
|
|
399
426
|
transition: color var(--quick) var(--ease), background var(--quick) var(--ease), border-color var(--quick) var(--ease), transform var(--quick) var(--ease);
|
|
400
427
|
}
|
|
@@ -404,15 +431,17 @@ details[open] > summary .disclosure-chevron { transform: rotate(90deg); }
|
|
|
404
431
|
.secondary { border-color: var(--line); background: var(--paper); color: var(--ink); }
|
|
405
432
|
.secondary:hover:not(:disabled) { border-color: var(--line-strong); background: var(--hover); }
|
|
406
433
|
.primary:active:not(:disabled), .secondary:active:not(:disabled), .icon-button:active:not(:disabled) { transform: translateY(1px); }
|
|
407
|
-
.icon-button, .clear-search, .path-copy, .queue-remove, .asset-view { min-block-size: 29px; min-inline-size: 29px; padding: 4px; background: transparent; color: var(--muted); }
|
|
408
|
-
.icon-button:hover:not(:disabled), .clear-search:hover, .path-copy:hover, .asset-view:hover { background: var(--hover); color: var(--ink); }
|
|
434
|
+
.icon-button, .clear-search, .path-copy, .path-open, .queue-remove, .asset-view, .asset-open { min-block-size: 29px; min-inline-size: 29px; padding: 4px; background: transparent; color: var(--muted); }
|
|
435
|
+
.icon-button:hover:not(:disabled), .clear-search:hover, .path-copy:hover, .path-open:hover:not(:disabled), .asset-view:hover, .asset-open:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
|
|
409
436
|
.secondary.icon-button { min-block-size: 34px; min-inline-size: 34px; border-color: var(--line); background: var(--paper); }
|
|
410
437
|
.secondary.icon-button:hover:not(:disabled) { border-color: var(--line-strong); background: var(--hover); }
|
|
411
438
|
.clear-search { min-block-size: 25px; min-inline-size: 25px; }
|
|
412
439
|
.path-copy { min-block-size: 25px; min-inline-size: 25px; }
|
|
440
|
+
.path-open { min-block-size: 25px; padding: 3px 7px; font-size: .74rem; color: var(--muted); }
|
|
441
|
+
.path-open .icon { inline-size: 13px; block-size: 13px; }
|
|
413
442
|
.queue-remove { min-block-size: 23px; min-inline-size: 23px; padding: 3px; color: var(--muted); }
|
|
414
443
|
.queue-remove:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
|
|
415
|
-
.button-icon, .path-copy .icon, .queue-remove .icon { inline-size: 14px; block-size: 14px; }
|
|
444
|
+
.button-icon, .path-copy .icon, .path-open .icon, .queue-remove .icon { inline-size: 14px; block-size: 14px; }
|
|
416
445
|
|
|
417
446
|
dialog {
|
|
418
447
|
position: fixed; inset: 0 0 0 auto; margin: 0; width: min(555px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; padding: 0;
|
|
@@ -437,6 +466,10 @@ pre {
|
|
|
437
466
|
border: 1px solid var(--line); border-radius: 9px; background: var(--field); font: .82rem/1.65 var(--mono);
|
|
438
467
|
}
|
|
439
468
|
.dialog-text[data-format='handoff'] { display: grid; gap: 12px; min-width: 0; }
|
|
469
|
+
.dialog-text[data-format='markdown'] {
|
|
470
|
+
padding: 16px 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper);
|
|
471
|
+
font-size: .9rem; line-height: 1.75; overflow-wrap: anywhere;
|
|
472
|
+
}
|
|
440
473
|
.history-choice { display: grid; gap: 8px; }
|
|
441
474
|
.history-choice .conversation-row { border-color: var(--line); }
|
|
442
475
|
.history-choice .conversation-row:hover { border-color: var(--selected-line); }
|
|
@@ -450,24 +483,92 @@ pre {
|
|
|
450
483
|
.history-message[data-role='user'] { background: var(--field); }
|
|
451
484
|
.history-message .preview-body { margin-block-start: 4px; }
|
|
452
485
|
.history-message h3 { color: var(--accent); font-size: .78rem; }
|
|
486
|
+
.source-stats { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); }
|
|
487
|
+
.source-stats h3 { font-size: .86rem; font-weight: 650; }
|
|
488
|
+
.source-stats-grid {
|
|
489
|
+
display: grid; grid-template-columns: repeat(auto-fit, minmax(min(104px, 100%), 1fr));
|
|
490
|
+
gap: 8px 12px; margin: 7px 0 0;
|
|
491
|
+
}
|
|
492
|
+
.source-stats-grid dt, .source-stats p { color: var(--muted); font-size: .76rem; }
|
|
493
|
+
.source-stats-grid dd { margin: 0; font-size: 1.06rem; font-weight: 620; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
|
|
494
|
+
.source-stats p { margin-block-start: 6px; }
|
|
495
|
+
.trace-disclosure { margin-block-start: 8px; border-block-start: 1px dashed var(--line); padding-block-start: 7px; }
|
|
496
|
+
.trace-disclosure > summary { color: var(--muted); font-size: .78rem; cursor: pointer; }
|
|
497
|
+
.trace-disclosure > summary:hover { color: var(--ink); }
|
|
498
|
+
.trace-list { display: grid; gap: 6px; margin-block-start: 7px; }
|
|
499
|
+
.trace-turn-list > .trace-disclosure { margin-block-start: 0; border-block-start-style: solid; }
|
|
500
|
+
.trace-turn-list > .trace-disclosure > summary { padding-block-end: 4px; color: var(--ink); }
|
|
501
|
+
.trace-item { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
|
|
502
|
+
.trace-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: .76rem; }
|
|
503
|
+
.trace-kind { color: var(--accent); font-weight: 600; }
|
|
504
|
+
.trace-name { font-size: .74rem; overflow-wrap: anywhere; }
|
|
505
|
+
.trace-time { color: var(--muted); }
|
|
506
|
+
.trace-state { padding: 1px 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .72rem; }
|
|
507
|
+
.trace-state[data-state='missing'], .trace-state[data-state='pending'] { color: var(--amber); }
|
|
508
|
+
.trace-state[data-state='error'] { color: var(--danger); }
|
|
509
|
+
.trace-text { margin-block-start: 5px; max-block-size: 34dvh; overflow: auto; font-size: .82rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
510
|
+
.trace-empty { color: var(--muted); font-style: italic; }
|
|
511
|
+
.trace-copy { margin-block-start: 6px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--muted); font-size: .74rem; }
|
|
512
|
+
.trace-copy:hover { background: var(--hover); color: var(--ink); }
|
|
453
513
|
.preview-intro, .preview-section { padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; }
|
|
454
514
|
.preview-intro { background: var(--field); }
|
|
455
515
|
.preview-lead { margin-bottom: 8px; font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
|
|
456
516
|
.preview-meta { display: flex; align-items: baseline; gap: 7px; color: var(--muted); font-size: .76rem; }
|
|
457
517
|
.preview-meta > span { flex: none; }
|
|
458
518
|
.preview-meta code { min-width: 0; overflow-wrap: anywhere; }
|
|
519
|
+
.preview-meta .path-actions { margin-inline-start: auto; }
|
|
520
|
+
.path-actions { display: inline-flex; align-items: center; gap: 2px; flex: none; }
|
|
521
|
+
.preview-source-row { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 5px; }
|
|
522
|
+
.preview-source-row .preview-source { flex: 1; margin-top: 0; }
|
|
459
523
|
.preview-context { margin-top: 8px; color: var(--muted); font-size: .84rem; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
460
524
|
.preview-section h3 { font-size: .96rem; line-height: 1.4; overflow-wrap: anywhere; }
|
|
461
525
|
.preview-source { display: block; margin-top: 5px; color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
|
|
462
526
|
.preview-body { margin-top: 8px; font-size: .88rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
527
|
+
.preview-body[data-format='markdown'] { white-space: normal; }
|
|
528
|
+
|
|
529
|
+
.dialog-text[data-format='markdown'] > :first-child, .preview-body[data-format='markdown'] > :first-child { margin-block-start: 0; }
|
|
530
|
+
.dialog-text[data-format='markdown'] > :last-child, .preview-body[data-format='markdown'] > :last-child { margin-block-end: 0; }
|
|
531
|
+
.md-heading { margin-block: 1.35em .55em; line-height: 1.3; letter-spacing: -.02em; font-weight: 660; overflow-wrap: anywhere; }
|
|
532
|
+
h2.md-heading { font-size: 1.3rem; }
|
|
533
|
+
h3.md-heading { font-size: 1.1rem; }
|
|
534
|
+
h4.md-heading { font-size: 1rem; }
|
|
535
|
+
h5.md-heading, h6.md-heading { font-size: .93rem; color: var(--muted); letter-spacing: 0; }
|
|
536
|
+
.dialog-text[data-format='markdown'] > .md-heading:first-child { margin-block-start: 0; }
|
|
537
|
+
.md-paragraph { margin-block: .7em; }
|
|
538
|
+
.md-list { margin-block: .7em; padding-inline-start: 1.45em; }
|
|
539
|
+
.md-list .md-list { margin-block: .25em; }
|
|
540
|
+
.md-list li { margin-block: .28em; padding-inline-start: .15em; }
|
|
541
|
+
.md-list li::marker { color: var(--muted); }
|
|
542
|
+
.md-task { list-style: none; margin-inline-start: -1.25em; }
|
|
543
|
+
.md-task-box { margin-inline-end: .45em; color: var(--accent); }
|
|
544
|
+
.md-quote { margin-block: .8em; padding: .1em 0 .1em .95em; border-inline-start: 3px solid var(--line-strong); color: var(--muted); }
|
|
545
|
+
.md-quote > .md-paragraph { margin-block: .45em; }
|
|
546
|
+
.md-rule { margin-block: 1.15em; border: 0; border-block-start: 1px solid var(--line); }
|
|
547
|
+
.md-block { margin-block: .8em; padding: 11px 13px; font-size: .82rem; line-height: 1.62; }
|
|
548
|
+
.md-code { padding: .1em .35em; border: 1px solid var(--line); border-radius: 5px; background: var(--field); font-size: .86em; }
|
|
549
|
+
.md-link { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; overflow-wrap: anywhere; }
|
|
550
|
+
.md-link:hover { text-decoration-color: currentColor; }
|
|
551
|
+
.md-reference-open { border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer; }
|
|
552
|
+
.md-reference .path-copy { vertical-align: middle; margin-inline-start: .2em; }
|
|
553
|
+
.md-image { color: var(--muted); font-size: .84em; }
|
|
554
|
+
.md-table-wrap { margin-block: .85em; max-inline-size: 100%; overflow-x: auto; }
|
|
555
|
+
.md-table { border-collapse: collapse; inline-size: 100%; font-size: .84rem; }
|
|
556
|
+
.md-table th, .md-table td { padding: 6px 9px; border: 1px solid var(--line); text-align: start; vertical-align: top; }
|
|
557
|
+
.md-table th { background: var(--field); font-weight: 620; }
|
|
558
|
+
.md-table .md-align-center { text-align: center; }
|
|
559
|
+
.md-table .md-align-right { text-align: end; }
|
|
463
560
|
.session-choice { display: grid; gap: 7px; margin-block: 12px; }
|
|
464
561
|
.session-choice p { overflow-wrap: anywhere; }
|
|
562
|
+
#session-source-record:empty { display: none; }
|
|
465
563
|
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; border-block-start: 1px solid var(--line); background: var(--paper); }
|
|
466
564
|
.dialog-actions:not(:has(> :not([hidden]))) { display: none; }
|
|
467
565
|
.export-output { margin-block-start: 10px; }
|
|
468
566
|
.export-output summary { color: var(--muted); cursor: pointer; }
|
|
469
567
|
.export-output pre { margin-block-start: 7px; max-block-size: 38dvh; }
|
|
470
|
-
|
|
568
|
+
.export-trace-option { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: auto; color: var(--muted); font-size: .78rem; cursor: pointer; }
|
|
569
|
+
.export-trace-option input { margin: 0; inline-size: 14px; block-size: 14px; accent-color: var(--primary); }
|
|
570
|
+
#dialog-status, #activate-status { margin-block-start: 10px; color: var(--muted); overflow-wrap: anywhere; }
|
|
571
|
+
#dialog-status:empty, #activate-status:empty { display: none; }
|
|
471
572
|
|
|
472
573
|
@media (max-width: 1059px) {
|
|
473
574
|
.workspace { grid-template-columns: minmax(214px, 240px) minmax(0, 1fr); }
|
|
@@ -490,6 +591,10 @@ pre {
|
|
|
490
591
|
.draft-intro .field { flex: auto; }
|
|
491
592
|
.draft-actions { flex-direction: column; align-items: stretch; }
|
|
492
593
|
.draft-actions .primary { align-self: flex-end; }
|
|
594
|
+
.preview-meta { flex-wrap: wrap; }
|
|
595
|
+
.preview-meta .path-actions { margin-inline-start: 0; }
|
|
596
|
+
.path-open > span { display: none; }
|
|
597
|
+
.path-open { min-inline-size: 25px; }
|
|
493
598
|
}
|
|
494
599
|
@media (max-width: 385px) {
|
|
495
600
|
.asset-row { gap: 5px; padding-inline: 4px; }
|
package/web/panel.html
CHANGED
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
</div>
|
|
127
127
|
<div class="project-location">
|
|
128
128
|
<code id="project-path"></code>
|
|
129
|
+
<button id="open-path" class="path-open" type="button" aria-label="在 DSH 中打开工作目录" title="在 DSH 中打开工作目录"><svg class="icon" aria-hidden="true"><use href="#icon-folder"/></svg><span>打开</span></button>
|
|
129
130
|
<button id="copy-path" class="path-copy icon-button" type="button" aria-label="复制工作目录" title="复制工作目录"><svg class="icon" aria-hidden="true"><use href="#icon-copy"/></svg></button>
|
|
130
131
|
</div>
|
|
131
132
|
</header>
|
|
@@ -226,6 +227,7 @@
|
|
|
226
227
|
<label for="session-select">选择要导出的 DSH 会话</label>
|
|
227
228
|
<select id="session-select"></select>
|
|
228
229
|
<p id="session-path" class="muted"></p>
|
|
230
|
+
<div id="session-source-record"></div>
|
|
229
231
|
</div>
|
|
230
232
|
<p id="dialog-status" role="status"></p>
|
|
231
233
|
<details id="export-output" class="export-output" hidden>
|
|
@@ -234,13 +236,42 @@
|
|
|
234
236
|
</details>
|
|
235
237
|
</div>
|
|
236
238
|
<footer class="dialog-actions">
|
|
239
|
+
<label id="export-trace-option" class="export-trace-option" hidden>
|
|
240
|
+
<input type="checkbox" id="export-trace">
|
|
241
|
+
<span>附带来源记录(工具名与结果摘录)</span>
|
|
242
|
+
</label>
|
|
237
243
|
<a id="export-download" class="secondary" download hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg>下载 Markdown</a>
|
|
238
|
-
<button id="export" class="secondary" type="button" hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg
|
|
244
|
+
<button id="export" class="secondary" type="button" hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg>导出本机版</button>
|
|
245
|
+
<button id="export-share" class="secondary" type="button" hidden><svg class="icon button-icon" aria-hidden="true"><use href="#icon-download"/></svg>导出分享版</button>
|
|
239
246
|
<button id="recover-draft" class="secondary" type="button" hidden>打开已创建的会话</button>
|
|
247
|
+
<button id="skill-undo" class="secondary" type="button" hidden>恢复上一版</button>
|
|
248
|
+
<button id="skill-deactivate" class="secondary" type="button" hidden>停用技能</button>
|
|
249
|
+
<button id="skill-apply" class="primary" type="button" hidden><span id="skill-apply-label">启用技能</span><svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
240
250
|
<button id="history-import" class="primary" type="button" hidden><span id="history-import-label">迁入并继续</span><svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
241
251
|
<button id="import" class="primary" type="button" hidden>打开新对话<svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
242
252
|
</footer>
|
|
243
253
|
</div>
|
|
244
254
|
</dialog>
|
|
255
|
+
|
|
256
|
+
<dialog id="activate-dialog" aria-labelledby="activate-title">
|
|
257
|
+
<div class="dialog-inner">
|
|
258
|
+
<header class="dialog-heading">
|
|
259
|
+
<span class="project-mark"><svg class="icon" aria-hidden="true"><use href="#icon-skill"/></svg></span>
|
|
260
|
+
<div>
|
|
261
|
+
<h2 id="activate-title">确认启用技能</h2>
|
|
262
|
+
<p id="activate-note" class="muted">核对来源、项目范围和脚本后再继续。</p>
|
|
263
|
+
</div>
|
|
264
|
+
<button id="activate-close" class="secondary icon-button" type="button" aria-label="关闭" title="关闭"><svg class="icon" aria-hidden="true"><use href="#icon-close"/></svg></button>
|
|
265
|
+
</header>
|
|
266
|
+
<div class="dialog-content">
|
|
267
|
+
<div id="activate-body" class="dialog-text" data-format="handoff" tabindex="0"></div>
|
|
268
|
+
<p id="activate-status" role="status"></p>
|
|
269
|
+
</div>
|
|
270
|
+
<footer class="dialog-actions">
|
|
271
|
+
<button id="activate-text" class="secondary" type="button">仅文字继续</button>
|
|
272
|
+
<button id="activate-confirm" class="primary" type="button">确认启用并继续<svg class="icon button-icon" aria-hidden="true"><use href="#icon-arrow"/></svg></button>
|
|
273
|
+
</footer>
|
|
274
|
+
</div>
|
|
275
|
+
</dialog>
|
|
245
276
|
</body>
|
|
246
277
|
</html>
|