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