diff --git a/docs/implementation-queue.md b/docs/implementation-queue.md index 7d467cb..d94259a 100644 --- a/docs/implementation-queue.md +++ b/docs/implementation-queue.md @@ -143,6 +143,7 @@ otification`、`offline`。 - 2D 纸片人桌宠已从 manifest 基础推进到可运行窗口:透明、无边框、跳过任务栏、关闭后回托盘,并预留状态动作循环。 - JWT 运行时已支持 `exp` 过期识别、401/403 状态映射和聊天界面重新登录提示。 - 桌宠窗口已接入双槽位运行状态:连接中工作、重连回应、断开休息、认证过期/致命错误提示。 +- 已接入 `aemeath_withclaude-2.0.8` 的 MIT 像素素材;保留来源署名,并将 spritesheet 动作行映射到当前桌宠状态。 - 不复制 Hermes 或 Codex 的私有实现;只参考交互模式和资源组织方式。 - 不在首轮实现 Live2D、Spine、3D 桌宠或用户脚本插件。 diff --git a/docs/progress.md b/docs/progress.md index 218f4dd..0a8ba42 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -199,4 +199,11 @@ Still not claimed complete: automatic startup activation, real Tauri multi-windo - AstrBot 401/403 responses during probe or chat now preserve the affected slot and expose an `authExpired` runtime error. - Chat UI shows a re-login warning for the affected slot; credentials remain managed by Windows Credential Manager. - The floating 2D pet now polls the dual-slot runtime and switches between idle, work, reply, rest, and error states instead of running an isolated demo loop. + +## 2026-07-20: Aemeath pixel sprite integration + +- Reviewed `aemeath_withclaude-2.0.8`; the supplied repository and referenced pixel asset are MIT-licensed, not CC-licensed. +- Added the original 8-column, 192x208-frame WebP spritesheet as a project-local pet asset with preserved attribution. +- Added a validated pet manifest and mapped the source animation rows into idle, thinking, speaking, notification, error, and offline states. +- Replaced the CSS placeholder character in the floating pet view with the real pixel spritesheet renderer. - Validation: Rust workspace tests (65), Clippy, TypeScript, ESLint, Vitest (6), and Vite build pass. diff --git a/src/App.tsx b/src/App.tsx index e11cf12..2aa9a43 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -21,6 +21,19 @@ const initialStatus: BootstrapStatus = { databaseSchemaVersion: 4, }; +const AEMEATH_SPRITESHEET = new URL( + "./features/pet/assets/aemeath/aemeath-spritesheet.webp", + import.meta.url, +).href; + +const AEMEATH_FRAMES: Record<"idle" | "working" | "resting" | "speaking" | "error", number[]> = { + idle: [0, 1, 2, 3, 4, 5], + working: [80, 81, 82, 83, 84, 85, 86, 87, 104, 105, 106, 107, 108, 109, 110, 111], + resting: [48, 49, 50, 51, 52, 53], + speaking: [72, 73, 74, 75, 76, 77, 78, 79], + error: [40, 41, 42, 43, 44, 45, 46, 47], +}; + const navigation: Array<{ key: PageKey; label: string; description: string }> = [ { key: "chat", label: "聊天", description: "陪伴与运维对话" }, @@ -392,6 +405,7 @@ function PetPage() { function DesktopPetView() { const [state, setState] = useState<"idle" | "working" | "resting" | "speaking" | "error">("idle"); + const [frameIndex, setFrameIndex] = useState(0); useEffect(() => { let cancelled = false; @@ -429,6 +443,19 @@ function DesktopPetView() { }; }, []); + useEffect(() => { + setFrameIndex(0); + const frames = AEMEATH_FRAMES[state]; + const timer = window.setInterval(() => { + setFrameIndex((current) => (current + 1) % frames.length); + }, state === "resting" ? 180 : 125); + return () => window.clearInterval(timer); + }, [state]); + + const frame = AEMEATH_FRAMES[state][frameIndex % AEMEATH_FRAMES[state].length]; + const frameRow = Math.floor(frame / 8); + const frameColumn = frame % 8; + return (
-
-
-
- - - - - -
-
- - - -
-
+
{state === "working" ? "正在写写画画" : state === "resting" ? "休息中" : state === "speaking" ? "正在回应" : state === "error" ? "需要重新登录或检查连接" : "陪伴中"}
); diff --git a/src/features/pet/assets/aemeath/ATTRIBUTION.md b/src/features/pet/assets/aemeath/ATTRIBUTION.md new file mode 100644 index 0000000..71d335d --- /dev/null +++ b/src/features/pet/assets/aemeath/ATTRIBUTION.md @@ -0,0 +1,12 @@ +# Aemeath Pixel Companion Attribution + +This asset is adapted from the `aemeath_withclaude-2.0.8` project. + +- Pixel sprite source: `lzy-buaa-jdi/ameath` +- Source: https://gitee.com/lzy-buaa-jdi/ameath +- License: MIT +- Upstream project license: MIT License, copyright (c) 2026 sinlatansen + +AstrBot Desktop keeps this attribution with the adapted sprite asset. The +character and related visual references remain the property of their respective +rights holders; this project does not claim ownership of the character design. diff --git a/src/features/pet/assets/aemeath/aemeath-spritesheet.webp b/src/features/pet/assets/aemeath/aemeath-spritesheet.webp new file mode 100644 index 0000000..d8e6e74 Binary files /dev/null and b/src/features/pet/assets/aemeath/aemeath-spritesheet.webp differ diff --git a/src/features/pet/assets/aemeath/manifest.json b/src/features/pet/assets/aemeath/manifest.json new file mode 100644 index 0000000..5e3c822 --- /dev/null +++ b/src/features/pet/assets/aemeath/manifest.json @@ -0,0 +1,19 @@ +{ + "format": "astrbot-pet-pack.v1", + "name": "Aemeath Pixel Companion", + "version": "1.0.0", + "image": "aemeath-spritesheet.webp", + "width": 1536, + "height": 3120, + "frameWidth": 192, + "frameHeight": 208, + "columns": 8, + "animations": [ + { "id": "idle", "state": "idle", "frames": [0, 1, 2, 3, 4, 5], "fps": 6, "loop": true, "movement": "stationary" }, + { "id": "thinking", "state": "thinking", "frames": [80, 81, 82, 83, 84, 85, 86, 87, 104, 105, 106, 107, 108, 109, 110, 111], "fps": 8, "loop": true, "movement": "stationary" }, + { "id": "speaking", "state": "speaking", "frames": [72, 73, 74, 75, 76, 77, 78, 79], "fps": 8, "loop": true, "movement": "stationary" }, + { "id": "notification", "state": "notification", "frames": [24, 25, 26, 27, 32, 33, 34, 35], "fps": 7, "loop": true, "movement": "stationary" }, + { "id": "error", "state": "error", "frames": [40, 41, 42, 43, 44, 45, 46, 47], "fps": 7, "loop": true, "movement": "stationary" }, + { "id": "offline", "state": "offline", "frames": [48, 49, 50, 51, 52, 53], "fps": 5, "loop": true, "movement": "stationary" } + ] +} diff --git a/src/features/pet/types.ts b/src/features/pet/types.ts index 1fe4ef9..5572323 100644 --- a/src/features/pet/types.ts +++ b/src/features/pet/types.ts @@ -44,6 +44,9 @@ export const petPackManifestSchema = z image: z.string().regex(/^[^\\/:*?"<>|]+\\.(png|webp)$/i), width: z.number().int().positive().max(4096), height: z.number().int().positive().max(4096), + frameWidth: z.number().int().positive().max(1024), + frameHeight: z.number().int().positive().max(1024), + columns: z.number().int().positive().max(64), animations: z.array(petAnimationSchema).min(1), }) .strict(); diff --git a/src/styles.css b/src/styles.css index b3edde2..1545ad2 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1158,3 +1158,17 @@ select:focus { @keyframes pet-work { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-4px) rotate(2deg); } } @keyframes pet-rest { 50% { transform: translateY(8px) rotate(8deg); } } @keyframes pet-error { from { transform: translateX(-3px); } to { transform: translateX(3px); } } + +.aemeath-pet-sprite { + width: 192px; + height: 208px; + background-repeat: no-repeat; + background-size: 1536px 3120px; + image-rendering: pixelated; + transform: scale(.78); + transform-origin: center; +} + +.aemeath-pet-working { filter: drop-shadow(0 0 8px rgb(115 190 255 / 45%)); } +.aemeath-pet-speaking { filter: drop-shadow(0 0 8px rgb(255 207 125 / 45%)); } +.aemeath-pet-error { filter: drop-shadow(0 0 8px rgb(255 105 130 / 60%)); }