dsh-thinking-orbs 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +3 -0
- package/README.md +21 -3
- package/cordis.patch.yml +4 -0
- package/lib/client.js +803 -0
- package/lib/index.js +4 -0
- package/package.json +45 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-thinking-orbs contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# dsh-thinking-orbs
|
|
2
|
+
|
|
3
|
+
Индикатор [thinking-orbs](https://github.com/Jakubantalik/thinking-orbs) рядом со строкой «Deep diving...» в веб-интерфейсе [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
|
|
4
|
+
|
|
5
|
+
Пока модель отвечает, слева от строки рисуется шар. Анимация зависит от текущего инструмента: поиск, терминал, вопрос, MCP, картинка, видео. Цвет берётся из темы DSH.
|
|
6
|
+
|
|
7
|
+
В шапке сайдбара тот же шар в состоянии `listening` занимает место рыбы. Холст 24×24. Надпись и бейдж остаются, клик по строке по-прежнему открывает новую сессию.
|
|
8
|
+
|
|
9
|
+
## Установка
|
|
10
|
+
|
|
11
|
+
Нужен Node.js 22.19 или новее и запущенный `dsh`.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
dsh plugin --profile web add dsh-thinking-orbs
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
После установки перезапустите `dsh` и обновите страницу.
|
|
18
|
+
|
|
19
|
+
## Лицензия
|
|
20
|
+
|
|
21
|
+
MIT. Движок шара — thinking-orbs, MIT © Jakub Antalik. См. `NOTICE`.
|
package/cordis.patch.yml
ADDED
package/lib/client.js
ADDED
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: 'dsh-thinking-orbs',
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
const module = { exports: {} }
|
|
5
|
+
const exports = module.exports
|
|
6
|
+
var __create = Object.create;
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
|
|
34
|
+
// src/browser.js
|
|
35
|
+
var browser_exports = {};
|
|
36
|
+
__export(browser_exports, {
|
|
37
|
+
apply: () => apply,
|
|
38
|
+
inject: () => inject
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(browser_exports);
|
|
41
|
+
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
|
|
43
|
+
// node_modules/thinking-orbs/dist/engine.es.js
|
|
44
|
+
function U(n, s, t) {
|
|
45
|
+
return n + (s - n) * t;
|
|
46
|
+
}
|
|
47
|
+
function nt(n) {
|
|
48
|
+
return n - Math.floor(n);
|
|
49
|
+
}
|
|
50
|
+
function G(n, s) {
|
|
51
|
+
const t = Math.floor(n), r = Math.floor(s);
|
|
52
|
+
let a = n - t, o = s - r;
|
|
53
|
+
a = a * a * (3 - 2 * a), o = o * o * (3 - 2 * o);
|
|
54
|
+
const c = E(t, r), M = E(t + 1, r), h = E(t, r + 1), m = E(t + 1, r + 1);
|
|
55
|
+
return c + (M - c) * a + (h - c) * o + (c - M - h + m) * a * o;
|
|
56
|
+
}
|
|
57
|
+
function E(n, s) {
|
|
58
|
+
const t = Math.sin(n * 12.9898 + s * 78.233) * 43758.5453;
|
|
59
|
+
return t - Math.floor(t);
|
|
60
|
+
}
|
|
61
|
+
function J(n, s) {
|
|
62
|
+
const t = Math.PI * (3 - Math.sqrt(5)), r = 1 - 2 * (n + 0.5) / s, a = Math.sqrt(1 - r * r), o = n * t;
|
|
63
|
+
return [a * Math.cos(o), r, a * Math.sin(o)];
|
|
64
|
+
}
|
|
65
|
+
function et(n, s) {
|
|
66
|
+
return Math.atan2(Math.sin(n - s), Math.cos(n - s));
|
|
67
|
+
}
|
|
68
|
+
function _(n, s, t, r, a) {
|
|
69
|
+
const o = Math.sin(s), c = Math.cos(s), M = Math.sin(n), h = Math.cos(n);
|
|
70
|
+
return (m, D, p) => {
|
|
71
|
+
const e = m * h + p * M, l = -m * M + p * h, R = D * c - l * o, w = D * o + l * c;
|
|
72
|
+
return [t + e * a, r - R * a, w];
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function rt(n, s, t, r = 0.3) {
|
|
76
|
+
for (const a of s) {
|
|
77
|
+
const o = a.a ?? 1, c = Math.min(1, Math.max(0, a.white)), M = Math.round((t ? 1 - c : c) * 255);
|
|
78
|
+
n.fillStyle = `rgba(${M},${M},${M},${o})`, n.beginPath(), n.arc(a.x, a.y, a.r, 0, Math.PI * 2), n.fill();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function it(n, s, t) {
|
|
82
|
+
for (const r of s) {
|
|
83
|
+
const a = r.a ?? 1, o = Math.min(1, Math.max(0, r.white)), c = Math.round((t ? 1 - o : o) * 255);
|
|
84
|
+
n.strokeStyle = `rgba(${c},${c},${c},${a})`, n.lineWidth = r.w, n.beginPath(), n.moveTo(r.x1, r.y1), n.lineTo(r.x2, r.y2), n.stroke();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function L(n, s, t = 0.3) {
|
|
88
|
+
const r = [];
|
|
89
|
+
for (const a of n)
|
|
90
|
+
(a.a ?? 1) < 0.02 || (a.r = Math.max(t, a.r), r.push(a));
|
|
91
|
+
return r.sort((a, o) => a.z - o.z), { dots: r, lines: s.filter((a) => (a.a ?? 1) >= 0.02) };
|
|
92
|
+
}
|
|
93
|
+
function ht(n, s, t) {
|
|
94
|
+
s.lines.length && it(n, s.lines, t), rt(n, s.dots, t);
|
|
95
|
+
}
|
|
96
|
+
function $(n, s) {
|
|
97
|
+
return (n / 300) ** s;
|
|
98
|
+
}
|
|
99
|
+
var Mt = (n, s, t) => {
|
|
100
|
+
const r = n / 2, a = n / 2, o = n / 2 * 0.76, c = _(s * 0.4, 0.3, r, a, 1), M = $(n, t.rsPow ?? 0.6), h = [], m = t.ghostN ?? 150;
|
|
101
|
+
for (let e = 0; e < m; e++) {
|
|
102
|
+
const l = J(e, m), [R, w, i] = c(l[0] * o, l[1] * o, l[2] * o), u = (i / o + 1) / 2;
|
|
103
|
+
h.push({ x: R, y: w, z: i, r: 0.8 * M, white: 0.78, a: 0.1 + 0.22 * u });
|
|
104
|
+
}
|
|
105
|
+
const D = t.strandN ?? 52, p = t.turns ?? 3;
|
|
106
|
+
for (let e = 0; e < 3; e++) {
|
|
107
|
+
const l = e / 3 * 2 * Math.PI;
|
|
108
|
+
for (let R = 0; R < D; R++) {
|
|
109
|
+
const w = (nt(R / D + s * 0.045) * 2 - 1) * 0.96, i = Math.sqrt(Math.max(0, 1 - w * w)), u = Math.min(1, (1 - Math.abs(w)) / 0.1), y = w * Math.PI * p + l, b = 1 + 0.075 * Math.sin(w * Math.PI * p * 2 + l * 2 + s * 0.8), f = i * o * b, [P, x, g] = c(Math.cos(y) * f, w * o * b, Math.sin(y) * f), d = (g / o + 1) / 2;
|
|
110
|
+
h.push({
|
|
111
|
+
x: P,
|
|
112
|
+
y: x,
|
|
113
|
+
z: g,
|
|
114
|
+
r: ((t.rBase ?? 1.2) + (t.rDepth ?? 1.8) * d) * M,
|
|
115
|
+
white: 0.55 - 0.45 * d,
|
|
116
|
+
a: u * (0.45 + 0.55 * d)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return L(h, [], t.rMin);
|
|
121
|
+
};
|
|
122
|
+
function lt(n, s, t, r) {
|
|
123
|
+
const a = 2 * s * t + r, o = n % a, c = new Array(s).fill(0);
|
|
124
|
+
let M = -1;
|
|
125
|
+
if (o < 2 * s * t) {
|
|
126
|
+
const h = Math.floor(o / t), m = (o - h * t) / t, p = 1 - (1 - Math.min(1, m / 0.7)) ** 3;
|
|
127
|
+
if (h < s) {
|
|
128
|
+
for (let e = 0; e < h; e++) c[e] = 1;
|
|
129
|
+
c[h] = p, M = h;
|
|
130
|
+
} else {
|
|
131
|
+
const e = 2 * s - 1 - h;
|
|
132
|
+
for (let l = 0; l < e; l++) c[l] = 1;
|
|
133
|
+
c[e] = 1 - p, M = e;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return { amount: c, active: M };
|
|
137
|
+
}
|
|
138
|
+
function pt(n, s, t) {
|
|
139
|
+
let [r, a, o] = n, c = false;
|
|
140
|
+
for (let M = 0; M < s.length; M++) {
|
|
141
|
+
if (t.amount[M] <= 0) continue;
|
|
142
|
+
const h = s[M], m = h.axis === 0 ? r : h.axis === 1 ? a : o;
|
|
143
|
+
if (m < h.lo || m >= h.hi) continue;
|
|
144
|
+
M === t.active && (c = true);
|
|
145
|
+
const D = h.ang * t.amount[M], p = Math.cos(D), e = Math.sin(D);
|
|
146
|
+
if (h.axis === 0) {
|
|
147
|
+
const l = a * p - o * e;
|
|
148
|
+
o = a * e + o * p, a = l;
|
|
149
|
+
} else if (h.axis === 1) {
|
|
150
|
+
const l = r * p + o * e;
|
|
151
|
+
o = -r * e + o * p, r = l;
|
|
152
|
+
} else {
|
|
153
|
+
const l = r * p - a * e;
|
|
154
|
+
a = r * e + a * p, r = l;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return [r, a, o, c];
|
|
158
|
+
}
|
|
159
|
+
function ut(n) {
|
|
160
|
+
const s = [];
|
|
161
|
+
for (let t = 0; t < n; t++) {
|
|
162
|
+
const r = Math.min(2, Math.floor(E(t, 2.3) * 3)), a = -1 + 0.5 * Math.min(3, Math.floor(E(t, 5.9) * 4)), o = E(t, 7.7) < 0.5 ? 1 : -1;
|
|
163
|
+
s.push({ axis: r, lo: a, hi: a + 0.5, ang: o * Math.PI / 2 });
|
|
164
|
+
}
|
|
165
|
+
return s;
|
|
166
|
+
}
|
|
167
|
+
var ft = (n, s, t) => {
|
|
168
|
+
const a = n / 2, o = n / 2, c = n / 2 * 0.82, M = 0.4 + 0.06 * Math.sin(s * 0.35), h = _(s * 0.5, M, a, o, c), m = s * (0.5 + (1.7 - 0.5) * (t.scanMul ?? 1)), D = $(n, t.rsPow ?? 0.6), p = t.dimBase ?? 1, e = [], l = t.latRings ?? 17, R = t.lonDensity ?? 44;
|
|
169
|
+
for (let w = 0; w <= l; w++) {
|
|
170
|
+
const i = -Math.PI / 2 + w / l * Math.PI, u = Math.cos(i), y = Math.sin(i), b = Math.max(1, Math.round(Math.abs(u) * R));
|
|
171
|
+
for (let f = 0; f < b; f++) {
|
|
172
|
+
const P = f / b * 2 * Math.PI, [x, g, d] = h(u * Math.cos(P), y, u * Math.sin(P)), v = (d + 1) / 2, k = et(P + s * 0.5, m), N = Math.exp(-(k * k) / 0.18) * Math.max(0, d);
|
|
173
|
+
e.push({
|
|
174
|
+
x,
|
|
175
|
+
y: g,
|
|
176
|
+
z: d,
|
|
177
|
+
r: ((t.rBase ?? 0.6) + (t.rDepth ?? 1.7) * v + (t.rBoost ?? 1) * N) * D,
|
|
178
|
+
white: (t.inkFar ?? 0.62) - (t.inkSpan ?? 0.54) * v,
|
|
179
|
+
// dimBase < 1 fades un-scanned dots so the meridian reads clearly
|
|
180
|
+
a: p + (1 - p) * Math.min(1, N)
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return L(e, [], t.rMin);
|
|
185
|
+
};
|
|
186
|
+
var dt = (n, s, t) => {
|
|
187
|
+
const r = n / 2, a = n / 2, o = n / 2 * 0.82, c = _(s * 0.55, 0.35 + 0.1 * Math.sin(s * 0.9), r, a, o), M = $(n, t.rsPow ?? 0.6), h = t.moveCount ?? 14, m = ut(h), D = lt(s, h, 0.42, 1.2), p = [], e = t.latRings ?? 15, l = t.lonDensity ?? 40;
|
|
188
|
+
for (let R = 0; R <= e; R++) {
|
|
189
|
+
const w = -Math.PI / 2 + R / e * Math.PI, i = Math.cos(w), u = Math.sin(w), y = Math.max(1, Math.round(Math.abs(i) * l));
|
|
190
|
+
for (let b = 0; b < y; b++) {
|
|
191
|
+
const f = b / y * 2 * Math.PI, [P, x, g, d] = pt([i * Math.cos(f), u, i * Math.sin(f)], m, D), [v, k, N] = c(P, x, g), z = (N + 1) / 2;
|
|
192
|
+
p.push({
|
|
193
|
+
x: v,
|
|
194
|
+
y: k,
|
|
195
|
+
z: N,
|
|
196
|
+
r: ((t.rBase ?? 0.6) + (t.rDepth ?? 1.7) * z + (d ? t.rActive ?? 0.3 : 0)) * M,
|
|
197
|
+
white: (t.inkFar ?? 0.62) - (t.inkSpan ?? 0.54) * z - (d ? 0.14 : 0)
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return L(p, [], t.rMin);
|
|
202
|
+
};
|
|
203
|
+
var bt = (n, s, t) => {
|
|
204
|
+
const r = n / 2, a = n / 2, o = n / 2 * 0.874, c = _(s * 0.18, 0.38, r, a, 1), M = $(n, t.rsPow ?? 0.6), h = [], m = t.rings ?? 15, D = t.lonDensity ?? 40;
|
|
205
|
+
for (let p = 0; p <= m; p++) {
|
|
206
|
+
const e = -Math.PI / 2 + p / m * Math.PI, l = Math.cos(e), R = Math.sin(e), w = 0.62 * Math.sin(s * 2.1 - p * 0.52) + 0.38 * Math.sin(s * 1.27 + p * 0.83), i = o * (0.88 + 0.105 * w), u = Math.max(1, Math.round(Math.abs(l) * D));
|
|
207
|
+
for (let y = 0; y < u; y++) {
|
|
208
|
+
const b = y / u * 2 * Math.PI, [f, P, x] = c(l * Math.cos(b) * i, R * i, l * Math.sin(b) * i), g = (x / o + 1) / 2, d = Math.max(0, w);
|
|
209
|
+
h.push({
|
|
210
|
+
x: f,
|
|
211
|
+
y: P,
|
|
212
|
+
z: x,
|
|
213
|
+
r: ((t.rBase ?? 0.6) + (t.rDepth ?? 1.7) * g) * (1 + 0.4 * d) * M,
|
|
214
|
+
white: 0.66 - 0.56 * g - 0.1 * d
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return L(h, [], t.rMin);
|
|
219
|
+
};
|
|
220
|
+
function xt(n) {
|
|
221
|
+
return n * n * (3 - 2 * n);
|
|
222
|
+
}
|
|
223
|
+
function st(n) {
|
|
224
|
+
const s = n.length, t = [];
|
|
225
|
+
let r = 0;
|
|
226
|
+
for (let a = 0; a < s; a++) {
|
|
227
|
+
const o = n[a], c = n[(a + 1) % s], M = Math.hypot(c[0] - o[0], c[1] - o[1]);
|
|
228
|
+
t.push(M), r += M;
|
|
229
|
+
}
|
|
230
|
+
return (a) => {
|
|
231
|
+
let o = a * r, c = 0;
|
|
232
|
+
for (; o > t[c] && c < s - 1; )
|
|
233
|
+
o -= t[c], c++;
|
|
234
|
+
const M = n[c], h = n[(c + 1) % s], m = t[c] ? Math.min(1, o / t[c]) : 0;
|
|
235
|
+
return [M[0] + (h[0] - M[0]) * m, M[1] + (h[1] - M[1]) * m];
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
var yt = (n) => {
|
|
239
|
+
const s = -Math.PI / 2 + n * 2 * Math.PI;
|
|
240
|
+
return [Math.cos(s) * 0.24, Math.sin(s) * 0.24];
|
|
241
|
+
};
|
|
242
|
+
var gt = st([
|
|
243
|
+
[0, -0.26],
|
|
244
|
+
[0.24, 0.16],
|
|
245
|
+
[-0.24, 0.16]
|
|
246
|
+
]);
|
|
247
|
+
var mt = st([
|
|
248
|
+
[0, -0.2],
|
|
249
|
+
[0.2, -0.2],
|
|
250
|
+
[0.2, 0.2],
|
|
251
|
+
[-0.2, 0.2],
|
|
252
|
+
[-0.2, -0.2]
|
|
253
|
+
]);
|
|
254
|
+
var H = [yt, gt, mt];
|
|
255
|
+
function wt(n) {
|
|
256
|
+
return Math.max(6, Math.round(34 * n));
|
|
257
|
+
}
|
|
258
|
+
var V = 1.4;
|
|
259
|
+
var ot = 0.9;
|
|
260
|
+
var Q = V + ot;
|
|
261
|
+
var Pt = (n, s, t) => {
|
|
262
|
+
const r = H.length, a = s % (Q * r), o = Math.floor(a / Q), c = a - o * Q, M = c > V ? xt((c - V) / ot) : 0, h = t.spread ?? 1, m = H[o], D = H[(o + 1) % r], p = 160, e = [];
|
|
263
|
+
for (let x = 0; x < p; x++) {
|
|
264
|
+
const g = x / p, d = m(g), v = D(g);
|
|
265
|
+
e.push([(d[0] + (v[0] - d[0]) * M) * h, (d[1] + (v[1] - d[1]) * M) * h]);
|
|
266
|
+
}
|
|
267
|
+
const l = [];
|
|
268
|
+
let R = 0;
|
|
269
|
+
for (let x = 0; x < p; x++) {
|
|
270
|
+
const g = e[x], d = e[(x + 1) % p], v = Math.hypot(d[0] - g[0], d[1] - g[1]);
|
|
271
|
+
l.push(v), R += v;
|
|
272
|
+
}
|
|
273
|
+
const w = wt(t.iconD ?? 1), i = (t.rDot ?? 0.021) * 1.35 * h, u = 1 + 0.02 * Math.sin(c * 3.1), y = [], b = n / 2;
|
|
274
|
+
let f = 0, P = 0;
|
|
275
|
+
for (let x = 0; x < w; x++) {
|
|
276
|
+
const g = x / w * R;
|
|
277
|
+
for (; P + l[f] < g && f < p - 1; )
|
|
278
|
+
P += l[f], f++;
|
|
279
|
+
const d = e[f], v = e[(f + 1) % p], k = l[f] ? Math.min(1, (g - P) / l[f]) : 0, N = (d[0] + (v[0] - d[0]) * k) * u, z = (d[1] + (v[1] - d[1]) * k) * u;
|
|
280
|
+
y.push({
|
|
281
|
+
x: b + N * n,
|
|
282
|
+
y: b + z * n,
|
|
283
|
+
z: 0,
|
|
284
|
+
r: Math.max(0.35, i * n),
|
|
285
|
+
white: 0.1
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
return L(y, [], t.rMin);
|
|
289
|
+
};
|
|
290
|
+
var Rt = (n, s, t) => {
|
|
291
|
+
const r = n / 2, a = n / 2, o = n / 2 * 0.82, c = _(s * 0.12, 0.3, r, a, 1), M = $(n, t.rsPow ?? 0.6), h = [], m = t.orbitN ?? 12, D = t.ghostN ?? 40, p = t.particles ?? 3;
|
|
292
|
+
for (let e = 0; e < m; e++) {
|
|
293
|
+
const l = E(e, 1.7), R = E(e, 5.2), w = E(e, 8.9), i = o * (0.45 + 0.52 * l), u = l * 2 * Math.PI, y = Math.acos(2 * R - 1), b = Math.sin(y) * Math.cos(u), f = Math.cos(y), P = Math.sin(y) * Math.sin(u);
|
|
294
|
+
let x = -f, g = b;
|
|
295
|
+
const d = 0, v = Math.max(1e-6, Math.sqrt(x * x + g * g));
|
|
296
|
+
x /= v, g /= v;
|
|
297
|
+
const k = f * d - P * g, N = P * x - b * d, z = b * g - f * x, O = (0.25 + 0.55 * w) * (w > 0.5 ? 1 : -1);
|
|
298
|
+
for (let B = 0; B < D; B++) {
|
|
299
|
+
const I = B / D * 2 * Math.PI, [S, A, T] = c(
|
|
300
|
+
(x * Math.cos(I) + k * Math.sin(I)) * i,
|
|
301
|
+
(g * Math.cos(I) + N * Math.sin(I)) * i,
|
|
302
|
+
(d * Math.cos(I) + z * Math.sin(I)) * i
|
|
303
|
+
), C = (T / i + 1) / 2;
|
|
304
|
+
h.push({
|
|
305
|
+
x: S,
|
|
306
|
+
y: A,
|
|
307
|
+
z: T,
|
|
308
|
+
r: (t.ghostR ?? 0.9) * M,
|
|
309
|
+
white: 0.72,
|
|
310
|
+
a: (t.ghostA ?? 0.5) * (0.4 + 0.6 * C)
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
for (let B = 0; B < p; B++) {
|
|
314
|
+
const I = s * O + B / p * 2 * Math.PI + R * 6, [S, A, T] = c(
|
|
315
|
+
(x * Math.cos(I) + k * Math.sin(I)) * i,
|
|
316
|
+
(g * Math.cos(I) + N * Math.sin(I)) * i,
|
|
317
|
+
(d * Math.cos(I) + z * Math.sin(I)) * i
|
|
318
|
+
), C = (T / i + 1) / 2;
|
|
319
|
+
h.push({
|
|
320
|
+
x: S,
|
|
321
|
+
y: A,
|
|
322
|
+
z: T,
|
|
323
|
+
r: ((t.partR ?? 1.2) + (t.partRDepth ?? 1.6) * C) * M,
|
|
324
|
+
white: 0.3 - 0.22 * C
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return L(h, [], t.rMin);
|
|
329
|
+
};
|
|
330
|
+
var Z = (n, s, t) => {
|
|
331
|
+
const r = n / 2, a = n / 2, o = n / 2 * 0.78, c = t.spin ?? 1, M = 0.3, h = _(s * 0.1 * c, M, r, a, 1), m = $(n, t.rsPow ?? 0.6), D = [], p = t.ghostN ?? 150;
|
|
332
|
+
for (let z = 0; z < p; z++) {
|
|
333
|
+
const O = J(z, p), [B, I, S] = h(O[0] * o, O[1] * o, O[2] * o), A = (S / o + 1) / 2;
|
|
334
|
+
D.push({ x: B, y: I, z: S, r: 0.8 * m, white: 0.78, a: 0.1 + 0.22 * A });
|
|
335
|
+
}
|
|
336
|
+
const e = s * 0.24 * c, l = t.faceOn ? -M : 0.55 + 0.3 * Math.sin(s * 0.18) * c, R = Math.cos(e), w = 0, i = Math.sin(e), u = -i * Math.sin(l), y = Math.cos(l), b = R * Math.sin(l), f = w * b - i * y, P = i * u - R * b, x = R * y - w * u, g = 0.23 * (t.wobMul ?? 1), d = t.faceOn ? o / (1 + 0.85 * g) : o, v = t.lanes ?? 5, k = t.segs ?? 88, N = Math.max(1, Math.round(v * (t.bandMul ?? 1)));
|
|
337
|
+
for (let z = 0; z < N; z++) {
|
|
338
|
+
const O = (z - (N - 1) / 2) * 0.075, B = Math.abs(z - (N - 1) / 2) / Math.max(1, (N - 1) / 2);
|
|
339
|
+
for (let I = 0; I < k; I++) {
|
|
340
|
+
const S = I / k * 2 * Math.PI, A = (0.16 * Math.sin(S * 3 - s * 1.7 + z * 0.22) + 0.07 * Math.sin(S * 5 + s * 1.1)) * (t.wobMul ?? 1), T = t.faceOn ? 1 + A : 1, C = t.faceOn ? O : O + A, q = R * Math.cos(S) + u * Math.sin(S) + f * C, F = w * Math.cos(S) + y * Math.sin(S) + P * C, j = i * Math.cos(S) + b * Math.sin(S) + x * C, W = Math.sqrt(q * q + F * F + j * j), Y = d * T, [ct, at, X] = h(q / W * Y, F / W * Y, j / W * Y), K = (X / o + 1) / 2;
|
|
341
|
+
D.push({
|
|
342
|
+
x: ct,
|
|
343
|
+
y: at,
|
|
344
|
+
z: X,
|
|
345
|
+
r: ((t.rBase ?? 1.1) + (t.rDepth ?? 1.7) * K) * (1 - 0.25 * B) * m,
|
|
346
|
+
white: 0.52 - 0.44 * K + 0.18 * B,
|
|
347
|
+
a: 0.4 + 0.6 * K
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return L(D, [], t.rMin);
|
|
352
|
+
};
|
|
353
|
+
var Dt = (n, s, t) => {
|
|
354
|
+
const r = n / 2, a = n / 2, o = n / 2 * 0.8 * (t.spread ?? 1), c = _(s * 0.12, 0.32, r, a, o), M = $(n, t.rsPow ?? 0.6), h = t.nodeN ?? 30, m = t.thr ?? 0.72, D = t.nodeR ?? 1.4, p = t.nodeRDepth ?? 1.8, e = [];
|
|
355
|
+
for (let i = 0; i < h; i++) {
|
|
356
|
+
const u = J(i, h), y = u[0] + 0.3 * (G(i * 0.31 + 9, s * 0.24) - 0.5) * 2, b = u[1] + 0.3 * (G(i * 0.53 + 27, s * 0.21) - 0.5) * 2, f = u[2] + 0.3 * (G(i * 0.77 + 55, s * 0.27) - 0.5) * 2, P = Math.sqrt(y * y + b * b + f * f);
|
|
357
|
+
e.push([y / P, b / P, f / P]);
|
|
358
|
+
}
|
|
359
|
+
const l = [], R = [];
|
|
360
|
+
for (let i = 0; i < h; i++)
|
|
361
|
+
for (let u = i + 1; u < h; u++) {
|
|
362
|
+
const y = e[i][0] - e[u][0], b = e[i][1] - e[u][1], f = e[i][2] - e[u][2], P = Math.sqrt(y * y + b * b + f * f);
|
|
363
|
+
if (P >= m) continue;
|
|
364
|
+
const [x, g, d] = c(e[i][0], e[i][1], e[i][2]), [v, k, N] = c(e[u][0], e[u][1], e[u][2]), z = ((d + N) / 2 + 1) / 2;
|
|
365
|
+
l.push({
|
|
366
|
+
x1: x,
|
|
367
|
+
y1: g,
|
|
368
|
+
x2: v,
|
|
369
|
+
y2: k,
|
|
370
|
+
white: 0.42,
|
|
371
|
+
a: (1 - P / m) * (0.3 + 0.55 * z),
|
|
372
|
+
w: Math.max(0.6, (t.lineW ?? 0.8) * M)
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
for (let i = 0; i < h; i++) {
|
|
376
|
+
const [u, y, b] = c(e[i][0], e[i][1], e[i][2]), f = (b + 1) / 2, P = 1 + 0.25 * Math.sin(s * 1.4 + i * 2.7);
|
|
377
|
+
R.push({
|
|
378
|
+
x: u,
|
|
379
|
+
y,
|
|
380
|
+
z: b,
|
|
381
|
+
r: (D + p * f) * P * M,
|
|
382
|
+
white: 0.55 - 0.45 * f
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
const w = t.signals ?? 5;
|
|
386
|
+
for (let i = 0; i < w; i++) {
|
|
387
|
+
const u = Math.floor(s * 0.55 + i * 7.31), y = Math.floor(E(u, i * 3.1 + 1.7) * h), b = Math.floor(E(u, i * 5.7 + 4.2) * h);
|
|
388
|
+
if (y === b) continue;
|
|
389
|
+
const f = nt(s * 0.55 + i * 7.31), P = U(e[y][0], e[b][0], f), x = U(e[y][1], e[b][1], f), g = U(e[y][2], e[b][2], f), d = Math.max(1e-6, Math.sqrt(P * P + x * x + g * g)), [v, k, N] = c(P / d, x / d, g / d), z = (N + 1) / 2;
|
|
390
|
+
R.push({
|
|
391
|
+
x: v,
|
|
392
|
+
y: k,
|
|
393
|
+
z: N,
|
|
394
|
+
r: (D * 1.5 + p * z) * M,
|
|
395
|
+
white: 0.05,
|
|
396
|
+
a: 0.5 + 0.5 * z
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
return L(R, l, t.rMin);
|
|
400
|
+
};
|
|
401
|
+
var vt = {
|
|
402
|
+
orbits: Rt,
|
|
403
|
+
globe: ft,
|
|
404
|
+
rubik: dt,
|
|
405
|
+
wave: bt,
|
|
406
|
+
web: Dt,
|
|
407
|
+
braid: Mt,
|
|
408
|
+
ribbon: Z,
|
|
409
|
+
// ring shares ribbon's geometry — the `faceOn` profile flag switches it
|
|
410
|
+
ring: Z,
|
|
411
|
+
morph: Pt
|
|
412
|
+
};
|
|
413
|
+
var Ct = Object.fromEntries(
|
|
414
|
+
Object.entries(vt).map(([n, s]) => [
|
|
415
|
+
n,
|
|
416
|
+
(t, r, a, o, c) => ht(t, s(r, a, c), o)
|
|
417
|
+
])
|
|
418
|
+
);
|
|
419
|
+
var zt = [
|
|
420
|
+
["latRings", "lonDensity"],
|
|
421
|
+
["rings", "lonDensity"],
|
|
422
|
+
["lanes", "segs"]
|
|
423
|
+
];
|
|
424
|
+
var Nt = ["orbitN", "ghostN", "nodeN", "strandN", "signals"];
|
|
425
|
+
var It = ["iconD"];
|
|
426
|
+
var kt = [
|
|
427
|
+
"rBase",
|
|
428
|
+
"rDepth",
|
|
429
|
+
"rActive",
|
|
430
|
+
"rDot",
|
|
431
|
+
"ghostR",
|
|
432
|
+
"partR",
|
|
433
|
+
"partRDepth",
|
|
434
|
+
"nodeR",
|
|
435
|
+
"nodeRDepth"
|
|
436
|
+
];
|
|
437
|
+
function St(n, s) {
|
|
438
|
+
const t = { ...n }, r = /* @__PURE__ */ new Set(), a = Math.sqrt(s);
|
|
439
|
+
for (const [o, c] of zt) {
|
|
440
|
+
const M = t[o], h = t[c];
|
|
441
|
+
M != null && h != null && !r.has(o) && !r.has(c) && (t[o] = Math.max(2, Math.round(M * a)), t[c] = Math.max(2, Math.round(h * a)), r.add(o), r.add(c));
|
|
442
|
+
}
|
|
443
|
+
for (const o of Nt) {
|
|
444
|
+
const c = t[o];
|
|
445
|
+
c != null && c !== 0 && !r.has(o) && (t[o] = Math.max(1, Math.round(c * s)));
|
|
446
|
+
}
|
|
447
|
+
for (const o of It) {
|
|
448
|
+
const c = t[o];
|
|
449
|
+
c != null && (t[o] = Math.max(0.02, c * s));
|
|
450
|
+
}
|
|
451
|
+
return t;
|
|
452
|
+
}
|
|
453
|
+
function Bt(n, s) {
|
|
454
|
+
const t = { ...n };
|
|
455
|
+
for (const r of kt) {
|
|
456
|
+
const a = t[r];
|
|
457
|
+
a != null && (t[r] = a * s);
|
|
458
|
+
}
|
|
459
|
+
return t.rSizeMul = (t.rSizeMul ?? 1) * s, t;
|
|
460
|
+
}
|
|
461
|
+
var Et = {
|
|
462
|
+
globe: {
|
|
463
|
+
latRings: 17,
|
|
464
|
+
lonDensity: 44,
|
|
465
|
+
rBase: 0.6,
|
|
466
|
+
rDepth: 1.7,
|
|
467
|
+
rBoost: 1,
|
|
468
|
+
inkFar: 0.62,
|
|
469
|
+
inkSpan: 0.54,
|
|
470
|
+
rsPow: 0.6,
|
|
471
|
+
rMin: 0.3
|
|
472
|
+
},
|
|
473
|
+
orbits: {
|
|
474
|
+
orbitN: 12,
|
|
475
|
+
ghostN: 40,
|
|
476
|
+
ghostR: 0.9,
|
|
477
|
+
ghostA: 0.5,
|
|
478
|
+
particles: 3,
|
|
479
|
+
partR: 1.2,
|
|
480
|
+
partRDepth: 1.6,
|
|
481
|
+
rsPow: 0.6,
|
|
482
|
+
rMin: 0.3
|
|
483
|
+
},
|
|
484
|
+
rubik: {
|
|
485
|
+
latRings: 15,
|
|
486
|
+
lonDensity: 40,
|
|
487
|
+
moveCount: 14,
|
|
488
|
+
rBase: 0.6,
|
|
489
|
+
rDepth: 1.7,
|
|
490
|
+
rActive: 0.3,
|
|
491
|
+
inkFar: 0.62,
|
|
492
|
+
inkSpan: 0.54,
|
|
493
|
+
rsPow: 0.6,
|
|
494
|
+
rMin: 0.3
|
|
495
|
+
},
|
|
496
|
+
wave: {
|
|
497
|
+
rings: 15,
|
|
498
|
+
lonDensity: 40,
|
|
499
|
+
rBase: 0.6,
|
|
500
|
+
rDepth: 1.7,
|
|
501
|
+
rsPow: 0.6,
|
|
502
|
+
rMin: 0.3
|
|
503
|
+
},
|
|
504
|
+
web: {
|
|
505
|
+
nodeN: 30,
|
|
506
|
+
thr: 0.72,
|
|
507
|
+
signals: 5,
|
|
508
|
+
nodeR: 1.4,
|
|
509
|
+
nodeRDepth: 1.8,
|
|
510
|
+
lineW: 0.8,
|
|
511
|
+
rsPow: 0.6,
|
|
512
|
+
rMin: 0.3
|
|
513
|
+
},
|
|
514
|
+
braid: {
|
|
515
|
+
strandN: 52,
|
|
516
|
+
turns: 3,
|
|
517
|
+
ghostN: 150,
|
|
518
|
+
rBase: 1.2,
|
|
519
|
+
rDepth: 1.8,
|
|
520
|
+
rsPow: 0.6,
|
|
521
|
+
rMin: 0.3
|
|
522
|
+
},
|
|
523
|
+
ribbon: {
|
|
524
|
+
lanes: 5,
|
|
525
|
+
segs: 88,
|
|
526
|
+
ghostN: 150,
|
|
527
|
+
rBase: 1.1,
|
|
528
|
+
rDepth: 1.7,
|
|
529
|
+
rsPow: 0.6,
|
|
530
|
+
rMin: 0.3
|
|
531
|
+
},
|
|
532
|
+
// ring shares ribbon's painter; faceOn cancels the camera tilt and moves
|
|
533
|
+
// the undulation onto the radius, and there is no ghost sphere behind it
|
|
534
|
+
ring: {
|
|
535
|
+
lanes: 5,
|
|
536
|
+
segs: 88,
|
|
537
|
+
ghostN: 0,
|
|
538
|
+
faceOn: 1,
|
|
539
|
+
rBase: 1.1,
|
|
540
|
+
rDepth: 1.7,
|
|
541
|
+
rsPow: 0.6,
|
|
542
|
+
rMin: 0.3
|
|
543
|
+
},
|
|
544
|
+
morph: {
|
|
545
|
+
rDot: 0.021,
|
|
546
|
+
iconD: 1,
|
|
547
|
+
rMin: 0.25
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
var Ot = {
|
|
551
|
+
working: "orbits",
|
|
552
|
+
searching: "globe",
|
|
553
|
+
solving: "rubik",
|
|
554
|
+
listening: "wave",
|
|
555
|
+
connecting: "web",
|
|
556
|
+
weaving: "braid",
|
|
557
|
+
composing: "ribbon",
|
|
558
|
+
breathing: "ring",
|
|
559
|
+
shaping: "morph"
|
|
560
|
+
};
|
|
561
|
+
var At = {
|
|
562
|
+
orbits: {
|
|
563
|
+
64: { speed: 1.885, count: 1, size: 1 },
|
|
564
|
+
20: { speed: 3.9, count: 0.238, size: 2.4 }
|
|
565
|
+
},
|
|
566
|
+
globe: {
|
|
567
|
+
64: { speed: 2.015, count: 0.42, size: 1.15, extra: { scanMul: 4.08, dimBase: 0.45 } },
|
|
568
|
+
20: { speed: 2.665, count: 0.105, size: 1.75, extra: { scanMul: 4.335, dimBase: 0.45 } }
|
|
569
|
+
},
|
|
570
|
+
rubik: {
|
|
571
|
+
64: { speed: 1.82, count: 0.35, size: 1.05 },
|
|
572
|
+
20: { speed: 1.95, count: 0.088, size: 1.9 }
|
|
573
|
+
},
|
|
574
|
+
wave: {
|
|
575
|
+
64: { speed: 4.388, count: 0.341, size: 1 },
|
|
576
|
+
20: { speed: 3.998, count: 0.105, size: 1.6 }
|
|
577
|
+
},
|
|
578
|
+
web: {
|
|
579
|
+
64: { speed: 3.315, count: 1.35, size: 0.95 },
|
|
580
|
+
20: { speed: 6.63, count: 0.25, size: 1.52 }
|
|
581
|
+
},
|
|
582
|
+
braid: {
|
|
583
|
+
64: { speed: 1.625, count: 0.5, size: 1 },
|
|
584
|
+
20: { speed: 2.75, count: 0.1125, size: 1.36 }
|
|
585
|
+
},
|
|
586
|
+
ribbon: {
|
|
587
|
+
64: { speed: 2.34, count: 0.25, size: 0.85, extra: { spin: 0, bandMul: 3.9, wobMul: 1 } },
|
|
588
|
+
20: { speed: 3.12, count: 0.051, size: 1.073, extra: { spin: 0, bandMul: 4.94, wobMul: 1 } }
|
|
589
|
+
},
|
|
590
|
+
ring: {
|
|
591
|
+
64: { speed: 3.24, count: 0.25, size: 0.956, extra: { spin: 0, bandMul: 3.627, wobMul: 0.368 } },
|
|
592
|
+
20: { speed: 3.78, count: 0.028, size: 1.622, extra: { spin: 0, bandMul: 3.968, wobMul: 0.565 } }
|
|
593
|
+
},
|
|
594
|
+
morph: {
|
|
595
|
+
64: { speed: 2.405, count: 0.702, size: 0.395, extra: { spread: 1.45 } },
|
|
596
|
+
20: { speed: 2.08, count: 0.53, size: 1.011, extra: { spread: 1.45 } }
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
var tt = /* @__PURE__ */ new Map();
|
|
600
|
+
function Lt(n, s) {
|
|
601
|
+
const t = `${n}-${s}`, r = tt.get(t);
|
|
602
|
+
if (r) return r;
|
|
603
|
+
const a = Ot[n], o = At[a][s];
|
|
604
|
+
let c = { ...Et[a] };
|
|
605
|
+
o.count !== 1 && (c = St(c, o.count)), o.size !== 1 && (c = Bt(c, o.size)), o.extra && (c = { ...c, ...o.extra });
|
|
606
|
+
const M = { mode: a, speed: o.speed, opts: c };
|
|
607
|
+
return tt.set(t, M), M;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/state.js
|
|
611
|
+
function orbStateForTool(toolName) {
|
|
612
|
+
const name = String(toolName ?? "").toLowerCase();
|
|
613
|
+
if (name.length === 0) return "working";
|
|
614
|
+
if (/image_generate|animate_image/.test(name)) return "shaping";
|
|
615
|
+
if (/generate_video|video/.test(name)) return "weaving";
|
|
616
|
+
if (/(^|__)(web|web_search|web_fetch)($|__)|search/.test(name)) return "searching";
|
|
617
|
+
if (/ask_user|ask-user|question/.test(name)) return "listening";
|
|
618
|
+
if (name.startsWith("mcp__") || name.includes("mcp_")) return "connecting";
|
|
619
|
+
if (/bash|pwsh|shell|str_replace|edit|write|grep|glob/.test(name)) return "solving";
|
|
620
|
+
return "working";
|
|
621
|
+
}
|
|
622
|
+
function orbStateForTools(toolNames) {
|
|
623
|
+
let state = "working";
|
|
624
|
+
for (const name of toolNames) state = orbStateForTool(name);
|
|
625
|
+
return state;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// src/browser.js
|
|
629
|
+
var SIZE = 20;
|
|
630
|
+
var PAD = 28;
|
|
631
|
+
var mounts = /* @__PURE__ */ new Set();
|
|
632
|
+
var observing = false;
|
|
633
|
+
var frame = 0;
|
|
634
|
+
function isDark() {
|
|
635
|
+
return document.body?.hasAttribute("data-ds-dark-theme") === true;
|
|
636
|
+
}
|
|
637
|
+
function prefersReducedMotion() {
|
|
638
|
+
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
639
|
+
}
|
|
640
|
+
function isTurnStatus(element) {
|
|
641
|
+
if (!(element instanceof HTMLElement)) return false;
|
|
642
|
+
if (element.getAttribute("role") !== "status") return false;
|
|
643
|
+
if (element.getAttribute("aria-live") !== "polite") return false;
|
|
644
|
+
for (const className of element.classList) {
|
|
645
|
+
if (className.endsWith("turnStatus") && !className.endsWith("turnStatusClock")) return true;
|
|
646
|
+
}
|
|
647
|
+
const text = element.textContent ?? "";
|
|
648
|
+
return text.includes("Deep diving") || text.includes("\u6DF1\u5EA6\u6C42\u7D22");
|
|
649
|
+
}
|
|
650
|
+
function runningTools() {
|
|
651
|
+
const names = [];
|
|
652
|
+
for (const row of document.querySelectorAll('[data-state="running"][data-tool]')) {
|
|
653
|
+
names.push(row.getAttribute("data-tool") ?? "");
|
|
654
|
+
}
|
|
655
|
+
return names;
|
|
656
|
+
}
|
|
657
|
+
function paint(record, timeSeconds) {
|
|
658
|
+
const { canvas, ctx, dpr } = record;
|
|
659
|
+
const state = orbStateForTools(runningTools());
|
|
660
|
+
const reduced = prefersReducedMotion();
|
|
661
|
+
const { mode, speed, opts } = Lt(state, SIZE);
|
|
662
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
663
|
+
ctx.clearRect(0, 0, SIZE, SIZE);
|
|
664
|
+
Ct[mode](ctx, SIZE, reduced ? 0.6 : timeSeconds * speed, isDark(), opts);
|
|
665
|
+
canvas.setAttribute("aria-label", state);
|
|
666
|
+
}
|
|
667
|
+
function place(record) {
|
|
668
|
+
const rect = record.host.getBoundingClientRect();
|
|
669
|
+
const visible = rect.width > 0 && rect.bottom > 0 && rect.top < window.innerHeight;
|
|
670
|
+
record.canvas.style.display = visible ? "block" : "none";
|
|
671
|
+
if (!visible) return;
|
|
672
|
+
record.canvas.style.left = `${rect.left}px`;
|
|
673
|
+
record.canvas.style.top = `${rect.top + (rect.height - SIZE) / 2}px`;
|
|
674
|
+
}
|
|
675
|
+
function mount(host) {
|
|
676
|
+
const canvas = document.createElement("canvas");
|
|
677
|
+
canvas.dataset.thinkingOrb = "1";
|
|
678
|
+
canvas.setAttribute("role", "img");
|
|
679
|
+
canvas.style.position = "fixed";
|
|
680
|
+
canvas.style.width = `${SIZE}px`;
|
|
681
|
+
canvas.style.height = `${SIZE}px`;
|
|
682
|
+
canvas.style.zIndex = "30";
|
|
683
|
+
canvas.style.pointerEvents = "none";
|
|
684
|
+
const dpr = Math.min(2, window.devicePixelRatio || 1);
|
|
685
|
+
canvas.width = Math.round(SIZE * dpr);
|
|
686
|
+
canvas.height = Math.round(SIZE * dpr);
|
|
687
|
+
const ctx = canvas.getContext("2d");
|
|
688
|
+
if (ctx === null) return;
|
|
689
|
+
host.dataset.thinkingOrbHost = "1";
|
|
690
|
+
host.style.paddingLeft = `${PAD}px`;
|
|
691
|
+
document.body.append(canvas);
|
|
692
|
+
mounts.add({ host, canvas, ctx, dpr });
|
|
693
|
+
}
|
|
694
|
+
function unmount(record) {
|
|
695
|
+
record.host.style.paddingLeft = "";
|
|
696
|
+
delete record.host.dataset.thinkingOrbHost;
|
|
697
|
+
record.canvas.remove();
|
|
698
|
+
mounts.delete(record);
|
|
699
|
+
}
|
|
700
|
+
function sync() {
|
|
701
|
+
const live = /* @__PURE__ */ new Set();
|
|
702
|
+
for (const element of document.querySelectorAll('[role="status"][aria-live="polite"]')) {
|
|
703
|
+
if (isTurnStatus(element)) live.add(element);
|
|
704
|
+
}
|
|
705
|
+
for (const record of mounts) {
|
|
706
|
+
if (!record.host.isConnected || !live.has(record.host)) unmount(record);
|
|
707
|
+
}
|
|
708
|
+
for (const host of live) {
|
|
709
|
+
let known = false;
|
|
710
|
+
for (const record of mounts) if (record.host === host) known = true;
|
|
711
|
+
if (!known) mount(host);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
function tick(now) {
|
|
715
|
+
sync();
|
|
716
|
+
const seconds = now / 1e3;
|
|
717
|
+
for (const record of mounts) {
|
|
718
|
+
place(record);
|
|
719
|
+
paint(record, seconds);
|
|
720
|
+
}
|
|
721
|
+
const keepPainting = mounts.size > 0 && !prefersReducedMotion() && document.visibilityState !== "hidden";
|
|
722
|
+
frame = keepPainting ? requestAnimationFrame(tick) : 0;
|
|
723
|
+
}
|
|
724
|
+
function kick() {
|
|
725
|
+
if (frame !== 0) return;
|
|
726
|
+
frame = requestAnimationFrame(tick);
|
|
727
|
+
}
|
|
728
|
+
var MARK_PRESET = 20;
|
|
729
|
+
function ListeningMark(props) {
|
|
730
|
+
const size = typeof props.size === "number" && props.size > 0 ? props.size : 24;
|
|
731
|
+
const canvasRef = (0, import_react.useRef)(null);
|
|
732
|
+
(0, import_react.useEffect)(() => {
|
|
733
|
+
const canvas = canvasRef.current;
|
|
734
|
+
if (!canvas) return void 0;
|
|
735
|
+
const ctx = canvas.getContext("2d");
|
|
736
|
+
if (ctx === null) return void 0;
|
|
737
|
+
const dpr = Math.min(2, window.devicePixelRatio || 1);
|
|
738
|
+
canvas.width = Math.round(size * dpr);
|
|
739
|
+
canvas.height = Math.round(size * dpr);
|
|
740
|
+
const { mode, speed, opts } = Lt("listening", MARK_PRESET);
|
|
741
|
+
let frame2 = 0;
|
|
742
|
+
let stopped = false;
|
|
743
|
+
const tick2 = (now) => {
|
|
744
|
+
if (stopped) return;
|
|
745
|
+
const reduced = prefersReducedMotion();
|
|
746
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
747
|
+
ctx.clearRect(0, 0, size, size);
|
|
748
|
+
Ct[mode](ctx, size, reduced ? 0.6 : now / 1e3 * speed, isDark(), opts);
|
|
749
|
+
frame2 = reduced || document.visibilityState === "hidden" ? 0 : requestAnimationFrame(tick2);
|
|
750
|
+
};
|
|
751
|
+
const wake = () => {
|
|
752
|
+
if (frame2 !== 0 || stopped) return;
|
|
753
|
+
frame2 = requestAnimationFrame(tick2);
|
|
754
|
+
};
|
|
755
|
+
frame2 = requestAnimationFrame(tick2);
|
|
756
|
+
document.addEventListener("visibilitychange", wake);
|
|
757
|
+
return () => {
|
|
758
|
+
stopped = true;
|
|
759
|
+
if (frame2 !== 0) cancelAnimationFrame(frame2);
|
|
760
|
+
document.removeEventListener("visibilitychange", wake);
|
|
761
|
+
};
|
|
762
|
+
}, [size]);
|
|
763
|
+
return import_react.default.createElement("canvas", {
|
|
764
|
+
ref: canvasRef,
|
|
765
|
+
"aria-hidden": "true",
|
|
766
|
+
width: size,
|
|
767
|
+
height: size,
|
|
768
|
+
style: {
|
|
769
|
+
width: `${size}px`,
|
|
770
|
+
height: `${size}px`,
|
|
771
|
+
display: "block",
|
|
772
|
+
pointerEvents: "none"
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
var inject = ["slots"];
|
|
777
|
+
function apply(ctx) {
|
|
778
|
+
if (observing || typeof document === "undefined") return;
|
|
779
|
+
observing = true;
|
|
780
|
+
const start = () => {
|
|
781
|
+
const observer = new MutationObserver(kick);
|
|
782
|
+
observer.observe(document.documentElement, {
|
|
783
|
+
subtree: true,
|
|
784
|
+
childList: true,
|
|
785
|
+
attributes: true,
|
|
786
|
+
attributeFilter: ["data-state", "data-tool", "data-ds-dark-theme", "class", "role"]
|
|
787
|
+
});
|
|
788
|
+
document.addEventListener("visibilitychange", kick);
|
|
789
|
+
document.addEventListener("scroll", kick, true);
|
|
790
|
+
window.addEventListener("resize", kick);
|
|
791
|
+
kick();
|
|
792
|
+
};
|
|
793
|
+
if (document.body) start();
|
|
794
|
+
else document.addEventListener("DOMContentLoaded", start, { once: true });
|
|
795
|
+
ctx.slots.inject("sidebar.brand.mark", () => ctx.slots.register({
|
|
796
|
+
name: "sidebar.brand.mark",
|
|
797
|
+
priority: -1
|
|
798
|
+
}, ListeningMark));
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
return { apply: module.exports.apply, inject: module.exports.inject }
|
|
802
|
+
},
|
|
803
|
+
})
|
package/lib/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-thinking-orbs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Thinking-orbs indicator beside the DSH Deep diving status, and a listening mark in the sidebar brand slot.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"deepseek-harness",
|
|
8
|
+
"dsh-plugin",
|
|
9
|
+
"thinking-orbs"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./lib/index.js",
|
|
15
|
+
"./client": "./lib/client.js",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib",
|
|
20
|
+
"cordis.patch.yml",
|
|
21
|
+
"NOTICE"
|
|
22
|
+
],
|
|
23
|
+
"dsh": {
|
|
24
|
+
"bundle": {
|
|
25
|
+
"patch": "./cordis.patch.yml"
|
|
26
|
+
},
|
|
27
|
+
"client": {
|
|
28
|
+
"platform": "web",
|
|
29
|
+
"immediately": true,
|
|
30
|
+
"inject": [
|
|
31
|
+
"@deepseek-ai/dsh-client-ui-sidebar"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "node scripts/build.mjs",
|
|
37
|
+
"test": "node --test test/state.test.mjs"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"esbuild": "0.28.2",
|
|
41
|
+
"thinking-orbs": "0.3.1"
|
|
42
|
+
},
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22.19"
|
|
46
|
+
}
|
|
47
|
+
}
|