@yusho/server 0.0.0-stage → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +135 -2
  2. package/app/appguide.mjs +33 -0
  3. package/app/asr.mjs +82 -0
  4. package/app/assets/agents/claude-192.webp +0 -0
  5. package/app/assets/agents/claude-96.webp +0 -0
  6. package/app/assets/agents/codex-192.webp +0 -0
  7. package/app/assets/agents/codex-96.webp +0 -0
  8. package/app/assets/agents/default-192.webp +0 -0
  9. package/app/assets/agents/default-96.webp +0 -0
  10. package/app/assets/agents/dsh-192.webp +0 -0
  11. package/app/assets/agents/dsh-96.webp +0 -0
  12. package/app/assets/brand/logo.webp +0 -0
  13. package/app/assets/lib/THIRD-PARTY.txt +1 -0
  14. package/app/assets/lib/jsqr.js +10102 -0
  15. package/app/assets/linux/alpine-arm64.tar.gz +0 -0
  16. package/app/assets/linux/alpine-x64.tar.gz +0 -0
  17. package/app/assets/live/claude.livliv +0 -0
  18. package/app/assets/live/dafeiyu.livliv +0 -0
  19. package/app/assets/live/gpt.livliv +0 -0
  20. package/app/assets/live/sho.livliv +0 -0
  21. package/app/assets/live//345/275/242/350/261/241/346/235/245/346/272/220.md +5 -0
  22. package/app/assets/livliv/LICENSE +202 -0
  23. package/app/assets/livliv/NOTICE +7 -0
  24. package/app/assets/livliv/player.mjs +15 -0
  25. package/app/assets/looks/claude.webp +0 -0
  26. package/app/assets/looks/dafeiyu.webp +0 -0
  27. package/app/assets/looks/gpt.webp +0 -0
  28. package/app/assets/looks//345/275/242/350/261/241/346/235/245/346/272/220.md +5 -0
  29. package/app/assets/sho/avatar.webp +0 -0
  30. package/app/assets/sho/done.webp +0 -0
  31. package/app/assets/sho/eat.webp +0 -0
  32. package/app/assets/sho/idle-blink.webp +0 -0
  33. package/app/assets/sho/idle.webp +0 -0
  34. package/app/assets/sho/listen.webp +0 -0
  35. package/app/assets/sho/need.webp +0 -0
  36. package/app/assets/sho/work.webp +0 -0
  37. package/app/companion.mjs +519 -0
  38. package/app/diag.mjs +51 -0
  39. package/app/index.html +497 -0
  40. package/app/judge.mjs +103 -0
  41. package/app/lanxfer.mjs +157 -0
  42. package/app/launcher.mjs +2711 -0
  43. package/app/linux.mjs +97 -0
  44. package/app/livliv-pack.mjs +12 -0
  45. package/app/memory.mjs +53 -0
  46. package/app/net.mjs +717 -0
  47. package/app/office.mjs +172 -0
  48. package/app/p2plink.mjs +134 -0
  49. package/app/pcupdate.mjs +55 -0
  50. package/app/plans.mjs +126 -0
  51. package/app/plugins.mjs +79 -0
  52. package/app/realtime.mjs +67 -0
  53. package/app/skills/app-icon/SKILL.md +31 -0
  54. package/app/skills/daily-brief/SKILL.md +29 -0
  55. package/app/skills/expense-review/SKILL.md +28 -0
  56. package/app/skills/make-app/SKILL.md +92 -0
  57. package/app/skills/make-skin/SKILL.md +51 -0
  58. package/app/skills/meeting-notes/SKILL.md +23 -0
  59. package/app/skills/reading-notes/SKILL.md +25 -0
  60. package/app/skills/sho-stickers/SKILL.md +34 -0
  61. package/app/skills/sho-stickers/stickers/eat.webp +0 -0
  62. package/app/skills/sho-stickers/stickers/got-it.webp +0 -0
  63. package/app/skills/sho-stickers/stickers/hi.webp +0 -0
  64. package/app/skills/sho-stickers/stickers/huh.webp +0 -0
  65. package/app/skills/sho-stickers/stickers/on-it.webp +0 -0
  66. package/app/skills/sho-stickers/stickers/yay.webp +0 -0
  67. package/app/skills/sho-stickers/stickers.json +12 -0
  68. package/app/skills/study-plan/SKILL.md +30 -0
  69. package/app/skills/trip-planner/SKILL.md +29 -0
  70. package/app/skills/weekly-report/SKILL.md +30 -0
  71. package/app/skills/workout-plan/SKILL.md +30 -0
  72. package/app/skills/writing-polish/SKILL.md +33 -0
  73. package/app/skills.mjs +173 -0
  74. package/app/skins.mjs +40 -0
  75. package/app/social.mjs +1067 -0
  76. package/app/storage.mjs +143 -0
  77. package/app/tts.mjs +68 -0
  78. package/app/ttslocal.mjs +77 -0
  79. package/app/voices.mjs +102 -0
  80. package/backup.mjs +109 -0
  81. package/bin/yusho.mjs +141 -0
  82. package/connector/lib/api.mjs +14 -0
  83. package/connector/lib/autostart.mjs +40 -0
  84. package/connector/lib/client.js +165 -0
  85. package/connector/lib/connector.mjs +468 -0
  86. package/connector/lib/dsh-acp.mjs +129 -0
  87. package/connector/lib/dsh-headless.patch.yml +4 -0
  88. package/connector/lib/dsh-plugin.mjs +80 -0
  89. package/connector/lib/lanfile.mjs +151 -0
  90. package/connector/lib/nostr.mjs +53 -0
  91. package/connector/lib/page.html +121 -0
  92. package/connector/lib/qr.mjs +4 -0
  93. package/connector/lib/service.mjs +54 -0
  94. package/node_modules/@local/shoal-mobile/lib/index.js +485 -0
  95. package/node_modules/@local/shoal-mobile/lib/polyfill.js +82 -0
  96. package/node_modules/@local/shoal-mobile/lib/session-context.js +34 -0
  97. package/node_modules/@local/shoal-mobile/lib/shell.js +60 -0
  98. package/node_modules/@local/shoal-mobile/lib/web-startup.js +33 -0
  99. package/node_modules/@local/shoal-mobile/package.json +24 -0
  100. package/node_modules/@local/yusho-pc/lib/client.js +9100 -0
  101. package/node_modules/@local/yusho-pc/lib/index.js +3 -0
  102. package/node_modules/@local/yusho-pc/package.json +28 -0
  103. package/node_modules/@local/yusho-web-login/brand/icon-192.webp +0 -0
  104. package/node_modules/@local/yusho-web-login/brand/logo-dark.svg +25 -0
  105. package/node_modules/@local/yusho-web-login/brand.mjs +8 -0
  106. package/node_modules/@local/yusho-web-login/dsh-web-login.mjs +974 -0
  107. package/node_modules/@local/yusho-web-login/lib/client.js +607 -0
  108. package/node_modules/@local/yusho-web-login/login-page.mjs +609 -0
  109. package/node_modules/@local/yusho-web-login/login-store.mjs +708 -0
  110. package/node_modules/@local/yusho-web-login/package.json +25 -0
  111. package/node_modules/@local/yusho-web-login/whale-scene.mjs +509 -0
  112. package/node_modules/@local/yusho-web-login/yusho-scene.mjs +227 -0
  113. package/package.json +38 -4
  114. package/pc.patch.yml +83 -0
  115. package/run.mjs +136 -0
@@ -0,0 +1,227 @@
1
+ /**
2
+ * 「深海·Sho 酱」— 鱼Sho 风格的登录页(和「鲸灵」并列,鲸灵原样保留)。
3
+ *
4
+ * 主角是我们自己的 IP:完整的鱼Sho logo(Sho 酱 + 立体字,深色底版本)浮在左边,登录卡片在右边。
5
+ * Sho 酱是鲸鱼娘:画面里只用水、气泡、光和星星,不出现鱼形(IP 设定:动物元素只用鲸鱼)。
6
+ *
7
+ * 背景:深海蓝渐变 + 斜照的光束 + 水面光斑(CSS),一张 2D 画布画三层景深的上浮气泡和闪烁的星星。
8
+ * 和登录框的互动:
9
+ * input 密码框上冒出几个小气泡
10
+ * error 一圈红色波纹从密码框推开,气泡被冲散(卡片自己会抖)
11
+ * success Sho 酱头顶的呆毛喷出一道水柱、一大串气泡往上涌,画面一亮
12
+ * prefers-reduced-motion:只画一帧;标签页切走时暂停。
13
+ *
14
+ * 浏览器那半是 scene 函数,用 Function.prototype.toString 序列化进页面,必须自包含。
15
+ */
16
+
17
+ /* eslint-disable no-var */
18
+ function scene(cfg) {
19
+ var cv = document.getElementById('yu-cv'), hero = document.getElementById('yu-hero')
20
+ if (!cv) return
21
+ var g = cv.getContext('2d')
22
+ var reduce = matchMedia('(prefers-reduced-motion: reduce)').matches
23
+ var DPR = Math.min(window.devicePixelRatio || 1, 2)
24
+ var W = 0, H = 0
25
+ var bubbles = [], stars = [], waves = [], spout = null
26
+ var flash = 0, alarm = 0, clock = 0, last = 0, raf = 0
27
+
28
+ function rnd(a, b) { return a + Math.random() * (b - a) }
29
+ // 三层景深:远(小、慢、淡、模糊感)→ 近(大、快、亮)
30
+ function bubble(x, y, depth, burst) {
31
+ var d = depth == null ? Math.random() : depth
32
+ return { x: x, y: y, r: 1.6 + d * d * 9 + Math.random() * 2, d: d, vy: -(0.25 + d * 0.9 + Math.random() * 0.4) * (burst ? 2.4 : 1), vx: burst ? rnd(-1.6, 1.6) : 0, ph: Math.random() * 6.28, wob: 0.4 + Math.random() * 0.9, life: burst ? rnd(1400, 2600) : Infinity, age: 0 }
33
+ }
34
+ function star(x, y, warm) { return { x: x, y: y, s: warm ? rnd(3, 5) : rnd(4, 9), warm: !!warm, ph: Math.random() * 6.28, sp: rnd(0.0012, 0.0026) } }
35
+
36
+ function heroBox() {
37
+ var r = hero && getComputedStyle(hero).display !== 'none' ? hero.getBoundingClientRect() : null // fixed 定位的元素 offsetParent 一直是 null,不能拿它判断
38
+ return r && r.width > 40 ? r : null
39
+ }
40
+ function seed() {
41
+ bubbles = []; stars = []
42
+ var n = Math.round(Math.min(110, Math.max(46, W * H / 16000)))
43
+ for (var i = 0; i < n; i++) bubbles.push(bubble(Math.random() * W, Math.random() * H))
44
+ // 星星:大多在 Sho 酱周围(和 logo 上的星星一样,白的多、橙的少),其余散在画面上
45
+ var hb = heroBox()
46
+ for (var k = 0; k < 16; k++) {
47
+ var near = hb && k < 10
48
+ var x = near ? hb.left + rnd(-0.05, 1.05) * hb.width : Math.random() * W
49
+ var y = near ? hb.top + rnd(-0.05, 0.75) * hb.height : Math.random() * H * 0.8
50
+ stars.push(star(x, y, k % 4 === 3))
51
+ }
52
+ }
53
+
54
+ function drawBubble(b, a) {
55
+ var r = b.r, x = b.x, y = b.y
56
+ // 透明的泡:边缘一圈亮、里面几乎透明,左上角一个高光点(和 logo 上的气泡同一种画法)
57
+ var grd = g.createRadialGradient(x - r * 0.3, y - r * 0.35, r * 0.1, x, y, r)
58
+ grd.addColorStop(0, 'rgba(190,215,255,' + (0.10 * a) + ')')
59
+ grd.addColorStop(0.72, 'rgba(120,160,255,' + (0.10 * a) + ')')
60
+ grd.addColorStop(0.93, 'rgba(170,200,255,' + (0.55 * a) + ')')
61
+ grd.addColorStop(1, 'rgba(170,200,255,0)')
62
+ g.fillStyle = grd
63
+ g.beginPath(); g.arc(x, y, r, 0, 6.2832); g.fill()
64
+ g.fillStyle = 'rgba(255,255,255,' + (0.85 * a) + ')'
65
+ g.beginPath(); g.ellipse(x - r * 0.38, y - r * 0.42, r * 0.22, r * 0.14, -0.6, 0, 6.2832); g.fill()
66
+ }
67
+ function drawStar(s, t) {
68
+ var tw = 0.5 + 0.5 * Math.sin(t * s.sp * 1000 / 16.67 * 0.06 + s.ph)
69
+ var a = 0.25 + tw * 0.75, sz = s.s * (0.75 + tw * 0.35)
70
+ g.save(); g.translate(s.x, s.y); g.globalAlpha = a
71
+ g.fillStyle = s.warm ? '#FF8A4C' : '#FFFFFF'
72
+ g.shadowColor = s.warm ? 'rgba(255,138,76,.9)' : 'rgba(200,220,255,.9)'; g.shadowBlur = 8
73
+ // 四角星(logo 上的那种):四条内凹的弧
74
+ g.beginPath(); g.moveTo(0, -sz)
75
+ g.quadraticCurveTo(0, 0, sz, 0); g.quadraticCurveTo(0, 0, 0, sz); g.quadraticCurveTo(0, 0, -sz, 0); g.quadraticCurveTo(0, 0, 0, -sz)
76
+ g.fill(); g.restore()
77
+ }
78
+
79
+ function step(dt) {
80
+ var k = dt / 16.67
81
+ for (var i = bubbles.length - 1; i >= 0; i--) {
82
+ var b = bubbles[i]
83
+ b.age += dt
84
+ b.ph += 0.03 * k
85
+ b.x += (Math.sin(b.ph) * b.wob * 0.35 + b.vx) * k
86
+ b.y += b.vy * k
87
+ b.vx *= Math.pow(0.97, k)
88
+ for (var w = 0; w < waves.length; w++) {
89
+ var W0 = waves[w], dx = b.x - W0.x, dy = b.y - W0.y, dd = Math.sqrt(dx * dx + dy * dy) + 0.001
90
+ var band = Math.abs(dd - W0.r)
91
+ if (band < 60) { var f = (1 - band / 60) * W0.str * (1 - W0.age / W0.life); b.vx += dx / dd * f * 0.5 * k; b.y += dy / dd * f * 0.6 * k }
92
+ }
93
+ if (b.age > b.life) { bubbles.splice(i, 1); continue }
94
+ if (b.y < -20 && b.life === Infinity) { b.y = H + rnd(10, 60); b.x = Math.random() * W }
95
+ if (b.x < -20) b.x = W + 10; else if (b.x > W + 20) b.x = -10
96
+ }
97
+ for (var q = waves.length - 1; q >= 0; q--) { var v = waves[q]; v.age += dt; v.r += v.sp * k; if (v.age > v.life) waves.splice(q, 1) }
98
+ if (spout) {
99
+ spout.age += dt
100
+ var hb = heroBox()
101
+ if (hb && spout.age < 1300) for (var s2 = 0; s2 < 4; s2++) { var nb = bubble(spout.x + rnd(-14, 14), spout.y, rnd(0.3, 0.9), true); nb.vy = -rnd(5, 11); nb.vx = rnd(-1.8, 1.8); bubbles.push(nb) }
102
+ if (spout.age > 2400) spout = null
103
+ }
104
+ flash *= Math.pow(0.92, k); alarm *= Math.pow(0.94, k)
105
+ }
106
+
107
+ function draw(t) {
108
+ g.setTransform(DPR, 0, 0, DPR, 0, 0)
109
+ g.clearRect(0, 0, W, H)
110
+ // 远处的泡先画
111
+ bubbles.sort(function (a, b) { return a.d - b.d })
112
+ for (var i = 0; i < bubbles.length; i++) {
113
+ var b = bubbles[i], a = 0.35 + b.d * 0.65
114
+ if (b.life !== Infinity) a *= Math.max(0, 1 - b.age / b.life)
115
+ drawBubble(b, a)
116
+ }
117
+ for (var k = 0; k < stars.length; k++) drawStar(stars[k], t)
118
+ for (var w = 0; w < waves.length; w++) {
119
+ var v = waves[w], al = (1 - v.age / v.life)
120
+ g.strokeStyle = v.red ? 'rgba(255,90,110,' + (0.55 * al) + ')' : 'rgba(170,200,255,' + (0.45 * al) + ')'
121
+ g.lineWidth = 2; g.beginPath(); g.arc(v.x, v.y, v.r, 0, 6.2832); g.stroke()
122
+ }
123
+ if (spout) {
124
+ // 水柱:从呆毛往上一道发亮的水
125
+ var p = Math.min(1, spout.age / 300), fade = Math.max(0, 1 - Math.max(0, spout.age - 1300) / 1000)
126
+ var hgt = Math.min(spout.y, 320) * p
127
+ var gr = g.createLinearGradient(0, spout.y, 0, spout.y - hgt)
128
+ gr.addColorStop(0, 'rgba(160,205,255,' + (0.85 * fade) + ')'); gr.addColorStop(1, 'rgba(160,205,255,0)')
129
+ g.fillStyle = gr
130
+ g.shadowColor = 'rgba(170,210,255,.9)'; g.shadowBlur = 18
131
+ g.beginPath(); g.moveTo(spout.x - 12, spout.y); g.quadraticCurveTo(spout.x, spout.y - hgt * 0.6, spout.x - 4, spout.y - hgt)
132
+ g.lineTo(spout.x + 4, spout.y - hgt); g.quadraticCurveTo(spout.x, spout.y - hgt * 0.6, spout.x + 12, spout.y); g.fill(); g.shadowBlur = 0
133
+ }
134
+ document.body.style.setProperty('--yu-flash', flash.toFixed(3))
135
+ document.body.style.setProperty('--yu-alarm', alarm.toFixed(3))
136
+ }
137
+
138
+ function tick(now) {
139
+ var dt = last === 0 ? 16.67 : Math.min(60, now - last); last = now
140
+ clock += dt; step(dt); draw(clock)
141
+ raf = requestAnimationFrame(tick)
142
+ }
143
+ function resize() {
144
+ W = window.innerWidth; H = window.innerHeight
145
+ cv.width = Math.round(W * DPR); cv.height = Math.round(H * DPR)
146
+ cv.style.width = W + 'px'; cv.style.height = H + 'px'
147
+ seed()
148
+ }
149
+ function field() { var el = document.getElementById('password'); var r = el ? el.getBoundingClientRect() : { left: W / 2, width: 0, top: H / 2, height: 0 }; return { x: r.left + r.width * 0.5, y: r.top + r.height * 0.5, l: r.left, w: r.width, t: r.top } }
150
+
151
+ addEventListener('dsh-login', function (e) {
152
+ var kind = e.detail && e.detail.type
153
+ if (kind === 'input') {
154
+ var f = field()
155
+ for (var i = 0; i < 3; i++) { var b = bubble(f.l + rnd(0.15, 0.85) * f.w, f.t + 4, rnd(0.25, 0.6), true); b.vy = -rnd(1.2, 2.4); b.life = rnd(900, 1500); bubbles.push(b) }
156
+ } else if (kind === 'error') {
157
+ var f2 = field(); alarm = 1
158
+ waves.push({ x: f2.x, y: f2.y, r: 10, sp: 14, str: 2.6, age: 0, life: 900, red: true })
159
+ } else if (kind === 'success') {
160
+ var hb = heroBox(); flash = 1
161
+ // 呆毛在 logo 上大约 (50%, 10%) 的位置
162
+ if (hb) spout = { x: hb.left + hb.width * 0.5, y: hb.top + hb.height * 0.1, age: 0 }
163
+ var c = field(); waves.push({ x: c.x, y: c.y, r: 10, sp: 18, str: 1.4, age: 0, life: 900 })
164
+ for (var j = 0; j < bubbles.length; j++) bubbles[j].vy -= rnd(1.5, 4)
165
+ } else if (kind === 'focus') {
166
+ document.body.classList.add('yu-focus')
167
+ } else if (kind === 'blur') {
168
+ document.body.classList.remove('yu-focus')
169
+ }
170
+ })
171
+
172
+ resize()
173
+ var rt; addEventListener('resize', function () { clearTimeout(rt); rt = setTimeout(resize, 120) })
174
+ // logo 图片加载完位置才准:再撒一次星星
175
+ if (hero && !hero.complete) hero.addEventListener('load', seed, { once: true })
176
+
177
+ window.__yushoScene = {
178
+ advance: function (ms) { for (var t = 0; t < ms; t += 16.67) { clock += 16.67; step(16.67) } draw(clock); return Math.round(clock) },
179
+ emit: function (type) { dispatchEvent(new CustomEvent('dsh-login', { detail: { type: type } })) },
180
+ count: function () { return bubbles.length },
181
+ }
182
+ if (reduce) { for (var it = 0; it < 120; it++) step(16.67); draw(0); return }
183
+ document.addEventListener('visibilitychange', function () { if (document.hidden) { cancelAnimationFrame(raf); raf = 0 } else if (raf === 0) { last = 0; raf = requestAnimationFrame(tick) } })
184
+ raf = requestAnimationFrame(tick)
185
+ }
186
+ /* eslint-enable no-var */
187
+
188
+ /** 画面的层:深海渐变、光束、水面光斑、气泡画布、Sho 酱的 logo;还有让卡片靠右的版式 */
189
+ export const YUSHO_SCENE_HTML = `<div class="bg yu-sea" aria-hidden="true"><i class="yu-ray r1"></i><i class="yu-ray r2"></i><i class="yu-ray r3"></i><i class="yu-caustic"></i><i class="yu-glow"></i><i class="yu-flash"></i></div><canvas class="bg" id="yu-cv" aria-hidden="true"></canvas><img id="yu-hero" class="yu-hero" src="/_web-login/brand/logo.svg" alt="鱼Sho">`
190
+
191
+ export const YUSHO_SCENE_CSS = `
192
+ .yu-sea { background: radial-gradient(120% 80% at 30% 0%, #2a46c8 0%, #142a8f 28%, #0b1757 58%, #060b2c 100%); overflow: hidden; }
193
+ .yu-ray { position: absolute; top: -20%; width: 22vw; height: 140%; background: linear-gradient(180deg, rgba(150,185,255,.20), rgba(150,185,255,0) 70%); filter: blur(18px); transform-origin: top center; mix-blend-mode: screen; }
194
+ .yu-ray.r1 { left: 8%; transform: rotate(18deg); animation: yu-sway 13s ease-in-out infinite alternate; }
195
+ .yu-ray.r2 { left: 34%; width: 14vw; transform: rotate(12deg); opacity: .7; animation: yu-sway 17s ease-in-out -4s infinite alternate; }
196
+ .yu-ray.r3 { left: 62%; width: 18vw; transform: rotate(22deg); opacity: .55; animation: yu-sway 21s ease-in-out -9s infinite alternate; }
197
+ @keyframes yu-sway { from { transform: rotate(10deg) translateX(-2vw); } to { transform: rotate(24deg) translateX(2vw); } }
198
+ .yu-caustic { position: absolute; inset: 0 0 55% 0; background:
199
+ radial-gradient(40% 18% at 20% 10%, rgba(170,200,255,.16), transparent 70%),
200
+ radial-gradient(30% 14% at 60% 4%, rgba(170,200,255,.12), transparent 70%),
201
+ radial-gradient(36% 16% at 85% 12%, rgba(170,200,255,.10), transparent 70%);
202
+ animation: yu-caustic 9s ease-in-out infinite alternate; }
203
+ @keyframes yu-caustic { from { transform: translateX(-3%) scaleY(1); } to { transform: translateX(3%) scaleY(1.15); } }
204
+ .yu-glow { position: absolute; left: var(--yu-hx, 27%); top: 58%; width: 44vmin; height: 12vmin; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(110,150,255,.55), transparent); filter: blur(10px); }
205
+ .yu-flash { position: absolute; inset: 0; background: radial-gradient(70% 60% at 30% 40%, rgba(220,232,255,1), rgba(220,232,255,0) 70%); opacity: calc(var(--yu-flash, 0) * .55); }
206
+ .yu-sea::after { content: ''; position: absolute; inset: 0; background: rgba(255,40,70,.5); opacity: calc(var(--yu-alarm, 0) * .35); }
207
+ .yu-hero { position: fixed; z-index: 1; left: 27%; top: 46%; width: min(44vw, 640px); transform: translate(-50%, -50%); pointer-events: none; user-select: none;
208
+ filter: drop-shadow(0 18px 40px rgba(5,10,40,.55)); animation: yu-float 6s ease-in-out infinite; }
209
+ @keyframes yu-float { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-50%, calc(-50% - 10px)); } }
210
+ body.yu-focus .yu-hero { filter: drop-shadow(0 18px 40px rgba(5,10,40,.55)) drop-shadow(0 0 28px rgba(120,160,255,.45)); }
211
+ body:has(#yu-hero) { justify-content: flex-end; padding-right: max(24px, 9vw); }
212
+ body:has(#yu-hero) .card-glass { background: rgba(14,22,70,.55); border-color: rgba(160,190,255,.22); box-shadow: 0 30px 80px rgba(3,8,40,.6), inset 0 1px 0 rgba(255,255,255,.08); }
213
+ @media (max-width: 900px) {
214
+ body:has(#yu-hero) { justify-content: center; padding: 24px; align-items: flex-end; padding-bottom: 8vh; }
215
+ .yu-hero { left: 50%; top: 24%; width: min(78vw, 420px); }
216
+ .yu-glow { left: 50%; top: 34%; }
217
+ }
218
+ @media (prefers-reduced-motion: reduce) { .yu-ray, .yu-caustic, .yu-hero { animation: none !important; } }
219
+ `
220
+
221
+ /**
222
+ * 「深海·Sho 酱」的内联脚本。
223
+ * @returns {string} 脚本源码(不带 <script>)。
224
+ */
225
+ export function yushoScript() {
226
+ return `;(${scene.toString()})({});`
227
+ }
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@yusho/server",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.16",
4
+ "description": "鱼Sho 服务器版:完整的 DeepSeek Harness 网页版 + 鱼Sho(会话、圈子、Sho 酱、工作台、接单),装在服务器上用浏览器打开",
5
+ "type": "module",
6
+ "bin": {
7
+ "yusho": "bin/yusho.mjs"
8
+ },
9
+ "engines": {
10
+ "node": ">=24.11"
11
+ },
12
+ "files": [
13
+ "bin",
14
+ "app",
15
+ "connector",
16
+ "run.mjs",
17
+ "pc.patch.yml",
18
+ "backup.mjs",
19
+ "README.md"
20
+ ],
21
+ "homepage": "https://yusho.chat",
22
+ "dependencies": {
23
+ "@deepseek-ai/dsh": "0.2.3-alpha.2",
24
+ "nostr-tools": "^2.26.1",
25
+ "qrcode": "^1.5.4",
26
+ "undici": "^8.11.2",
27
+ "node-datachannel": "0.33.7",
28
+ "@agentclientprotocol/sdk": "^2.7.0",
29
+ "zod": "^3.25.76 || ^4.0.0",
30
+ "@local/shoal-mobile": "0.0.1",
31
+ "@local/yusho-pc": "0.2.0",
32
+ "@local/yusho-web-login": "1.0.0"
33
+ },
34
+ "bundleDependencies": [
35
+ "@local/shoal-mobile",
36
+ "@local/yusho-pc",
37
+ "@local/yusho-web-login"
38
+ ],
39
+ "license": "MIT"
40
+ }
package/pc.patch.yml ADDED
@@ -0,0 +1,83 @@
1
+ # 鱼Sho 电脑版:完整 DSH 网页版(官方 web 配置 = dsh-base + dsh-web-app)上的补丁。
2
+ # 原则(11-26 定):在 DSH 上面升级,不阉割 DSH。所以这里只“加”,不关 DSH 的任何功能:
3
+ # 1. 加 DSH 自己的 SDK 服务(JSON-RPC):鱼Sho 内核(launcher.mjs,和手机同一份)经它开会话、跑助理和工作秘书;
4
+ # 这些会话和网页版里的会话在同一个库里,左栏“任务”里看得到。
5
+ # 2. 加鱼Sho 的后端插件(派活工具、/api/yusho 转发)和电脑版界面插件(@local/yusho-pc)。
6
+ # 3. 网页地址、端口、凭证文件按鱼Sho 的来;不自动打开浏览器(由外壳或测试脚本打开)。
7
+
8
+ - insert:
9
+ - id: sdk-app-startup
10
+ name: '@deepseek-ai/dsh-sdk-app'
11
+ config:
12
+ profile: web
13
+ - id: sdk-jsonrpc-server
14
+ name: '@deepseek-ai/dsh-sdk-jsonrpc-server'
15
+ inject: [sdkAppStartup, loader]
16
+
17
+ - insert:
18
+ - id: shoal-mobile
19
+ name: '@local/shoal-mobile'
20
+ - id: yusho-pc
21
+ name: '@local/yusho-pc'
22
+ # 每件任务的“工作秘书”“交给谁”:作为运行时上下文交给模型(不往对话里插文字),见 shoal-mobile/lib/session-context.js
23
+ - id: yusho-session-context
24
+ name: '@local/shoal-mobile/session-context'
25
+
26
+ # 鱼Sho 官方插件「登录与安全」(原 dsh-web-login):网页版放到公网时的访问密码、登录页、IP 封禁、访问记录。
27
+ # 电脑上不用(只有本机能打开);服务器版 yusho 命令在放到公网(--public-url)或加了 --login 时设 YUSHO_WEB_LOGIN=1 打开。
28
+ # 密码哈希和记录在数据目录(YUSHO_WEB_LOGIN_DIR);密码用 yusho password 设
29
+ - insert:
30
+ - id: yusho-web-login
31
+ name: '@local/yusho-web-login'
32
+ disabled: !!js "process.env.YUSHO_WEB_LOGIN !== '1'"
33
+
34
+ # 网页启动参数:DSH 自己的 web-startup 从命令行读,可鱼Sho 的内核是在进程里起 DSH 的,命令行会被 SDK 那一行抢先解析(不认 --port 等就报错)。
35
+ # 换成鱼Sho 的同名服务(@local/shoal-mobile/web-startup),值从环境变量来:yusho 命令把 --host / --port / --public-url / --trusted-host / --tls-* 换成这些变量。
36
+ # 电脑版、开发时不设,就是本机 127.0.0.1 和 SHOAL_WEB_PORT
37
+ - id: web-startup
38
+ disabled: true
39
+ - insert:
40
+ - id: yusho-web-startup
41
+ name: '@local/shoal-mobile/web-startup'
42
+
43
+ - id: webserver
44
+ config:
45
+ host: !!js ctx.webStartup.host ?? '127.0.0.1'
46
+ port: !!js ctx.webStartup.port ?? Number(process.env.SHOAL_WEB_PORT || 8791)
47
+ tls: !!js ctx.webStartup.tls
48
+ compression: gzip
49
+ compressionLevel: 1
50
+ compressionThresholdBytes: 1024
51
+
52
+ - id: web-runtime
53
+ config:
54
+ publicUrl: !!js ctx.webStartup.publicUrl
55
+ surfaceContext: true
56
+ openBrowser: false
57
+ printUrl: true
58
+
59
+ # 模型密钥:鱼Sho 的模型设置写在 App 自己的凭证文件里(和手机一样),不碰 ~/.dsh
60
+ - id: credentials
61
+ config:
62
+ path: !!js process.env.SHOAL_CRED_PATH
63
+ watch: false
64
+ # 模型只配一次(v6 设计):DSH 的任务和 Sho 酱用同一个模型列表,由鱼Sho 内核算好
65
+ - id: llm-pi-ai
66
+ config:
67
+ providers: !!js JSON.parse(process.env.SHOAL_PROVIDERS || '{}')
68
+ # DSH 自己新开的会话(左栏“任务”)默认用鱼Sho 里在用的那个模型
69
+ - id: agent-default-model
70
+ config:
71
+ provider: !!js process.env.SHOAL_DEFAULT_PROVIDER || 'shoal'
72
+ model: !!js process.env.SHOAL_MODEL_ID || 'none'
73
+ # 会思考的模型要带一档思考深度,不然 DSH 当作没选模型(launcher.mjs 算好放在 SHOAL_MODEL_EFFORT)
74
+ reasoningEffort: !!js process.env.SHOAL_MODEL_EFFORT || undefined
75
+
76
+ # 品牌:独立电脑版叫“鱼Sho”。DSH 官方的鲸鱼标志和字样由 @local/yusho-pc 换成 Sho 酱(只关这一行,DSH 别的界面都不动)
77
+ - id: ui-brand-official
78
+ disabled: true
79
+
80
+ # 测试时(设了 YUSHO_PC_DOCS):DSH 的“默认工作区”放进测试目录,不用你“文档”里的 deepseek-harness 文件夹。正式版不设,跟 DSH 一样
81
+ - id: workspace-controller
82
+ config:
83
+ documentsDirectory: !!js process.env.YUSHO_PC_DOCS || undefined
package/run.mjs ADDED
@@ -0,0 +1,136 @@
1
+ // 鱼Sho 电脑版(开发用启动入口):在完整 DSH 网页版上跑鱼Sho 内核(和手机同一份 launcher.mjs)。
2
+ // node spike/dsh-pc/run.mjs → 内核接口 127.0.0.1:8777,网页界面 127.0.0.1:8791(地址带一次性口令,见 /api/ui-url)
3
+ // 所有数据都在测试目录里(默认 D:/A-Claude-1/dsh-pc),不碰 ~/.dsh 和 D:/ruanjian/dsh。
4
+ // 模型密钥:从本机 DSH 的凭证文件读 MiMo 的密钥进内存(不打印、不写文件),和 run-pc.mjs 一样。
5
+ import fs from 'node:fs'
6
+ import os from 'node:os'
7
+ import path from 'node:path'
8
+ import { spawn } from 'node:child_process'
9
+ import { fileURLToPath, pathToFileURL } from 'node:url'
10
+
11
+ // 外面一层只管看着内核:内核退出码 75 = 要换身份重启(扫码登录、退出登录),马上再起一个;别的退出码就跟着退出
12
+ if (!process.env.YUSHO_PC_CHILD) {
13
+ const run = () => {
14
+ const c = spawn(process.execPath, [fileURLToPath(import.meta.url)], { stdio: 'inherit', env: { ...process.env, YUSHO_PC_CHILD: '1' } })
15
+ c.on('exit', (code) => { if (code === 75) { console.error('[鱼Sho 电脑版] 换身份,重启内核'); run() } else process.exit(code ?? 0) })
16
+ for (const sig of ['SIGINT', 'SIGTERM']) process.once(sig, () => c.kill(sig))
17
+ }
18
+ run()
19
+ } else {
20
+ const here = path.dirname(fileURLToPath(import.meta.url))
21
+ const ROOT = path.resolve(process.env.YUSHO_PC_ROOT || 'D:/A-Claude-1/dsh-pc') // 装着 DSH 0.2.3 和鱼Sho 插件的目录
22
+ const APP = path.resolve(process.env.SHOAL_APP_DIR || path.join(ROOT, 'data'))
23
+ // 正式版(外壳设了 YUSHO_RELEASE):密钥只从鱼Sho 自己的模型设置里来,不读测试目录的 secrets.env,也不读 ~/.dsh 的凭证
24
+ const REL = !!process.env.YUSHO_RELEASE
25
+ // 测试目录里的 secrets.env(用户给的密钥,只在这台电脑上,不进代码库)优先:一行一个 名字=值
26
+ if (!REL) try {
27
+ for (const line of fs.readFileSync(path.join(ROOT, 'secrets.env'), 'utf8').split(/\r?\n/)) {
28
+ const m = /^\s*([A-Z0-9_]+)\s*=\s*(\S+)\s*$/.exec(line); if (m && !process.env[m[1]]) process.env[m[1]] = m[2]
29
+ }
30
+ } catch {}
31
+ if (!REL) try {
32
+ const cred = fs.readFileSync(path.join(os.homedir(), '.dsh/.credentials.yaml'), 'utf8')
33
+ // 本机已有的模型密钥读进内存(不打印、不写文件):MiMo、DeepSeek。鱼Sho 的模型列表里用 keyFrom 指向它们
34
+ for (const name of ['MIMO_API_KEY', 'DEEPSEEK_API_KEY']) {
35
+ const k = (cred.match(new RegExp('^\\s+' + name + ':\\s*[\'"]?([^\'"\\s]+)', 'm')) || [])[1]
36
+ if (k && !process.env[name]) process.env[name] = k
37
+ }
38
+ } catch {}
39
+ // 内核的本机接口(127.0.0.1:8777)要口令:不然这台电脑上随便哪个网页都能往它发请求(发消息、批审批)。
40
+ // 网页界面走 DSH 的 /api/yusho(进程内调用,不经这个端口),不受影响;开发脚本从 data/local-secret 读口令
41
+ if (!process.env.SHOAL_LOCAL_SECRET) {
42
+ const f = path.join(APP, 'local-secret')
43
+ let k = ''; try { k = fs.readFileSync(f, 'utf8').trim() } catch {}
44
+ if (!/^[\w-]{24,}$/.test(k)) { k = (await import('node:crypto')).randomBytes(24).toString('base64url'); fs.mkdirSync(APP, { recursive: true }); fs.writeFileSync(f, k, { mode: 0o600 }) }
45
+ process.env.SHOAL_LOCAL_SECRET = k
46
+ }
47
+ Object.assign(process.env, {
48
+ DSH_ROOT: ROOT,
49
+ SHOAL_APP_DIR: APP,
50
+ SHOAL_DSH_HOME: process.env.SHOAL_DSH_HOME || path.join(ROOT, 'home'),
51
+ SHOAL_PROFILE: 'web',
52
+ SHOAL_BASE_PATCH: path.join(here, 'pc.patch.yml'),
53
+ SHOAL_PORT: process.env.SHOAL_PORT || '8777',
54
+ SHOAL_WEB_PORT: process.env.SHOAL_WEB_PORT || '8791',
55
+ SHOAL_PLATFORM: 'pc',
56
+ YUSHO_PC_DOCS: process.env.YUSHO_PC_DOCS ?? path.join(ROOT, 'documents'),
57
+ // 接单(替代单独的连接器):deploy.mjs 复制过来的连接器代码
58
+ ...(fs.existsSync(path.join(ROOT, 'connector/lib/connector.mjs')) && !process.env.YUSHO_NO_CONNECTOR ? { YUSHO_CONNECTOR: path.join(ROOT, 'connector/lib/connector.mjs') } : {}), // 测试用:DSH 的默认工作区放在测试目录里
59
+ })
60
+ // DSH 0.2.3 的“Codex / Claude Code 当子 Agent”:两个官方可选包,装了就叠上它们自己的补丁(YUSHO_NO_SUBAGENTS=1 关掉)
61
+ const extra = []
62
+ // DSH 的实验包“自动审查”(Auto review):每次调用工具前,当前 Agent 的模型先看一遍,普通的直接做、有风险的才停下问你。
63
+ // 鱼Sho 里叫“让工作秘书判断”(权限选择器里的第四档),v6 / 用户 11-29:“AI 判断完应该直接执行,拿不准的才走人工”
64
+ // DSH 的实验包“自定义插件索引”:加一个插件市场的地址(直接给 JSON 的网址,或者 GitHub 等 Git 仓库),就能在 DSH 插件页的“发现”里浏览、安装里面的插件。
65
+ // 鱼Sho 工作台右上角的“源”管这些地址(11-29 用户:像群晖套件中心加套件源)。
66
+ // 要放进 web 配置的组合包列表(和在 DSH 插件页里打开实验插件一样),不能当命令行补丁叠上去:那样源的地址存不进配置
67
+ // 单独装的连接器(旧名 dsh-yusho-skill,12-03 起叫 @yusho/dsh-yusho-connect):电脑版自己就带接单,两个一起跑 = 同一台电脑两个身份、手机里看到两台、活接两遍;
68
+ // 它的依赖写的是一个网址,DSH 每次启动还要去对一遍,启动从十几秒拖到两分多钟(12-01 在用户电脑上实测 145 秒 → 15 秒)。
69
+ // 所以启动时从 DSH 的插件列表里拿掉它(留一份备份;文件不删,想装回去随时能装)
70
+ {
71
+ const pj = path.join(process.env.SHOAL_DSH_HOME || path.join(ROOT, 'home'), 'profiles/web/package.json')
72
+ try {
73
+ const j = JSON.parse(fs.readFileSync(pj, 'utf8')), b = j.dsh?.profile?.bundles
74
+ const OLD = ['dsh-yusho-skill', '@yusho/dsh-yusho-connect']
75
+ if (Array.isArray(b) && b.some((x) => OLD.includes(x))) {
76
+ fs.copyFileSync(pj, pj + '.before-yusho-' + Date.now())
77
+ j.dsh.profile.bundles = b.filter((x) => !OLD.includes(x)); if (j.dependencies) for (const n of OLD) delete j.dependencies[n]
78
+ fs.writeFileSync(pj, JSON.stringify(j, null, 2) + String.fromCharCode(10))
79
+ fs.mkdirSync(APP, { recursive: true }); fs.writeFileSync(path.join(APP, 'old-connector-removed.json'), JSON.stringify({ at: Date.now() }))
80
+ console.error('[鱼Sho 电脑版] 从 DSH 的插件里拿掉了单独装的连接器(电脑版自己就带接单)')
81
+ }
82
+ } catch {} // 第一次启动时 DSH 还没建 web 配置
83
+ }
84
+ if (!process.env.YUSHO_NO_PLUGIN_MARKET && fs.existsSync(path.join(ROOT, 'node_modules/@deepseek-ai/dsh-experimental-plugin-market-bundle/package.json'))) {
85
+ const pj = path.join(process.env.SHOAL_DSH_HOME || path.join(ROOT, 'home'), 'profiles/web/package.json')
86
+ try {
87
+ const j = JSON.parse(fs.readFileSync(pj, 'utf8')), b = j.dsh?.profile?.bundles
88
+ const MB = '@deepseek-ai/dsh-experimental-plugin-market-bundle'
89
+ if (Array.isArray(b) && !b.includes(MB)) { b.push(MB); fs.writeFileSync(pj, JSON.stringify(j, null, 2) + String.fromCharCode(10)) }
90
+ } catch {} // 第一次启动时 DSH 还没建 web 配置:下次启动再加
91
+ }
92
+ { const p = path.join(ROOT, 'node_modules/@deepseek-ai/dsh-experimental-auto-review/cordis.patch.yml'); if (fs.existsSync(p) && !process.env.YUSHO_NO_AUTO_REVIEW) extra.push(p) }
93
+ if (!process.env.YUSHO_NO_SUBAGENTS) extra.push(...['dsh-subagent-codex', 'dsh-subagent-claude-code'].map((n) => path.join(ROOT, 'node_modules/@deepseek-ai', n, 'cordis.patch.yml')).filter((p) => fs.existsSync(p)))
94
+ // “工作秘书”预设(v6:任务就是 DSH 的会话,干活的是 DSH 自己 + 工作秘书的说法):
95
+ // 从 DSH 自己的 standard 预设生成,工具一样(DSH 升级时跟着变),只换编号、名字、人设,并设成新任务的默认预设。
96
+ // DSH 改了那个文件的写法、对不上时不生成,退回 DSH 默认的预设
97
+ {
98
+ const std = path.join(ROOT, 'node_modules/@deepseek-ai/dsh-web-app/presets/standard.patch.yml')
99
+ const PERSONA = '你是用户的工作秘书,在用户电脑上的「鱼Sho」里干活,用的是 {{model}} 模型。说中文,先给结论。\n这台电脑上的事你自己做:读写文件、跑命令、上网查资料。一次性、不用用户批的活可以交给 Codex 或 Claude Code 子 Agent;要在别的电脑上做的,用派活工具交给连着的电脑。\n会改用户的东西、花钱、对外发消息的事,先跟用户确认。做完一件事,用一两句话说清做了什么、结果在哪。'
100
+ try {
101
+ let y = fs.readFileSync(std, 'utf8')
102
+ const swap = (a, b) => { if (y.split(a).length !== 2) throw new Error('对不上:' + a); y = y.replace(a, b) }
103
+ swap(' - id: preset-standard\n', ' - id: preset-secretary\n')
104
+ swap(' id: standard\n order: 1\n', ` id: secretary\n name: 工作秘书\n description: ${JSON.stringify('工作流到点自动跑时用。平时的任务里,用输入框上面的“工作秘书”开关叫她,不用选这个模式')}\n order: 5\n`)
105
+ swap(' prefix: You are a coding agent powered by the {{model}} model.\n', ` prefix: ${JSON.stringify(PERSONA)}\n`)
106
+ const out = path.join(APP, 'secretary.patch.yml'); fs.mkdirSync(APP, { recursive: true }); fs.writeFileSync(out, y); extra.push(out)
107
+ } catch (e) { console.error('[鱼Sho 电脑版] 没生成“工作秘书”预设:', e.message) }
108
+ }
109
+ // 正式版:DSH 的“家”(profiles 等)在用户数据目录里(%APPDATA%\YuSho\dsh-home),DSH 从那里按 Node 的规矩往上找插件包(@local/…)。
110
+ // 往上找不到安装目录,所以在它下面放一个 node_modules 链接(目录联接,不用管理员权限)指向安装目录的 node_modules;装到别处、更新后指错了就重建
111
+ if (REL) {
112
+ const link = path.join(process.env.SHOAL_DSH_HOME, 'node_modules'), want = path.join(ROOT, 'node_modules')
113
+ fs.mkdirSync(process.env.SHOAL_DSH_HOME, { recursive: true })
114
+ let cur = null; try { cur = fs.readlinkSync(link) } catch {}
115
+ if (!cur || path.resolve(cur) !== path.resolve(want)) {
116
+ if (cur) try { fs.rmdirSync(link) } catch {} // 只删链接本身(readlink 成功 = 它是链接;rmdir 删联接不碰它指向的目录)
117
+ try { fs.symlinkSync(want, link, 'junction') } catch (e) { console.error('[鱼Sho 电脑版] 插件目录链接没建成:', e.message) }
118
+ }
119
+ }
120
+ process.env.SHOAL_EXTRA_PATCH = [...extra, ...(process.env.SHOAL_EXTRA_PATCH ? process.env.SHOAL_EXTRA_PATCH.split(';') : [])].join(';')
121
+ // 换版本前先备份(12-03):鱼Sho 或自带的 DSH 版本和上次启动时不一样,就把鱼Sho 的数据和 DSH 的数据(会话记录等)复制一份再启动。
122
+ // 备份在数据目录旁边的 backups/(正式版 %APPDATA%\YuSho\backups),只留最近 3 份。安装包、日志不备份
123
+ try {
124
+ const { backupOnVersionChange, findPkgVersion } = await import(pathToFileURL(path.join(here, 'backup.mjs')).href)
125
+ backupOnVersionChange({
126
+ stateFile: path.join(APP, 'versions.json'),
127
+ dest: path.join(path.dirname(APP), 'backups'),
128
+ sources: [{ name: 'data', dir: APP, skip: ['update', 'logs', 'versions.json'] }, { name: 'dsh-home', dir: process.env.SHOAL_DSH_HOME, skip: ['node_modules'] }],
129
+ versions: { app: process.env.SHOAL_APP_VERSION ?? 'dev', dsh: findPkgVersion('@deepseek-ai/dsh', [ROOT]) },
130
+ log: (s) => console.error('[鱼Sho 电脑版] ' + s),
131
+ })
132
+ } catch (e) { console.error('[鱼Sho 电脑版] 换版本备份出错(照常启动):', e.message) }
133
+ // launcher 在部署目录里(run.mjs 同目录下的 app/,由 deploy.mjs 从 spike/dsh-mobile/app 复制)
134
+ const launcher = fs.existsSync(path.join(ROOT, 'app/launcher.mjs')) ? path.join(ROOT, 'app/launcher.mjs') : path.resolve(here, '../dsh-mobile/app/launcher.mjs')
135
+ await import(pathToFileURL(launcher).href)
136
+ }