dsh-task-mascot 2.1.0 → 2.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/README.md +23 -6
- package/lib/client.js +67 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,12 +9,25 @@
|
|
|
9
9
|
|
|
10
10
|
## 安装
|
|
11
11
|
|
|
12
|
+
> 已验证:**DSH 0.2.2-rc.1**(npm `latest`,2026-11-09,Linux · `dsh web`)。要求 dsh ≥ 0.2.0-rc.2、Node ≥ 22.19。
|
|
13
|
+
|
|
14
|
+
**`dsh web`(命令行)**
|
|
15
|
+
|
|
12
16
|
```bash
|
|
13
|
-
dsh plugin --profile web add github:sherconan/dsh-task-mascot
|
|
17
|
+
dsh plugin --profile web add github:sherconan/dsh-task-mascot # 或 npm 包:dsh-task-mascot
|
|
14
18
|
```
|
|
15
19
|
|
|
16
|
-
然后重启 `dsh web
|
|
17
|
-
|
|
20
|
+
然后重启 `dsh web`。安装会自动把插件加进 web profile 的 bundles,不用手改配置。
|
|
21
|
+
|
|
22
|
+
**`dsh web`(界面里装)**:左侧栏 **Plugins(插件)** → **Add plugin(添加插件)** → 输入 `dsh-task-mascot` → **Install(安装)** → 打开插件卡片右侧的开关(启用),刷新页面即可。
|
|
23
|
+
|
|
24
|
+
**DSH Desktop(桌面版)**:Desktop 用自己独占的 `desktop` profile,上面 `--profile web` 的命令装进的是 web profile,**Desktop 里看不到**;npm 装的 `dsh` 也不能改 Desktop 的 profile。请在 Desktop 里按同样步骤 **Plugins → Add plugin → `dsh-task-mascot`** 安装并启用;或者用 Desktop 自带的 dsh 命令(应用菜单「管理 dsh 命令…」安装),先完全退出 Desktop,再运行 `dsh plugin --profile desktop add dsh-task-mascot`,重新打开即可。(以上 Desktop 步骤依据 [官方 Desktop 文档](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/desktop/README.zh.md#bundled-command-runtime),尚未在 Desktop 实机验证,遇到问题欢迎提 issue。)
|
|
25
|
+
|
|
26
|
+
**设置入口**(0.2.1 起没有独立的 Settings 页面):左下角 **More(更多)→ Settings(设置)→ 任务角色 Mascot**。插件页里 dsh-task-mascot 的卡片只有启用开关和说明页,配置项不在卡片上。
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
旧版本:0.2.0 及更早的设置入口在 Settings 页面里,同样找「任务角色 Mascot」(本次没有在旧版重测)。
|
|
18
31
|
|
|
19
32
|
## 特点
|
|
20
33
|
|
|
@@ -32,12 +45,12 @@ dsh plugin --profile web add github:sherconan/dsh-task-mascot
|
|
|
32
45
|
| 映射 | 写死 | 设置里可编辑 **工具 → 动画** 映射规则(正则) |
|
|
33
46
|
| 体积 | — | 两个角色包合计约 18 MB(VP9 透明 webm + Safari 用 WebP 兜底) |
|
|
34
47
|
|
|
35
|
-
其他细节:每步至少停留 600 ms 排队播放不丢步;流式参数只显示已闭合的值不闪烁;三种展示面(内联卡片 / 输入框上方 Dock 条 /
|
|
48
|
+
其他细节:每步至少停留 600 ms 排队播放不丢步;流式参数只显示已闭合的值不闪烁;三种展示面(内联卡片 / 输入框上方 Dock 条 / 悬浮宠物)可任意组合,默认内联卡片在视野里时不再重复显示 Dock 条,卡片滚出视野才出现(设置里「状态条何时显示」可改成「总是」);宠物可拖动、双击归位;可选提示音(默认关)。
|
|
36
49
|
|
|
37
50
|

|
|
38
51
|

|
|
39
52
|
|
|
40
|
-
- **大肥鱼图鉴(2.1.0)**:31 格收集卡,Agent
|
|
53
|
+
- **大肥鱼图鉴(2.1.0)**:31 格收集卡,Agent 第一次触发某种动作(写代码、搜索、跑测试、出错……)时点亮一格,右上角弹出一张不挡对话的「新解锁」小提示(短时间内连续解锁会合并成一张,点它打开图鉴)。设置页「打开图鉴」或右键悬浮角色查看;进度只存在本地 localStorage。
|
|
41
54
|
|
|
42
55
|
## 工具 → 动画映射 / Tool → state mapping
|
|
43
56
|
|
|
@@ -152,6 +165,10 @@ E2E 脚本在 `test/e2e/`(Playwright),截图输出到 `qa/`(已 gitignor
|
|
|
152
165
|
- Swappable character packs (ships Whale Girl 大肥鱼 and Claude娘) and an editable tool→animation mapping. ~13 MB.
|
|
153
166
|
- Runs fully locally; makes no external network calls.
|
|
154
167
|
|
|
155
|
-
Install
|
|
168
|
+
Install (verified on **DSH 0.2.2-rc.1**, Linux, `dsh web`; requires dsh ≥ 0.2.0-rc.2, Node ≥ 22.19):
|
|
169
|
+
|
|
170
|
+
- `dsh web`: `dsh plugin --profile web add github:sherconan/dsh-task-mascot` (or the npm package `dsh-task-mascot`), then restart `dsh web`. Or in the UI: **Plugins → Add plugin → `dsh-task-mascot` → Install**, turn on the switch on its card, and refresh.
|
|
171
|
+
- DSH Desktop: Desktop owns its own `desktop` profile, so a `--profile web` install does **not** show up there. Install from Desktop's **Plugins → Add plugin**, or quit Desktop and run its bundled `dsh plugin --profile desktop add dsh-task-mascot`. (Per the [official Desktop docs](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/desktop/README.md#bundled-command-runtime); not yet tested on Desktop.)
|
|
172
|
+
- Settings: from 0.2.1 there is no standalone Settings page. Open **More (bottom-left) → Settings → 任务角色 Mascot**. The plugin's card on the Plugins page only has the enable switch and the readme. On 0.2.0 and older, look for the same section in Settings.
|
|
156
173
|
|
|
157
174
|
Code MIT © metsh. Artwork: 大肥鱼 CC BY-NC-SA 4.0 (「溟月」 by 上善无形 → ZipZipPipe → community 大肥鱼; via TreapGoGo/deepseek-whale-girl), Claude娘 CC BY-SA 4.0 — see ART_LICENSE.md. Unofficial; not affiliated with DeepSeek or Anthropic.
|
package/lib/client.js
CHANGED
|
@@ -395,7 +395,7 @@ function resultBrief(message) {
|
|
|
395
395
|
|
|
396
396
|
// ---------------------------------------------------------------- settings store (shared by every surface)
|
|
397
397
|
const LS_KEY2 = 'dsh-task-mascot:settings:v2';
|
|
398
|
-
const DEFAULT_SETTINGS = { inline: true, dock: true, pet: false, pack: 'dafeiyu', size: 160, cardSize: 96, corner: 'bottom-right', pos: null, rules: null, showChip: true, opacity: 1, dwellMs: 600, sound: false, avoid: true, variants: 'alternate', stepSlowSec: 20, loopLongSec: 120, dex: true, dexPopup: true };
|
|
398
|
+
const DEFAULT_SETTINGS = { inline: true, dock: true, pet: false, pack: 'dafeiyu', size: 160, cardSize: 96, corner: 'bottom-right', pos: null, rules: null, showChip: true, opacity: 1, dwellMs: 600, sound: false, avoid: true, variants: 'alternate', stepSlowSec: 20, loopLongSec: 120, dex: true, dexPopup: true, dockMode: 'auto' };
|
|
399
399
|
function loadSettings() {
|
|
400
400
|
try {
|
|
401
401
|
const v2 = localStorage.getItem(LS_KEY2);
|
|
@@ -609,6 +609,33 @@ function resultBrief(message) {
|
|
|
609
609
|
const w = bar && bar.getBoundingClientRect().width;
|
|
610
610
|
if (w > 200) { el.style.maxWidth = Math.round(w) + 'px'; el.style.marginLeft = 'auto'; el.style.marginRight = 'auto'; el.style.boxSizing = 'border-box'; }
|
|
611
611
|
}
|
|
612
|
+
/**
|
|
613
|
+
* Dock bar vs inline card: both show the same live step, so by default ('auto') the dock bar only appears
|
|
614
|
+
* when the inline card is off, missing, or scrolled out of view. 'always' restores the old both-at-once behaviour.
|
|
615
|
+
*/
|
|
616
|
+
function dockShouldShow(o) {
|
|
617
|
+
if (!o.dock || !o.live) return false;
|
|
618
|
+
if (o.dockMode === 'always' || !o.inline) return true;
|
|
619
|
+
return !o.inlineInView;
|
|
620
|
+
}
|
|
621
|
+
const inlineVis = { m: new Map(), subs: new Set() };
|
|
622
|
+
function setInlineInView(sid, val) { if (!!inlineVis.m.get(sid) === !!val) return; inlineVis.m.set(sid, !!val); inlineVis.subs.forEach((f) => f()); }
|
|
623
|
+
function useInlineInView(sid) {
|
|
624
|
+
const [, force] = React.useState(0);
|
|
625
|
+
React.useEffect(() => { const f = () => force((n) => n + 1); inlineVis.subs.add(f); return () => inlineVis.subs.delete(f); }, []);
|
|
626
|
+
return !!inlineVis.m.get(sid);
|
|
627
|
+
}
|
|
628
|
+
/** Fallback when IntersectionObserver is unavailable: is `el` inside the viewport and every clipping ancestor? */
|
|
629
|
+
function rectInView(el) {
|
|
630
|
+
if (!el || !el.isConnected) return false;
|
|
631
|
+
let r = el.getBoundingClientRect(); if (r.height < 2) return false;
|
|
632
|
+
let top = Math.max(r.top, 0), bottom = Math.min(r.bottom, window.innerHeight);
|
|
633
|
+
for (let n = el.parentElement; n && n !== document.body; n = n.parentElement) {
|
|
634
|
+
const ov = getComputedStyle(n).overflowY; if (!/(auto|scroll|hidden|clip)/.test(ov)) continue;
|
|
635
|
+
const a = n.getBoundingClientRect(); top = Math.max(top, a.top); bottom = Math.min(bottom, a.bottom);
|
|
636
|
+
}
|
|
637
|
+
return bottom - top >= Math.min(32, r.height * 0.5);
|
|
638
|
+
}
|
|
612
639
|
const showLive = (v) => !!v && (v.active || v.queued > 0 || (v.turnEnd && Date.now() - v.turnEnd < 4500) || (v.frame && v.frame.shownAt && Date.now() - v.frame.shownAt < 600));
|
|
613
640
|
/** Inline card: portalled into the chat column right after the last row, i.e. at the active step. */
|
|
614
641
|
function InlineCard({ sid }) {
|
|
@@ -624,17 +651,23 @@ function resultBrief(message) {
|
|
|
624
651
|
if (box.parentNode !== tail.parentNode || box.previousSibling !== tail) tail.parentNode.insertBefore(box, tail.nextSibling);
|
|
625
652
|
fitToColumn(box, sid);
|
|
626
653
|
};
|
|
627
|
-
|
|
628
|
-
|
|
654
|
+
let io = null;
|
|
655
|
+
if (typeof IntersectionObserver === 'function') {
|
|
656
|
+
io = new IntersectionObserver((ents) => { const e = ents[ents.length - 1]; setInlineInView(sid, !!(e && e.isIntersecting && e.intersectionRect.height >= Math.min(32, e.boundingClientRect.height * 0.5))); }, { threshold: [0, 0.1, 0.25, 0.5, 0.75, 1] });
|
|
657
|
+
io.observe(box);
|
|
658
|
+
}
|
|
659
|
+
place(); setEl(box); const iv = setInterval(() => { place(); if (!io) setInlineInView(sid, rectInView(box)); }, 500);
|
|
660
|
+
if (!io) setInlineInView(sid, rectInView(box));
|
|
661
|
+
return () => { clearInterval(iv); if (io) io.disconnect(); box.remove(); setEl(null); setInlineInView(sid, false); };
|
|
629
662
|
}, [visible, sid]);
|
|
630
663
|
if (!visible || !el || !v) return null;
|
|
631
664
|
return ReactDOM.createPortal(h(CardBody, { v, size: s.cardSize || 96, manifest, pack: s.pack, surface: 'inline' }), el);
|
|
632
665
|
}
|
|
633
666
|
function DockBar({ sid }) {
|
|
634
667
|
const s = useSettings(); const tr = useTracker(sid); const v = useView(tr); const manifest = usePackManifest(s.pack);
|
|
635
|
-
const ref = React.useRef(null);
|
|
668
|
+
const ref = React.useRef(null); const inlineInView = useInlineInView(sid);
|
|
636
669
|
React.useLayoutEffect(() => { fitToColumn(ref.current, sid); });
|
|
637
|
-
if (!s.dock
|
|
670
|
+
if (!dockShouldShow({ dock: s.dock, inline: s.inline, dockMode: s.dockMode, live: showLive(v), inlineInView })) return null;
|
|
638
671
|
return h('div', { ref, 'data-mascot-dock': sid, style: { padding: '0 0 6px' } }, h(CardBody, { v, size: 40, compact: true, manifest, pack: s.pack, surface: 'dock' }));
|
|
639
672
|
}
|
|
640
673
|
function SessionSurfaces(props) {
|
|
@@ -723,8 +756,8 @@ function resultBrief(message) {
|
|
|
723
756
|
// ---------------------------------------------------------------- 图鉴 Dex (大肥鱼 public set)
|
|
724
757
|
// Each logical state the mascot enters lights one card; first unlock pops a "新解锁!" animation.
|
|
725
758
|
const DEX_KEY = 'dsh-mascot-dex:public'; const DEX_PACK = 'dafeiyu';
|
|
726
|
-
const DEX_CSS = ".mdx-ov{position:fixed;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;background:rgba(18,22,40,.35);animation:mdxk-ovIn .35s ease-out both;z-index:2147483600}.mdx-ov.mdx-out{animation:mdxk-ovOut .35s ease-in both}@keyframes mdxk-ovIn{from{opacity:0}}@keyframes mdxk-ovOut{to{opacity:0}}.mdx-stage{position:relative;pointer-events:auto;cursor:pointer;width:420px;height:520px;display:flex;flex-direction:column;align-items:center}.mdx-rays{position:absolute;left:50%;top:44%;width:760px;height:760px;margin:-380px 0 0 -380px;border-radius:50%; background:repeating-conic-gradient(from 0deg,var(--c2) 0 8deg,transparent 8deg 22deg);mask:radial-gradient(circle,#000 18%,transparent 62%);-webkit-mask:radial-gradient(circle,#000 18%,transparent 62%); opacity:0;animation:mdxk-rayIn .6s .45s ease-out forwards,mdxk-spin 14s .45s linear infinite}@keyframes mdxk-rayIn{to{opacity:.55}}@keyframes mdxk-spin{to{transform:rotate(360deg)}}.mdx-ring{position:absolute;left:50%;top:44%;width:40px;height:40px;margin:-20px;border-radius:50%;border:6px solid var(--c1);opacity:0;animation:mdxk-ring .9s .55s cubic-bezier(.1,.7,.3,1) forwards}@keyframes mdxk-ring{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(11)}}.mdx-ribbon{position:relative;z-index:2;margin-bottom:14px;padding:8px 26px;border-radius:999px;background:linear-gradient(90deg,var(--c1),var(--c2));color:#fff;font-weight:900;font-size:22px;letter-spacing:4px;box-shadow:0 8px 24px rgba(0,0,0,.25); opacity:0;animation:mdxk-ribbon .55s .75s cubic-bezier(.2,1.6,.4,1) forwards}@keyframes mdxk-ribbon{from{opacity:0;transform:translateY(-24px) scale(.6)}to{opacity:1;transform:none}}.mdx-flip{position:relative;z-index:2;width:240px;height:312px;perspective:900px;animation:mdxk-drop .5s cubic-bezier(.2,1.4,.4,1) both}@keyframes mdxk-drop{from{transform:translateY(60px) scale(.5);opacity:0}}.mdx-flip .mdx-in{position:absolute;inset:0;transform-style:preserve-3d;animation:mdxk-flip .7s .4s cubic-bezier(.5,0,.2,1.2) both}@keyframes mdxk-flip{from{transform:rotateY(0)}to{transform:rotateY(180deg)}}.mdx-flip img,.mdx-flip .mdx-front{position:absolute;inset:0;width:100%;height:100%;backface-visibility:hidden}.mdx-flip .mdx-front{transform:rotateY(180deg)}.mdx-flip .mdx-front img{position:absolute;inset:0}.mdx-flip video{position:absolute;left:50%;top:30px;width:190px;height:190px;margin-left:-95px;opacity:0;animation:mdxk-fadeV .4s 1.2s forwards}@keyframes mdxk-fadeV{to{opacity:1}}.mdx-flip .mdx-shine{position:absolute;inset:6px 6px 14px;border-radius:24px;overflow:hidden;pointer-events:none}.mdx-flip .mdx-shine:after{content:\"\";position:absolute;top:-50%;left:-80%;width:50%;height:200%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.85),transparent);transform:rotate(12deg);animation:mdxk-shine 1s 1.15s ease-in-out forwards}@keyframes mdxk-shine{to{left:150%}}.mdx-cap{position:relative;z-index:2;margin-top:16px;color:#fff;text-align:center;opacity:0;animation:mdxk-capIn .5s 1.1s ease-out forwards}.mdx-cap b{font-size:20px}.mdx-cap small{display:block;opacity:.8;margin-top:4px;font-size:13px}@keyframes mdxk-capIn{from{opacity:0;transform:translateY(10px)}to{opacity:1}}.mdx-spark{position:absolute;left:50%;top:44%;width:10px;height:10px;margin:-5px;border-radius:2px;background:var(--c);opacity:0;z-index:3;animation:mdxk-spark 1.1s var(--d) cubic-bezier(.1,.8,.3,1) forwards}@keyframes mdxk-spark{0%{opacity:1;transform:translate(0,0) rotate(0) scale(1)}100%{opacity:0;transform:translate(var(--x),var(--y)) rotate(var(--r)) scale(.4)}}@media (prefers-reduced-motion:reduce){.mdx-ov *{animation-duration:.01s!important;animation-delay:0s!important}}.mdx-grid-ov{position:fixed;inset:0;z-index:2147483500;background:rgba(18,22,40,.55);display:flex;align-items:center;justify-content:center}.mdx-panel{background:#F7F8FB;color:#1F2A44;border-radius:16px;width:min(1100px,94vw);max-height:90vh;overflow:auto;padding:18px 22px;font:14px system-ui,sans-serif}.mdx-head{display:flex;gap:14px;align-items:center;margin-bottom:12px}.mdx-head b{font-size:20px}.mdx-bar{flex:1;max-width:300px;height:8px;border-radius:5px;background:#E3E6EE;overflow:hidden}.mdx-bar i{display:block;height:100%;background:linear-gradient(90deg,#7C5CFF,#2F7BFF,#0FA3A3)}.mdx-head button{border:0;border-radius:8px;padding:6px 12px;background:#1F2A44;color:#fff;cursor:pointer}.mdx-grid{display:grid;grid-template-columns:repeat(auto-fill,120px);gap:10px;justify-content:center}.mdx-grid img{width:120px;height:156px;display:block}.mdx-grid img.on{cursor:pointer}.mdx-foot{margin-top:10px;font-size:11px;opacity:.6;text-align:center}";
|
|
727
|
-
const dex = { m: null, p: null, lit: null, subs: new Set(),
|
|
759
|
+
const DEX_CSS = ".mdx-ov{position:fixed;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;background:rgba(18,22,40,.35);animation:mdxk-ovIn .35s ease-out both;z-index:2147483600}.mdx-ov.mdx-out{animation:mdxk-ovOut .35s ease-in both}@keyframes mdxk-ovIn{from{opacity:0}}@keyframes mdxk-ovOut{to{opacity:0}}.mdx-stage{position:relative;pointer-events:auto;cursor:pointer;width:420px;height:520px;display:flex;flex-direction:column;align-items:center}.mdx-rays{position:absolute;left:50%;top:44%;width:760px;height:760px;margin:-380px 0 0 -380px;border-radius:50%; background:repeating-conic-gradient(from 0deg,var(--c2) 0 8deg,transparent 8deg 22deg);mask:radial-gradient(circle,#000 18%,transparent 62%);-webkit-mask:radial-gradient(circle,#000 18%,transparent 62%); opacity:0;animation:mdxk-rayIn .6s .45s ease-out forwards,mdxk-spin 14s .45s linear infinite}@keyframes mdxk-rayIn{to{opacity:.55}}@keyframes mdxk-spin{to{transform:rotate(360deg)}}.mdx-ring{position:absolute;left:50%;top:44%;width:40px;height:40px;margin:-20px;border-radius:50%;border:6px solid var(--c1);opacity:0;animation:mdxk-ring .9s .55s cubic-bezier(.1,.7,.3,1) forwards}@keyframes mdxk-ring{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(11)}}.mdx-ribbon{position:relative;z-index:2;margin-bottom:14px;padding:8px 26px;border-radius:999px;background:linear-gradient(90deg,var(--c1),var(--c2));color:#fff;font-weight:900;font-size:22px;letter-spacing:4px;box-shadow:0 8px 24px rgba(0,0,0,.25); opacity:0;animation:mdxk-ribbon .55s .75s cubic-bezier(.2,1.6,.4,1) forwards}@keyframes mdxk-ribbon{from{opacity:0;transform:translateY(-24px) scale(.6)}to{opacity:1;transform:none}}.mdx-flip{position:relative;z-index:2;width:240px;height:312px;perspective:900px;animation:mdxk-drop .5s cubic-bezier(.2,1.4,.4,1) both}@keyframes mdxk-drop{from{transform:translateY(60px) scale(.5);opacity:0}}.mdx-flip .mdx-in{position:absolute;inset:0;transform-style:preserve-3d;animation:mdxk-flip .7s .4s cubic-bezier(.5,0,.2,1.2) both}@keyframes mdxk-flip{from{transform:rotateY(0)}to{transform:rotateY(180deg)}}.mdx-flip img,.mdx-flip .mdx-front{position:absolute;inset:0;width:100%;height:100%;backface-visibility:hidden}.mdx-flip .mdx-front{transform:rotateY(180deg)}.mdx-flip .mdx-front img{position:absolute;inset:0}.mdx-flip video{position:absolute;left:50%;top:30px;width:190px;height:190px;margin-left:-95px;opacity:0;animation:mdxk-fadeV .4s 1.2s forwards}@keyframes mdxk-fadeV{to{opacity:1}}.mdx-flip .mdx-shine{position:absolute;inset:6px 6px 14px;border-radius:24px;overflow:hidden;pointer-events:none}.mdx-flip .mdx-shine:after{content:\"\";position:absolute;top:-50%;left:-80%;width:50%;height:200%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.85),transparent);transform:rotate(12deg);animation:mdxk-shine 1s 1.15s ease-in-out forwards}@keyframes mdxk-shine{to{left:150%}}.mdx-cap{position:relative;z-index:2;margin-top:16px;color:#fff;text-align:center;opacity:0;animation:mdxk-capIn .5s 1.1s ease-out forwards}.mdx-cap b{font-size:20px}.mdx-cap small{display:block;opacity:.8;margin-top:4px;font-size:13px}@keyframes mdxk-capIn{from{opacity:0;transform:translateY(10px)}to{opacity:1}}.mdx-spark{position:absolute;left:50%;top:44%;width:10px;height:10px;margin:-5px;border-radius:2px;background:var(--c);opacity:0;z-index:3;animation:mdxk-spark 1.1s var(--d) cubic-bezier(.1,.8,.3,1) forwards}@keyframes mdxk-spark{0%{opacity:1;transform:translate(0,0) rotate(0) scale(1)}100%{opacity:0;transform:translate(var(--x),var(--y)) rotate(var(--r)) scale(.4)}}@media (prefers-reduced-motion:reduce){.mdx-ov *{animation-duration:.01s!important;animation-delay:0s!important}}.mdx-grid-ov{position:fixed;inset:0;z-index:2147483500;background:rgba(18,22,40,.55);display:flex;align-items:center;justify-content:center}.mdx-panel{background:#F7F8FB;color:#1F2A44;border-radius:16px;width:min(1100px,94vw);max-height:90vh;overflow:auto;padding:18px 22px;font:14px system-ui,sans-serif}.mdx-head{display:flex;gap:14px;align-items:center;margin-bottom:12px}.mdx-head b{font-size:20px}.mdx-bar{flex:1;max-width:300px;height:8px;border-radius:5px;background:#E3E6EE;overflow:hidden}.mdx-bar i{display:block;height:100%;background:linear-gradient(90deg,#7C5CFF,#2F7BFF,#0FA3A3)}.mdx-head button{border:0;border-radius:8px;padding:6px 12px;background:#1F2A44;color:#fff;cursor:pointer}.mdx-grid{display:grid;grid-template-columns:repeat(auto-fill,120px);gap:10px;justify-content:center}.mdx-grid img{width:120px;height:156px;display:block}.mdx-grid img.on{cursor:pointer}.mdx-foot{margin-top:10px;font-size:11px;opacity:.6;text-align:center}.mdx-toast{position:fixed;top:64px;right:24px;z-index:2147483400;display:flex;gap:10px;align-items:center;max-width:340px;padding:8px 12px 8px 8px;border-radius:14px;background:rgba(255,255,255,.96);color:#1F2A44;box-shadow:0 6px 24px rgba(0,0,0,.18);font:13px/1.4 system-ui,sans-serif;cursor:pointer;animation:mdxk-tIn .3s ease-out both}.mdx-toast.mdx-out{animation:mdxk-tOut .3s ease-in both}@keyframes mdxk-tIn{from{opacity:0;transform:translateY(-10px)}}@keyframes mdxk-tOut{to{opacity:0;transform:translateY(-10px)}}.mdx-toast .mdx-th{display:flex;flex:none}.mdx-toast .mdx-th img{width:40px;height:52px;margin-left:-14px;filter:drop-shadow(0 1px 2px rgba(0,0,0,.2))}.mdx-toast .mdx-th img:first-child{margin-left:0}.mdx-toast b{display:block;font-size:13px}.mdx-toast span{display:block;font-size:12px;opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}@media (prefers-reduced-motion:reduce){.mdx-toast{animation:none}}";
|
|
760
|
+
const dex = { m: null, p: null, lit: null, subs: new Set(), toast: null };
|
|
728
761
|
function dexLit() { if (!dex.lit) { try { dex.lit = new Set(JSON.parse(localStorage.getItem(DEX_KEY) || '[]')); } catch (_e) { dex.lit = new Set(); } } return dex.lit; }
|
|
729
762
|
function dexSave() { try { localStorage.setItem(DEX_KEY, JSON.stringify([...dexLit()])); } catch (_e) { /* ignore */ } dex.subs.forEach((f) => f()); }
|
|
730
763
|
function dexLoad() { dex.p = dex.p || fetch(assetUrl(DEX_PACK, 'dex/manifest.json')).then((r) => r.json()).then((m) => { dex.m = m; return m; }).catch(() => null); return dex.p; }
|
|
@@ -740,16 +773,35 @@ function resultBrief(message) {
|
|
|
740
773
|
'<div class="mdx-flip"><div class="mdx-in"><img src="' + dexImg(e['locked@2x']) + '"><div class="mdx-front"><img src="' + dexImg(e['lit@2x']) + '"><video src="' + assetUrl(DEX_PACK, e.id + '.webm') + '" autoplay loop muted playsinline onerror="this.remove()"></video><div class="mdx-shine"></div></div></div></div>' +
|
|
741
774
|
'<div class="mdx-cap"><b>#' + String(e.index).padStart(2, '0') + ' ' + esc(e.label) + '</b><small>' + esc(e.trigger) + '</small></div></div>';
|
|
742
775
|
document.body.appendChild(ov);
|
|
743
|
-
return new Promise((res) => { let done = false; const close = () => { if (done) return; done = true; ov.classList.add('mdx-out'); setTimeout(() => { ov.remove(); res(); }, 350); }; const st = ov.querySelector('.mdx-stage'); if (st) st.onclick = close; setTimeout(close,
|
|
776
|
+
return new Promise((res) => { let done = false; const close = () => { if (done) return; done = true; ov.classList.add('mdx-out'); setTimeout(() => { ov.remove(); res(); }, 350); }; const st = ov.querySelector('.mdx-stage'); if (st) st.onclick = close; setTimeout(close, 3400); });
|
|
777
|
+
}
|
|
778
|
+
/** Toast copy for one or more unlocks that arrived close together (merged into a single toast). */
|
|
779
|
+
function dexToastText(items) {
|
|
780
|
+
const labels = items.map((e) => e.label);
|
|
781
|
+
return { title: items.length > 1 ? '新解锁 ×' + items.length : '新解锁!#' + String(items[0].index).padStart(2, '0'), line: labels.length > 4 ? labels.slice(0, 4).join('、') + ' 等' : labels.join('、') };
|
|
782
|
+
}
|
|
783
|
+
/** Automatic unlocks: one small corner toast, no backdrop; unlocks while it is showing merge into it. Click opens the dex. */
|
|
784
|
+
function dexToast(e) {
|
|
785
|
+
dexCss(); let t = dex.toast;
|
|
786
|
+
if (!t || !t.el.isConnected) {
|
|
787
|
+
const el = document.createElement('div'); el.className = 'mdx-toast'; el.setAttribute('data-mascot-dex-toast', ''); el.title = '点击查看大肥鱼图鉴';
|
|
788
|
+
t = dex.toast = { el, items: [], timer: 0, born: Date.now() };
|
|
789
|
+
el.onclick = () => { dexOpen(); closeToast(t); };
|
|
790
|
+
document.body.appendChild(el);
|
|
791
|
+
}
|
|
792
|
+
t.items.push(e); const tx = dexToastText(t.items);
|
|
793
|
+
t.el.setAttribute('data-count', String(t.items.length));
|
|
794
|
+
t.el.innerHTML = '<div class="mdx-th">' + t.items.slice(-3).map((x) => '<img alt="" src="' + dexImg(x.lit) + '" srcset="' + dexImg(x.lit) + ' 1x, ' + dexImg(x['lit@2x']) + ' 2x">').join('') + '</div><div><b>' + esc(tx.title) + '</b><span>' + esc(tx.line) + '</span></div>';
|
|
795
|
+
clearTimeout(t.timer); t.timer = setTimeout(() => closeToast(t), Math.max(800, Math.min(3500, t.born + 8000 - Date.now()))); // merged, but never lingers past ~8s
|
|
744
796
|
}
|
|
745
|
-
|
|
746
|
-
/** Light a card. Returns true on first unlock (and
|
|
797
|
+
function closeToast(t) { if (!t || t.closing) return; t.closing = true; clearTimeout(t.timer); if (dex.toast === t) dex.toast = null; t.el.classList.add('mdx-out'); setTimeout(() => t.el.remove(), 300); }
|
|
798
|
+
/** Light a card. Returns true on first unlock (and shows/merges the corner toast unless settings.dexPopup is off). */
|
|
747
799
|
function dexUnlock(id, opts) {
|
|
748
800
|
if (!id || dexLit().has(id)) return false;
|
|
749
801
|
if (!dex.m) { dexLoad().then((m) => { if (m) dexUnlock(id, opts); }); return false; }
|
|
750
802
|
const e = (dex.m.entries || []).find((x) => x.id === id); if (!e) return false;
|
|
751
803
|
dexLit().add(id); dexSave();
|
|
752
|
-
if (!(opts && opts.silent) && store.value.dexPopup !== false && typeof document !== 'undefined')
|
|
804
|
+
if (!(opts && opts.silent) && store.value.dexPopup !== false && typeof document !== 'undefined') dexToast(e);
|
|
753
805
|
return true;
|
|
754
806
|
}
|
|
755
807
|
async function dexOpen() {
|
|
@@ -782,9 +834,10 @@ function resultBrief(message) {
|
|
|
782
834
|
const cb = (k) => h('input', { type: 'checkbox', 'data-setting': k, checked: !!s[k], onChange: (e) => setSettings({ [k]: e.target.checked }) });
|
|
783
835
|
return h('div', { 'data-mascot-settings': '', style: { maxWidth: 640 } },
|
|
784
836
|
h('h2', { style: { fontSize: 18, margin: '0 0 8px' } }, '任务状态角色 / Task Mascot'),
|
|
785
|
-
h('p', { style: { fontSize: 12, opacity: 0.7, margin: '0 0 8px' } }, '角色动画实时跟随 Agent
|
|
837
|
+
h('p', { style: { fontSize: 12, opacity: 0.7, margin: '0 0 8px' } }, '角色动画实时跟随 Agent 的每一步(工具调用、思考、审批、出错、完成)。三种展示位置可任意组合;默认对话内卡片在视野里时不再重复显示状态条。'),
|
|
786
838
|
row('对话内卡片 Inline card(当前步骤处)', cb('inline')),
|
|
787
839
|
row('输入框上方状态条 Input dock bar', cb('dock')),
|
|
840
|
+
row('状态条何时显示 Dock bar mode', h('select', { 'data-setting': 'dockMode', value: s.dockMode || 'auto', onChange: (e) => setSettings({ dockMode: e.target.value }) }, [['auto', '自动:对话内卡片看不到时 auto'], ['always', '总是 always']].map(([k, l]) => h('option', { key: k, value: k }, l)))),
|
|
788
841
|
row('悬浮角色 Floating pet', cb('pet')),
|
|
789
842
|
row('角色包 Pack', h('select', { value: s.pack, onChange: (e) => setSettings({ pack: e.target.value }) }, packs.map((p) => h('option', { key: p.id, value: p.id }, p.title || p.id)))),
|
|
790
843
|
row('卡片动画大小 Card size: ' + s.cardSize + 'px', h('input', { type: 'range', min: 48, max: 200, step: 8, value: s.cardSize, onChange: (e) => setSettings({ cardSize: +e.target.value }) })),
|
|
@@ -798,7 +851,7 @@ function resultBrief(message) {
|
|
|
798
851
|
row('悬浮角色自动避让按钮/审批框 Pet avoids buttons', cb('avoid')),
|
|
799
852
|
row('提示音(审批/完成/出错)Sound cues', cb('sound')),
|
|
800
853
|
row('图鉴收集 Dex(新动作首次出现时点亮)', cb('dex')),
|
|
801
|
-
row('
|
|
854
|
+
row('新解锁提示(角落小卡片)Unlock toast', cb('dexPopup')),
|
|
802
855
|
row('大肥鱼图鉴 Collection', h('button', { type: 'button', 'data-dex-open': '', onClick: () => dexOpen() }, '打开图鉴 Open')),
|
|
803
856
|
row('悬浮不透明度 Pet opacity', h('input', { type: 'range', min: 0.3, max: 1, step: 0.05, value: s.opacity, onChange: (e) => setSettings({ opacity: +e.target.value }) })),
|
|
804
857
|
h('details', { style: { marginTop: 12 } },
|
|
@@ -822,7 +875,7 @@ function resultBrief(message) {
|
|
|
822
875
|
}
|
|
823
876
|
exports.apply = apply;
|
|
824
877
|
exports.inject = inject;
|
|
825
|
-
exports.__internals = { DEFAULT_RULES, ALL_STATES, compileRules, stateForTool, resolveState, pickVariant, displayState, createMachine, createTracker, actionText, partialArgs, resultBrief, GLOBAL_FALLBACK, STATE_ZH, STATE_ICON, dexUnlock, dexLit, dexLoad, dex };
|
|
878
|
+
exports.__internals = { DEFAULT_RULES, ALL_STATES, compileRules, stateForTool, resolveState, pickVariant, displayState, createMachine, createTracker, actionText, partialArgs, resultBrief, GLOBAL_FALLBACK, STATE_ZH, STATE_ICON, dexUnlock, dexLit, dexLoad, dex, dockShouldShow, dexToastText, DEFAULT_SETTINGS };
|
|
826
879
|
return module.exports;
|
|
827
880
|
},
|
|
828
881
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-task-mascot",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "metsh · Task Mascot — 真跟着 Agent 每一步工具调用在动。A DeepSeek Harness Web plugin whose mascot acts out every live tool call (read / write / edit / search / run / plan / sub-agent / wait / error) with step cards in chat. Swappable character packs (大肥鱼, Claude娘).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|