@hyprnos/dsh-remote-plugin 0.0.0-stage → 0.8.8
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.en.md +61 -0
- package/README.md +60 -2
- package/apk/dsh-remote.apk +0 -0
- package/approval-summary.mjs +115 -0
- package/client.js +197 -0
- package/cordis.patch.yml +5 -0
- package/doctor-skill.mjs +99 -0
- package/doctor-target.mjs +24 -0
- package/file-delivery.mjs +84 -0
- package/gateway-stats.cjs +501 -0
- package/gateway.cjs +8451 -0
- package/index.mjs +1784 -0
- package/insights.mjs +111 -0
- package/market.mjs +86 -0
- package/package.json +71 -4
- package/peak-reminders.mjs +50 -0
- package/plugin-center.mjs +777 -0
- package/plugin-transaction.mjs +300 -0
- package/public/activity.js +188 -0
- package/public/admin.html +820 -0
- package/public/admin.js +1167 -0
- package/public/announcement-forms.js +89 -0
- package/public/announcements.json +464 -0
- package/public/app.js +8826 -0
- package/public/approval-records.js +301 -0
- package/public/approval-summary.js +78 -0
- package/public/build.json +5 -0
- package/public/cache-upgrade.js +51 -0
- package/public/chat-copy.js +59 -0
- package/public/chat-files.js +87 -0
- package/public/desktop/desktop.css +816 -0
- package/public/desktop/desktop.html +871 -0
- package/public/desktop/desktop.js +4548 -0
- package/public/desktop/i18n.js +85 -0
- package/public/diagnostics.js +203 -0
- package/public/doctor-entry.js +94 -0
- package/public/doctor.css +205 -0
- package/public/doctor.js +769 -0
- package/public/donate.png +0 -0
- package/public/e2ee-transport.js +219 -0
- package/public/extensions.css +109 -0
- package/public/extensions.js +215 -0
- package/public/file-inbox.css +66 -0
- package/public/file-inbox.js +289 -0
- package/public/genui.css +8 -0
- package/public/genui.js +254 -0
- package/public/history.js +304 -0
- package/public/i18n.js +57 -0
- package/public/icon.svg +12 -0
- package/public/image-cache.js +141 -0
- package/public/image-preview.js +290 -0
- package/public/index.html +1548 -0
- package/public/insights.css +28 -0
- package/public/insights.js +290 -0
- package/public/jsqr.min.js +10104 -0
- package/public/lan-discovery.js +94 -0
- package/public/link-check.js +109 -0
- package/public/manifest.webmanifest +16 -0
- package/public/md.js +333 -0
- package/public/morphicons-init.js +41 -0
- package/public/motion.js +557 -0
- package/public/network.js +100 -0
- package/public/onboarding.css +36 -0
- package/public/onboarding.js +253 -0
- package/public/operations.js +141 -0
- package/public/permission-presets.js +159 -0
- package/public/plugin-center.css +120 -0
- package/public/plugin-center.js +666 -0
- package/public/plugin-icon.svg +5 -0
- package/public/plugin.html +68 -0
- package/public/plugin.js +211 -0
- package/public/qrcode.min.js +2297 -0
- package/public/relay-autopair.js +251 -0
- package/public/relay-devices.js +80 -0
- package/public/relay-settings.css +24 -0
- package/public/relay-settings.js +194 -0
- package/public/remote-state.js +27 -0
- package/public/remote-ui.css +148 -0
- package/public/remote-ui.js +243 -0
- package/public/session-deck.css +79 -0
- package/public/session-deck.js +180 -0
- package/public/session-presets.js +47 -0
- package/public/setup.css +18 -0
- package/public/setup.js +213 -0
- package/public/sha256.js +119 -0
- package/public/skills.css +81 -0
- package/public/skills.js +202 -0
- package/public/skins/blue-fish/DESIGN.md +24 -0
- package/public/skins/blue-fish/face.png +0 -0
- package/public/skins/blue-fish/icon-blush.png +0 -0
- package/public/skins/blue-fish/icon-sleep.png +0 -0
- package/public/skins/blue-fish/icon-smile.png +0 -0
- package/public/skins/blue-fish/icon-star.png +0 -0
- package/public/skins/blue-fish/icon-wink.png +0 -0
- package/public/skins/blue-fish/icon.png +0 -0
- package/public/skins/blue-fish/mascot.png +0 -0
- package/public/skins/blue-fish/pattern.png +0 -0
- package/public/skins/blue-fish/preview.html +12 -0
- package/public/skins/blue-fish/skin.css +122 -0
- package/public/skins/blue-fish/sparkles.svg +18 -0
- package/public/skins/bocchi/DESIGN.md +99 -0
- package/public/skins/bocchi/face.png +0 -0
- package/public/skins/bocchi/grain.png +0 -0
- package/public/skins/bocchi/icon-blush.png +0 -0
- package/public/skins/bocchi/icon-sleep.png +0 -0
- package/public/skins/bocchi/icon-smile.png +0 -0
- package/public/skins/bocchi/icon-star.png +0 -0
- package/public/skins/bocchi/icon-wink.png +0 -0
- package/public/skins/bocchi/icon.png +0 -0
- package/public/skins/bocchi/pattern-soft.png +0 -0
- package/public/skins/bocchi/pattern.png +0 -0
- package/public/skins/bocchi/preview.html +55 -0
- package/public/skins/bocchi/skin.css +233 -0
- package/public/skins/bocchi/stage-bg.png +0 -0
- package/public/skins/bocchi/stage-soft.png +0 -0
- package/public/skins/bocchi/stand.png +0 -0
- package/public/skins/bocchi/sticker-guitar.png +0 -0
- package/public/skins/kessoku/DESIGN.md +38 -0
- package/public/skins/kessoku/grain.png +0 -0
- package/public/skins/kessoku/skin.css +212 -0
- package/public/skins/kita/SOURCES.json +51 -0
- package/public/skins/kita/face.png +0 -0
- package/public/skins/kita/icon-live.png +0 -0
- package/public/skins/kita/icon-reddress.png +0 -0
- package/public/skins/kita/icon-seifuku.png +0 -0
- package/public/skins/kita/pattern.png +0 -0
- package/public/skins/kita/preview.html +56 -0
- package/public/skins/kita/skin.css +26 -0
- package/public/skins/kita/stand.png +0 -0
- package/public/skins/kita/sticker-live.png +0 -0
- package/public/skins/nijika/SOURCES.json +51 -0
- package/public/skins/nijika/face.png +0 -0
- package/public/skins/nijika/icon-live.png +0 -0
- package/public/skins/nijika/icon-reddress.png +0 -0
- package/public/skins/nijika/icon-seifuku.png +0 -0
- package/public/skins/nijika/pattern.png +0 -0
- package/public/skins/nijika/preview.html +56 -0
- package/public/skins/nijika/skin.css +25 -0
- package/public/skins/nijika/stand.png +0 -0
- package/public/skins/nijika/sticker-live.png +0 -0
- package/public/skins/penguin/DESIGN.md +33 -0
- package/public/skins/penguin/SOURCES.json +22 -0
- package/public/skins/penguin/aic-blueprint.svg +24 -0
- package/public/skins/penguin/endfield-triangles.svg +4 -0
- package/public/skins/penguin/face.png +0 -0
- package/public/skins/penguin/icon-blush.png +0 -0
- package/public/skins/penguin/icon-dizzy.png +0 -0
- package/public/skins/penguin/icon-laugh.png +0 -0
- package/public/skins/penguin/icon-sleep.png +0 -0
- package/public/skins/penguin/icon-smile.png +0 -0
- package/public/skins/penguin/icon-star.png +0 -0
- package/public/skins/penguin/icon-wink.png +0 -0
- package/public/skins/penguin/icon.png +0 -0
- package/public/skins/penguin/mascot.png +0 -0
- package/public/skins/penguin/pattern-night.png +0 -0
- package/public/skins/penguin/pattern.png +0 -0
- package/public/skins/penguin/preview.html +12 -0
- package/public/skins/penguin/skin.css +212 -0
- package/public/skins/ryo/SOURCES.json +51 -0
- package/public/skins/ryo/face.png +0 -0
- package/public/skins/ryo/icon-live.png +0 -0
- package/public/skins/ryo/icon-reddress.png +0 -0
- package/public/skins/ryo/icon-seifuku.png +0 -0
- package/public/skins/ryo/pattern.png +0 -0
- package/public/skins/ryo/preview.html +56 -0
- package/public/skins/ryo/skin.css +25 -0
- package/public/skins/ryo/stand.png +0 -0
- package/public/skins/ryo/sticker-live.png +0 -0
- package/public/sponsor-entry.js +21 -0
- package/public/styles.css +1494 -0
- package/public/subagents.css +61 -0
- package/public/subagents.js +275 -0
- package/public/task-board.js +109 -0
- package/public/teams.js +98 -0
- package/public/theme-picker.css +58 -0
- package/public/theme-vars.css +1044 -0
- package/public/theme.js +166 -0
- package/public/transcribe-core.js +74 -0
- package/public/turn-results.js +121 -0
- package/public/update.json +49 -0
- package/public/vendor/gsap/NOTICE.md +10 -0
- package/public/vendor/gsap/gsap.min.js +11 -0
- package/public/vendor/morphicons/LICENSE +21 -0
- package/public/vendor/morphicons/README.md +10 -0
- package/public/vendor/morphicons/controller-CXZuwJ_M.js +152 -0
- package/public/vendor/morphicons/dom.js +206 -0
- package/public/vendor/morphicons/element.js +261 -0
- package/public/vendor/morphicons/normalize-CYnN3Npw.js +540 -0
- package/public/vendor/morphicons/spring-CFHloqPP.js +623 -0
- package/public/version.json +3 -0
- package/public/voice-input.js +739 -0
- package/public/workflow.css +365 -0
- package/public/workflow.js +409 -0
- package/session-file.mjs +39 -0
- package/skills/dsh-remote-doctor/SKILL.md +186 -0
- package/skills/dsh-remote-doctor/references/wiki/README.md +40 -0
- package/skills/dsh-remote-doctor/references/wiki/ai-guide.md +61 -0
- package/skills/dsh-remote-doctor/references/wiki/connection.md +76 -0
- package/skills/dsh-remote-doctor/references/wiki/errors.md +26 -0
- package/skills/dsh-remote-doctor/references/wiki/evidence.md +44 -0
- package/skills/dsh-remote-doctor/references/wiki/files.md +31 -0
- package/skills/dsh-remote-doctor/references/wiki/maintenance.md +30 -0
- package/skills/dsh-remote-doctor/references/wiki/notifications.md +33 -0
- package/skills/dsh-remote-doctor/references/wiki/operations.md +32 -0
- package/skills/dsh-remote-doctor/references/wiki/plugins.md +90 -0
- package/skills/dsh-remote-doctor/references/wiki/sessions.md +45 -0
- package/skills/dsh-remote-doctor/references/wiki/sources.md +27 -0
- package/skills.mjs +53 -0
- package/task-board.mjs +57 -0
- package/teams.mjs +58 -0
package/public/theme.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/* DSH Remote 皮肤系统 · 零依赖
|
|
2
|
+
* 十二套皮肤: html[data-theme] = default(默认深空) | dark(落日) | light(易北爱乐厅) | neutral(草原孤塔) | mono(黑曜白) | fish(蓝色大肥鱼) | penguin(企鹅女管·白昼) | penguin-night(企鹅女管·极夜) | bocchi(波奇酱) | nijika(伊地知虹夏) | ryo(山田凉) | kita(喜多郁代)
|
|
3
|
+
* 优先级: localStorage dshTheme > 蓝色大肥鱼(默认)
|
|
4
|
+
* set() 写入用户显式选择; applyCurrent() 只应用,不覆盖已有选择。 */
|
|
5
|
+
'use strict'
|
|
6
|
+
;(function () {
|
|
7
|
+
const KEY = 'dshTheme'
|
|
8
|
+
const DEFAULT = 'fish'
|
|
9
|
+
const VALID = ['default', 'dark', 'light', 'neutral', 'mono', 'fish', 'penguin', 'penguin-night', 'bocchi', 'nijika', 'ryo', 'kita']
|
|
10
|
+
const mq = window.matchMedia('(prefers-color-scheme: light)')
|
|
11
|
+
const store = {
|
|
12
|
+
get(k) { try { return localStorage.getItem(k) } catch { return null } },
|
|
13
|
+
set(k, v) { try { localStorage.setItem(k, v) } catch {} }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function system() {
|
|
17
|
+
return mq.matches ? 'light' : 'default'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function get() {
|
|
21
|
+
const saved = store.get(KEY)
|
|
22
|
+
return VALID.includes(saved) ? saved : DEFAULT
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function syncMeta() {
|
|
26
|
+
const bg = getComputedStyle(document.documentElement).getPropertyValue('--dsr-bg').trim()
|
|
27
|
+
const meta = document.querySelector('meta[name="theme-color"]')
|
|
28
|
+
if (meta && bg) meta.setAttribute('content', bg)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function announce(t) {
|
|
32
|
+
window.dispatchEvent(new CustomEvent('dsh-theme-change', { detail: { theme: t } }))
|
|
33
|
+
if (window.parent !== window) {
|
|
34
|
+
window.parent.postMessage({ source: 'dsh-remote-theme', type: 'change', theme: t }, location.origin)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function applyAttr(t) {
|
|
39
|
+
document.documentElement.setAttribute('data-theme', t)
|
|
40
|
+
syncMeta()
|
|
41
|
+
announce(t)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function applyCurrent() {
|
|
45
|
+
applyAttr(get())
|
|
46
|
+
return get()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function set(t) {
|
|
50
|
+
if (!VALID.includes(t)) t = get()
|
|
51
|
+
store.set(KEY, t)
|
|
52
|
+
applyAttr(t)
|
|
53
|
+
return t
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// One picker for mobile, admin and desktop. Assets resolve beside theme.js,
|
|
57
|
+
// including when the admin page is served under /remote/.
|
|
58
|
+
const assetBase = document.currentScript?.src
|
|
59
|
+
const GROUPS = [
|
|
60
|
+
{ id: 'basic', zh: '基础配色', en: 'Essentials', themes: ['default', 'dark', 'light', 'neutral', 'mono'] },
|
|
61
|
+
{ id: 'fish', zh: '蓝色大肥鱼', en: 'Blue Fat Fish', themes: ['fish'] },
|
|
62
|
+
{ id: 'endfield', zh: '明日方舟:终末地', en: 'Arknights: Endfield', themes: ['penguin', 'penguin-night'] },
|
|
63
|
+
{ id: 'bocchi', zh: '孤独摇滚!', en: 'BOCCHI THE ROCK!', themes: ['bocchi', 'nijika', 'ryo', 'kita'] }
|
|
64
|
+
]
|
|
65
|
+
const ART = {
|
|
66
|
+
fish: 'blue-fish/mascot.png', penguin: 'penguin/mascot.png', 'penguin-night': 'penguin/mascot.png',
|
|
67
|
+
bocchi: 'bocchi/stand.png', nijika: 'nijika/stand.png', ryo: 'ryo/stand.png', kita: 'kita/stand.png'
|
|
68
|
+
}
|
|
69
|
+
let picker = null
|
|
70
|
+
|
|
71
|
+
function openPicker({ themes, current = get(), label, lang = 'zh', onSelect = set }) {
|
|
72
|
+
if (picker?.open) return
|
|
73
|
+
const en = lang === 'en'
|
|
74
|
+
const node = (tag, className, text) => {
|
|
75
|
+
const el = document.createElement(tag)
|
|
76
|
+
if (className) el.className = className
|
|
77
|
+
if (text != null) el.textContent = text
|
|
78
|
+
return el
|
|
79
|
+
}
|
|
80
|
+
const dialog = node('dialog', 'dsr-theme-picker')
|
|
81
|
+
picker = dialog
|
|
82
|
+
dialog.setAttribute('aria-labelledby', 'dsr-theme-title')
|
|
83
|
+
const header = node('div', 'dsr-theme-header')
|
|
84
|
+
const title = node('h2', '', en ? 'Choose a skin' : '选择皮肤')
|
|
85
|
+
title.id = 'dsr-theme-title'
|
|
86
|
+
const close = node('button', 'dsr-theme-close', '×')
|
|
87
|
+
close.type = 'button'
|
|
88
|
+
close.setAttribute('aria-label', en ? 'Close' : '关闭')
|
|
89
|
+
close.addEventListener('click', () => dialog.close())
|
|
90
|
+
header.append(title, close)
|
|
91
|
+
const hint = node('p', 'dsr-theme-hint', en ? 'Expand a collection to preview. Select a skin to apply it.' : '按 IP 展开查看预览,点击皮肤即可应用。')
|
|
92
|
+
const body = node('div', 'dsr-theme-groups')
|
|
93
|
+
for (const group of GROUPS) {
|
|
94
|
+
const options = group.themes.map(id => themes.find(theme => theme.id === id)).filter(Boolean)
|
|
95
|
+
if (!options.length) continue
|
|
96
|
+
const details = node('details', 'dsr-theme-group')
|
|
97
|
+
details.dataset.group = group.id
|
|
98
|
+
details.open = options.some(theme => theme.id === current)
|
|
99
|
+
const summary = node('summary')
|
|
100
|
+
summary.append(node('span', 'dsr-theme-group-name', en ? group.en : group.zh),
|
|
101
|
+
node('span', 'dsr-theme-count', String(options.length)))
|
|
102
|
+
if (details.open) summary.append(node('span', 'dsr-theme-active', en ? 'Current' : '当前使用'))
|
|
103
|
+
summary.append(node('span', 'dsr-theme-chevron', '⌄'))
|
|
104
|
+
const grid = node('div', 'dsr-theme-grid')
|
|
105
|
+
const images = []
|
|
106
|
+
for (const theme of options) {
|
|
107
|
+
const name = label(theme.id)
|
|
108
|
+
const selected = theme.id === current
|
|
109
|
+
const card = node('button', 'dsr-theme-card')
|
|
110
|
+
card.type = 'button'
|
|
111
|
+
card.dataset.theme = theme.id
|
|
112
|
+
card.setAttribute('aria-pressed', String(selected))
|
|
113
|
+
card.setAttribute('aria-label', (en ? 'Apply ' : '应用') + name)
|
|
114
|
+
for (const [index, color] of theme.sw.entries()) card.style.setProperty('--preview-' + index, color)
|
|
115
|
+
const preview = node('span', 'dsr-theme-preview')
|
|
116
|
+
preview.setAttribute('aria-hidden', 'true')
|
|
117
|
+
const mock = node('span', 'dsr-theme-mock')
|
|
118
|
+
mock.append(node('i', 'dsr-theme-mock-title'), node('i', 'dsr-theme-mock-line'),
|
|
119
|
+
node('i', 'dsr-theme-mock-line'), node('i', 'dsr-theme-mock-button'))
|
|
120
|
+
preview.append(mock)
|
|
121
|
+
if (ART[theme.id]) {
|
|
122
|
+
const img = node('img', 'dsr-theme-art')
|
|
123
|
+
img.alt = ''
|
|
124
|
+
img.decoding = 'async'
|
|
125
|
+
images.push({ img, path: ART[theme.id] })
|
|
126
|
+
img.addEventListener('error', () => { img.remove() }, { once: true })
|
|
127
|
+
preview.append(img)
|
|
128
|
+
}
|
|
129
|
+
const caption = node('span', 'dsr-theme-caption')
|
|
130
|
+
caption.append(node('span', 'dsr-theme-name', name), node('span', 'dsr-theme-check', selected ? '✓' : ''))
|
|
131
|
+
const swatches = node('span', 'dsr-theme-swatches')
|
|
132
|
+
swatches.setAttribute('aria-hidden', 'true')
|
|
133
|
+
for (const color of theme.sw) {
|
|
134
|
+
const swatch = node('i')
|
|
135
|
+
swatch.style.background = color
|
|
136
|
+
swatches.append(swatch)
|
|
137
|
+
}
|
|
138
|
+
card.append(preview, caption, swatches)
|
|
139
|
+
card.addEventListener('click', () => { onSelect(theme.id); dialog.close() })
|
|
140
|
+
grid.append(card)
|
|
141
|
+
}
|
|
142
|
+
// Closed collections do not fetch their character artwork.
|
|
143
|
+
const loadImages = () => {
|
|
144
|
+
if (!details.open) return
|
|
145
|
+
for (const { img, path } of images.splice(0)) img.src = new URL('skins/' + path, assetBase || document.baseURI).href
|
|
146
|
+
}
|
|
147
|
+
details.addEventListener('toggle', loadImages)
|
|
148
|
+
details.append(summary, grid)
|
|
149
|
+
body.append(details)
|
|
150
|
+
loadImages()
|
|
151
|
+
}
|
|
152
|
+
dialog.append(header, hint, body)
|
|
153
|
+
dialog.addEventListener('click', event => {
|
|
154
|
+
if (event.target !== dialog) return
|
|
155
|
+
const rect = dialog.getBoundingClientRect()
|
|
156
|
+
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) dialog.close()
|
|
157
|
+
})
|
|
158
|
+
dialog.addEventListener('close', () => { dialog.remove(); if (picker === dialog) picker = null }, { once: true })
|
|
159
|
+
document.body.append(dialog)
|
|
160
|
+
dialog.showModal()
|
|
161
|
+
close.focus()
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
applyCurrent()
|
|
165
|
+
window.DSHTheme = { KEY, DEFAULT, VALID, system, get, set, applyCurrent, openPicker }
|
|
166
|
+
})()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* DSH Remote Prompt 转写核心模块(dev 分支实验功能)
|
|
2
|
+
* 纯逻辑、零依赖:密钥掩码、固定整理提示词、状态码文案和 SSE 增量解析。
|
|
3
|
+
* 浏览器通过 window.TranscribeCore 使用,Node 测试通过 CommonJS 使用。
|
|
4
|
+
* 当前仅在 dev 分支保留,不接入稳定版主界面。
|
|
5
|
+
*/
|
|
6
|
+
(function (root, factory) {
|
|
7
|
+
if (typeof module === 'object' && module.exports) module.exports = factory()
|
|
8
|
+
else root.TranscribeCore = factory()
|
|
9
|
+
})(typeof self !== 'undefined' ? self : this, function () {
|
|
10
|
+
'use strict'
|
|
11
|
+
|
|
12
|
+
const TRANSCRIBE_SYSTEM_PROMPT = [
|
|
13
|
+
'你是文本整理助手。请把用户发来的原始文字改写成一条可直接使用的提示词,要求:',
|
|
14
|
+
'1. 分条分点:把内容按要点拆成编号列表,层次清晰;',
|
|
15
|
+
'2. 逻辑清晰:按「目标—背景—要求—输出」的顺序整理,删除冗余重复;',
|
|
16
|
+
'3. 修正语句与错别字:修正病句、错别字、标点与大小写问题;',
|
|
17
|
+
'4. 删除无意义口语语气词:去掉「那个、就是说、嗯、啊、然后」等口头禅;',
|
|
18
|
+
'5. 保留原意:不增删核心信息,不擅自补充额外要求;',
|
|
19
|
+
'6. 直接输出改写结果,不解释、不客套。'
|
|
20
|
+
].join('\n')
|
|
21
|
+
|
|
22
|
+
function maskApiKey(key) {
|
|
23
|
+
const value = String(key || '')
|
|
24
|
+
if (!value) return ''
|
|
25
|
+
if (value.length <= 8) return '****' + value.slice(-4)
|
|
26
|
+
return value.slice(0, 4) + '****' + value.slice(-4)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function statusMessage(status) {
|
|
30
|
+
if (status === 400) return '请求参数错误:请检查 API 地址、模型名或输入内容(400)'
|
|
31
|
+
if (status === 401 || status === 403) return '认证失败:API 密钥无效或无权限(' + status + ')'
|
|
32
|
+
if (status === 404) return '接口不存在:请检查 API 地址是否以 /v1 结尾(404)'
|
|
33
|
+
if (status === 429) return '请求过于频繁或额度不足(429)'
|
|
34
|
+
if (status >= 500) return '服务端错误(' + status + ')'
|
|
35
|
+
return '请求失败(HTTP ' + status + ')'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function parseSseData(line) {
|
|
39
|
+
const data = String(line || '').trim().replace(/^data:\s*/, '').trim()
|
|
40
|
+
if (data === '[DONE]') return { type: 'done' }
|
|
41
|
+
let value
|
|
42
|
+
try { value = JSON.parse(data) } catch { return { type: 'skip' } }
|
|
43
|
+
if (value.error) return { type: 'error', error: String(value.error.message || statusMessage(Number(value.error.code) || 0)) }
|
|
44
|
+
const piece = value.choices?.[0]?.delta?.content
|
|
45
|
+
return typeof piece === 'string' ? { type: 'delta', text: piece } : { type: 'skip' }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function consumeSse(reader, decoder, onDelta, options = {}) {
|
|
49
|
+
let buffer = ''
|
|
50
|
+
let full = ''
|
|
51
|
+
while (true) {
|
|
52
|
+
const { done, value } = await reader.read()
|
|
53
|
+
if (done) break
|
|
54
|
+
buffer += decoder.decode(value, { stream: true })
|
|
55
|
+
options.onChunk?.()
|
|
56
|
+
let nl
|
|
57
|
+
while ((nl = buffer.indexOf('\n')) !== -1) {
|
|
58
|
+
const line = buffer.slice(0, nl).trim()
|
|
59
|
+
buffer = buffer.slice(nl + 1)
|
|
60
|
+
if (!line.startsWith('data:')) continue
|
|
61
|
+
const parsed = parseSseData(line)
|
|
62
|
+
if (parsed.type === 'done') { await reader.cancel?.(); return full }
|
|
63
|
+
if (parsed.type === 'error') throw new Error(parsed.error)
|
|
64
|
+
if (parsed.type === 'delta') {
|
|
65
|
+
full += parsed.text
|
|
66
|
+
onDelta?.(parsed.text)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return full
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return { TRANSCRIBE_SYSTEM_PROMPT, maskApiKey, statusMessage, parseSseData, consumeSse }
|
|
74
|
+
})
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* Completed-turn actions derived from durable events. No dependencies. */
|
|
2
|
+
'use strict';
|
|
3
|
+
;(function(root) {
|
|
4
|
+
const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]))
|
|
5
|
+
const text = (zh, en) => root.I18N?.lang === 'en' ? en : zh
|
|
6
|
+
const keys = ['inputTokens', 'outputTokens', 'cacheReadTokens', 'cacheWriteTokens']
|
|
7
|
+
const count = n => typeof n === 'number' && Number.isFinite(n) && n >= 0
|
|
8
|
+
function messageText(event) {
|
|
9
|
+
const data = event.data || {}, blocks = data.message?.content ?? data.content
|
|
10
|
+
if (Array.isArray(blocks)) return blocks.filter(b => b?.type === 'text').map(b => String(b.text ?? '')).join('\n\n').trim()
|
|
11
|
+
return typeof data.text === 'string' ? data.text.trim() : ''
|
|
12
|
+
}
|
|
13
|
+
function summarize(entries, sessionId) {
|
|
14
|
+
const results = new Map(), seen = new Set()
|
|
15
|
+
let turn = null
|
|
16
|
+
const fresh = (id, started = false) => ({ id, started, messages: 0, missing: false, samples: 0, total: 0, usage: Object.fromEntries(keys.map(k => [k, 0])), text: '' })
|
|
17
|
+
for (const entry of entries) {
|
|
18
|
+
const event = entry.event || {}, data = event.data || {}, id = data.turn
|
|
19
|
+
if (!Number.isSafeInteger(entry.seq) || seen.has(entry.seq)) continue
|
|
20
|
+
seen.add(entry.seq)
|
|
21
|
+
if (event.type === 'turn/start') { turn = fresh(id, true); continue }
|
|
22
|
+
if (event.type === 'user/message') {
|
|
23
|
+
const source = data.source ?? data.message?.source
|
|
24
|
+
if ((!source || source.kind === 'user') && (!turn || !turn.started)) turn = fresh(id)
|
|
25
|
+
}
|
|
26
|
+
if (event.type === 'assistant/message') {
|
|
27
|
+
if (!turn || id != null && turn.id != null && id !== turn.id) turn = fresh(id)
|
|
28
|
+
if (turn.id == null) turn.id = id
|
|
29
|
+
turn.messages++
|
|
30
|
+
const body = messageText(event)
|
|
31
|
+
if (body) turn.text = body
|
|
32
|
+
const u = data.usage
|
|
33
|
+
if (u && (count(u.totalTokens) || count(u.inputTokens) && count(u.outputTokens))) {
|
|
34
|
+
for (const k of keys) if (count(u[k])) turn.usage[k] += u[k]
|
|
35
|
+
// DSH counters are disjoint. Reasoning is already included in output.
|
|
36
|
+
turn.total += count(u.totalTokens) ? u.totalTokens : keys.reduce((n, k) => n + (count(u[k]) ? u[k] : 0), 0)
|
|
37
|
+
turn.samples++
|
|
38
|
+
} else turn.missing = true
|
|
39
|
+
}
|
|
40
|
+
if (event.type !== 'turn/end') continue
|
|
41
|
+
if (turn?.messages && (id == null || turn.id == null || id === turn.id)) {
|
|
42
|
+
const time = typeof event.time === 'number' ? event.time : Date.parse(event.time)
|
|
43
|
+
results.set(entry.seq, { sessionId, atSeq: entry.seq, text: turn.text,
|
|
44
|
+
time: Number.isFinite(time) && time > 0 ? time : null,
|
|
45
|
+
total: turn.samples ? turn.total : null, usage: turn.usage,
|
|
46
|
+
partial: !turn.started || turn.missing })
|
|
47
|
+
}
|
|
48
|
+
turn = null
|
|
49
|
+
}
|
|
50
|
+
return results
|
|
51
|
+
}
|
|
52
|
+
function decorate(prepared, entries, options = {}) {
|
|
53
|
+
const results = summarize(entries, options.sessionId)
|
|
54
|
+
return prepared.map(entry => results.has(entry.seq) && entry.event?.type === 'turn/end'
|
|
55
|
+
? { ...entry, view: { ...entry.view, turnResult: { ...results.get(entry.seq), canFork: options.canFork === true } } }
|
|
56
|
+
: entry)
|
|
57
|
+
}
|
|
58
|
+
const paths = {
|
|
59
|
+
copy: '<rect x="8" y="8" width="12" height="13" rx="2"/><path d="M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3"/>',
|
|
60
|
+
fork: '<circle cx="6" cy="5" r="3"/><circle cx="6" cy="19" r="3"/><circle cx="18" cy="5" r="3"/><path d="M6 8v8m12-8a8 8 0 0 1-8 8H6"/>',
|
|
61
|
+
usage: '<ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v14c0 4 16 4 16 0V5M4 12c0 4 16 4 16 0"/>'
|
|
62
|
+
}
|
|
63
|
+
const icon = name => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths[name]}</svg>`
|
|
64
|
+
function formatTokens(n) {
|
|
65
|
+
for (const [size, suffix] of [[1e9, 'B'], [1e6, 'M'], [1e3, 'K']]) if (n >= size) return (n / size).toFixed(1).replace(/\.0$/, '') + suffix
|
|
66
|
+
return String(n)
|
|
67
|
+
}
|
|
68
|
+
function html(result) {
|
|
69
|
+
const button = (action, label, disabled = false) => `<button type="button" data-turn-action="${action}" title="${esc(label)}" aria-label="${esc(label)}"${disabled ? ' disabled' : ''}>${icon(action)}<span>${esc(label)}</span></button>`
|
|
70
|
+
const total = result.total == null ? '—' : formatTokens(result.total) + ' tok'
|
|
71
|
+
const label = text(result.partial && result.total != null ? '已知用量' : '用量', result.partial && result.total != null ? 'Known usage' : 'Usage')
|
|
72
|
+
const u = result.usage
|
|
73
|
+
const detail = result.total == null ? text('主机未提供该回合的用量。', 'The host did not report usage for this turn.')
|
|
74
|
+
: `${text('输入', 'Input')} ${u.inputTokens} · ${text('输出', 'Output')} ${u.outputTokens} · ${text('缓存读取', 'Cache read')} ${u.cacheReadTokens} · ${text('缓存写入', 'Cache write')} ${u.cacheWriteTokens} · ${text('合计', 'Total')} ${result.total}` + (result.partial ? text('(记录未加载完整或部分调用未报告用量)', ' (history incomplete or some calls did not report usage)') : '')
|
|
75
|
+
const date = result.time == null ? null : new Date(result.time)
|
|
76
|
+
const stamp = date ? date.toLocaleString(root.I18N?.lang === 'en' ? 'en-US' : 'zh-CN', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', hour12: false }) : text('时间未知', 'Time unavailable')
|
|
77
|
+
const labels = [text('输入', 'Input'), text('输出', 'Output'), text('缓存读取', 'Cache read'), text('缓存写入', 'Cache write')]
|
|
78
|
+
const breakdown = result.total == null ? `<p>${esc(detail)}</p>` : `<dl>${keys.map((key, index) => `<div><dt>${esc(labels[index])}</dt><dd>${u[key].toLocaleString()} tok</dd></div>`).join('')}<div><dt>${esc(text('合计', 'Total'))}</dt><dd>${result.total.toLocaleString()} tok</dd></div></dl>${result.partial ? `<p>${esc(text('记录未加载完整,或部分调用未报告用量。', 'History is incomplete, or some calls did not report usage.'))}</p>` : ''}`
|
|
79
|
+
return `<div class="turn-result" data-turn-seq="${result.atSeq}" data-turn-session="${esc(result.sessionId)}" role="group" aria-label="${esc(text('回合结果', 'Turn result'))}">${button('copy', text('复制结果', 'Copy result'), !result.text)}${result.canFork ? button('fork', text('从此处分支', 'Branch from here')) : ''}<details class="turn-result-usage" data-activity-key="turn-usage:${result.atSeq}"><summary title="${esc(detail)}">${icon('usage')}${esc(label)} ${esc(total)}</summary><div class="turn-result-breakdown">${breakdown}</div></details><time${date ? ` datetime="${date.toISOString()}" title="${esc(date.toLocaleString())}"` : ''}>${esc(stamp)}</time><span class="turn-result-status" role="status" aria-live="polite"></span></div>`
|
|
80
|
+
}
|
|
81
|
+
// Delegate on the stable history container so paging/redraws need no new listeners.
|
|
82
|
+
function bind(box, host) {
|
|
83
|
+
if (!box || box.dataset.turnResultsBound) return
|
|
84
|
+
box.dataset.turnResultsBound = '1'
|
|
85
|
+
const pending = new Set()
|
|
86
|
+
box.addEventListener('click', async event => {
|
|
87
|
+
const button = event.target.closest?.('[data-turn-action]'), row = button?.closest('.turn-result')
|
|
88
|
+
if (!row || !box.contains(row)) return
|
|
89
|
+
const context = host.capture(), atSeq = Number(row.dataset.turnSeq)
|
|
90
|
+
if (context.sessionId !== row.dataset.turnSession || !context.valid()) return
|
|
91
|
+
const result = summarize(context.entries, context.sessionId).get(atSeq)
|
|
92
|
+
if (!result) return
|
|
93
|
+
const key = context.key + ':' + context.sessionId + ':' + atSeq + ':' + button.dataset.turnAction
|
|
94
|
+
if (pending.has(key)) return
|
|
95
|
+
const status = row.querySelector('.turn-result-status')
|
|
96
|
+
pending.add(key); button.disabled = true
|
|
97
|
+
try {
|
|
98
|
+
if (button.dataset.turnAction === 'copy') {
|
|
99
|
+
if (!result.text || !await host.copy(result.text)) throw Error(text('复制失败,请重试', 'Copy failed. Please retry.'))
|
|
100
|
+
if (context.valid()) status.textContent = text('已复制', 'Copied')
|
|
101
|
+
} else if (button.dataset.turnAction === 'fork' && context.canFork) {
|
|
102
|
+
status.textContent = text('正在创建分支…', 'Creating branch…')
|
|
103
|
+
// No prompt is sent to the child. Unknown write receipts are never replayed.
|
|
104
|
+
const child = await host.fork({ sessionId: context.sessionId, atSeq })
|
|
105
|
+
if (!context.valid()) return
|
|
106
|
+
if (!child?.sessionId) throw Error(text('主机未返回分支会话', 'The host did not return a branch session'))
|
|
107
|
+
status.textContent = text('正在打开分支…', 'Opening branch…')
|
|
108
|
+
await host.open(child.sessionId, context)
|
|
109
|
+
}
|
|
110
|
+
} catch (error) {
|
|
111
|
+
if (context.valid()) status.textContent = error.message || text('操作失败', 'Action failed')
|
|
112
|
+
} finally {
|
|
113
|
+
pending.delete(key)
|
|
114
|
+
if (context.valid()) button.disabled = false
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
const api = { summarize, decorate, html, bind }
|
|
119
|
+
if (typeof module !== 'undefined' && module.exports) module.exports = api
|
|
120
|
+
else root.DshTurnResults = api
|
|
121
|
+
})(typeof window === 'undefined' ? globalThis : window)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.8.8",
|
|
3
|
+
"apkUrl": "dsh-remote.apk",
|
|
4
|
+
"sha256": "20ea0f0eb78610f2cda0c184ea93c72e3542bdbc4a9050f1824d32271557aea4",
|
|
5
|
+
"releasedAt": "2026-11-11T03:52:35.317Z",
|
|
6
|
+
"notes": "新增手机端语音输入(需主机启用实验性「语音输入」并准备识别模型);新增主机与手机的公网中转配对引导;修复部分移动网络下实时连接和轮询失败;改进连接切换时的发送状态提示、Android 图片保存及全屏界面。",
|
|
7
|
+
"history": [
|
|
8
|
+
{
|
|
9
|
+
"version": "0.8.8",
|
|
10
|
+
"notes": "新增手机端语音输入(需主机启用实验性「语音输入」并准备识别模型);新增主机与手机的公网中转配对引导;修复部分移动网络下实时连接和轮询失败;改进连接切换时的发送状态提示、Android 图片保存及全屏界面。"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"version": "0.8.7",
|
|
14
|
+
"notes": "新增手机端语音输入(需主机启用实验性「语音输入」并准备识别模型);新增主机与手机的公网中转配对引导;修复部分移动网络下实时连接和轮询失败;改进连接切换时的发送状态提示、Android 图片保存及全屏界面。"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"version": "0.8.6",
|
|
18
|
+
"notes": "0.8.6:加密中转首次连接更快、更稳——回环通道预握手、并发提升到 32、繁忙时可重试、主机预留工作通道;会话列表更轻量,冷启动和回前台提前握手。修复 DSH 远程重启换端口后网关不再跟着重启,中转控制通道与公网入口保持在线。修复审批处理后卡片残留、过期审批重连后反复出现;普通分支返回主页、子代理仍回父会话;重命名和分支标题立即更新;新建会话不再改写会话列表,“按时间”恢复跨工作区;Android 返回键优先关闭指令/图片菜单与诊疗浮层,强制公告不被返回键绕过;切换会话不再串带图片附件并按会话保留草稿;失效提问不再卡住弹窗,通知跳转更准确。聊天图片支持长按保存到手机。输入区新增上下文占用圆环,并移到“模型”按钮右侧。平板横屏和大屏下内容区与输入框放宽,不再被 720px 窄列限制。"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"version": "0.8.5",
|
|
22
|
+
"notes": "0.8.5:修复公网中转首次接入受阻;Android App 在已认证局域网连接中确认后自动创建并保存手机独立配对,验证公网连接后添加公网地址,无需手动传输配对文件;配对过程逐步显示状态,等待主机公网通道就绪后再验证,失败给出中文原因与错误码,设置页可展开或复制配对日志(主机侧写入 ~/.dsh-remote/pairing.log);保留局域网连接,配对失败不自动关闭加密,支持显式重试与到期重新配对。"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"version": "0.8.4",
|
|
26
|
+
"notes": "0.8.4:新增 Android 试验性端到端加密中转、独立设备配对与到期撤销,关闭加密需逐次确认,连接失败不自动降级;新增按需生成的审批中文摘要,确认后调用当前会话模型并提示 token 消耗,摘要仅供参考;新增主机插件一键更新,失败停止并保留恢复入口,Remote 最后更新;完善旧历史缓存迁移、界面资源更新检测和升级时配置保留;修复 Windows 并发读取导致插件任务元数据原子替换偶发 EPERM,只对元数据改名做有界重试;优化审批及长公告操作栏,复制 md/markdown 块内原文并提供块内轻量复制按钮。浏览器和鸿蒙暂不支持新配对加密入口,基础赞助档仍不包含文件传输。"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"version": "0.8.3",
|
|
30
|
+
"notes": "0.8.3:新增企鹅女管昼夜主题和孤独摇滚四人角色皮肤,皮肤选择器支持按IP分组与图片预览;新增对话消息和代码块复制;新增对话图片持久缓存、按连接隔离、缓存占用查看及图片/历史分别清理;反馈正文扩展至20000字符,超限和发送结果不确定时保留全文,完善收集器保存回执与兼容提示;优化插件安装预检的registry元数据读取和关联请求超时处理;修复角色皮肤设置页贴纸导致的横向溢出。"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"version": "0.8.2",
|
|
34
|
+
"notes": "0.8.2:Android 新增同一 Wi-Fi 搜索电脑与限时配对,电脑开放 10 分钟配对窗口,使用一次性配对码签发独立设备密钥;新增任务结束、目标完成和运行失败通知,审批与任务提醒可分别设置,并可测试通知、查看权限和打开系统通知设置;修复双通道乱序重复提醒、补拉已处理请求仍提醒及审批测试误报成功;改善存储写入失败时的公告历史、已读和已填写状态兜底;增强脱敏诊断日志保留与用户自选反馈附件,按报告编号确认保存结果;修复插件加载标识冲突。局域网搜索和任务通知增强仅限 Android;旧缓存自动迁移与总量回收尚未包含,完整诊断附件需收集器配套升级。"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"version": "0.8.1",
|
|
38
|
+
"notes": "0.8.1:修复 Windows 常驻插件网关占用 DSH 安装目录导致 DSH 更新失败,完善解释器回退、真实路径检查与运行状态显示;修复网关输出流断开引发的重启;手机连接入口移至 DSH「更多」,增加首次使用提示;点击顶栏连接状态即可刷新,并可快捷打开已适配插件界面;会话目标、任务、审批、提问、文件和队列改为可切换卡片,精简摘要并保留完整详情,隐藏无内容消息气泡;自动审查反馈提供本地中文参考并保留原文;公告支持摘要及分段展开、收起;新增文件收件箱,DSH 可向指定设备投递单个文件,经用户确认后接收并查询结果,修复系统下载任务失踪后的重试和接收完成后的键盘焦点。"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"version": "0.8.0",
|
|
42
|
+
"notes": "0.8.0:整理手机与桌面操作入口,新增新手引导与插件排障知识库;优化智能体团队、任务看板及蓝色大肥鱼皮肤,改善窄屏排版;补充插件适配诊断、自定义渠道余额与额度、计划审查和交付阻断信息;实验性插件默认折叠并正确显示安装状态;增强发送回执、防重复发送、会话恢复与弱网历史加载;修复文件上传、续传、插件远程自更新及 macOS 网关启动问题;修复含 CRLF 文本的会话与缓存历史渲染卡死;完善权限与审批记录,Android 版本码改为独立递增计数。"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"version": "0.7.6",
|
|
46
|
+
"notes": "修复长提问占满会话导致无法回答,支持点击摘要卡片并在独立滚动弹窗中选择;补齐 Android 后台审批与提问通知、请求去重及会话跳转;支持普通相对路径聊天文件下载,并反馈系统下载完成或失败原因。"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# GSAP vendored runtime
|
|
2
|
+
|
|
3
|
+
- Upstream: https://github.com/greensock/GSAP
|
|
4
|
+
- Version: 3.15.0
|
|
5
|
+
- Browser entry: `dist/gsap.min.js`
|
|
6
|
+
- License: GreenSock standard no-charge license
|
|
7
|
+
- License text: https://gsap.com/standard-license
|
|
8
|
+
|
|
9
|
+
dsh-Remote keeps the fixed browser distribution local so the zero-build WebUI
|
|
10
|
+
does not depend on a CDN or runtime npm resolution.
|