@clawlabz/clawskin 1.0.4 → 1.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/CHANGELOG.md CHANGED
@@ -1,98 +1,158 @@
1
1
  # ClawSkin Changelog
2
2
 
3
+ ## [0.3.0] - 2026-03-02
4
+
5
+ ### Agent Chat Panel + Weather System + Interactive Easter Eggs
6
+
7
+ ---
8
+
9
+ ### Added
10
+
11
+ - **Agent Chat Panel** (`app.html`, `GatewayClient.js`)
12
+ - Chat panel below character editor for direct messaging with the selected agent
13
+ - Supports send (`chat.send`) and history loading (`chat.history`)
14
+ - Real-time streaming display (delta → typing indicator → final message)
15
+ - Per-agent session isolation via independent sessionKey
16
+ - Only visible in Live mode; auto-hidden in Demo mode
17
+
18
+ - **Weather Cycling System** (`OfficeScene.js`, `CafeScene.js`, `HackerScene.js`)
19
+ - Click window / LED panel to cycle through weather states
20
+ - Office: ☀️ Sunny → 🌙 Night (moon + stars) → 🌧️ Rain (lightning) → ❄️ Snow
21
+ - Café: 🌧️ Rain → ☀️ Sunny → ❄️ Snow → 🌫️ Fog
22
+ - Hacker Den: 💜 Neon → 🔴 Red Alert → 💚 Matrix → 🌑 Blackout
23
+ - Weather affects global ambience (night darkening, lightning flash, snow on windowsill)
24
+
25
+ - **Pet Click Reactions** (`Pet.js`, `PetManager.js`)
26
+ - Click a pet to trigger a random speech bubble (unique phrases per pet type)
27
+ - Cat: "Purrr~", "💕", "(=^・ω・^=)" / Dog: "Woof!", "*tail wag*", "💖"
28
+ - Robot: "BOOP", "⚡" / Bird: "Tweet!", "🎵" / Hamster: "Squeak!", "🥜"
29
+ - Bubbles fade out smoothly; pets pause wandering during interaction
30
+
31
+ - **Treat Dropping** (`Pet.js`, `PetManager.js`)
32
+ - Click empty floor to drop a random treat (🍖🦴🐟🥜🌾🍪)
33
+ - Nearest pet within 200px walks over to eat it
34
+ - Type-specific reactions: "TREAT!! 🦴", "*chomp*", "Yummy fish!"
35
+
36
+ - **Interactive Decoration Easter Eggs** (`app.html`)
37
+ - Click clock → show current time
38
+ - Click bookshelf → random programmer quote
39
+ - Click whiteboard → random sprint note
40
+ - Click arcade cabinet → "INSERT COIN", "HIGH SCORE: 99999", etc.
41
+ - Click menu board → random café menu item
42
+ - Click plant → wiggle reaction "🌱 *wiggle*", "🌵 Don't touch!"
43
+
44
+ ### Improved
45
+
46
+ - **Editor panel layout** — RANDOM button moved to header bar, removed redundant SAVE button
47
+ - **Panel scroll behavior** — Panel itself non-scrollable; chat area fills remaining space with independent scroll
48
+ - **Panel width** 280px → 360px, chat font 5px → 8px for better readability
49
+ - **UI scale threshold** — No zoom below 2560px to prevent bloated HUD on normal screens
50
+
51
+ ### Files Changed
52
+
53
+ | File | Change | Description |
54
+ |------|--------|-------------|
55
+ | `public/app.html` | Modified | Chat panel CSS/HTML/JS, weather/pet/decoration click handlers, UI scale fix |
56
+ | `public/js/app/GatewayClient.js` | Modified | Added `sendChat()` method |
57
+ | `public/js/pets/Pet.js` | Modified | Added hitTest, react, goToTreat, eatTreat, bubble rendering |
58
+ | `public/js/pets/PetManager.js` | Modified | Added handleClick, dropTreat, treat management |
59
+ | `public/js/scenes/OfficeScene.js` | Modified | 4 weather states + cycleWeather + getWindowRect |
60
+ | `public/js/scenes/CafeScene.js` | Modified | 4 weather states + cycleWeather + getWindowRect |
61
+ | `public/js/scenes/HackerScene.js` | Modified | 4 mood states + cycleWeather + getWindowRect |
62
+
63
+ ---
64
+
3
65
  ## [0.2.0] - 2026-03-01
4
66
 
5
- ### 重大更新:3/4 RPG 视角 + 移动系统重构 + 独立宠物系统
67
+ ### 3/4 RPG Perspective + Movement Overhaul + Independent Pet System
6
68
 
7
- 本次更新解决三个核心问题:角色被家具遮挡、移动不自然、宠物与角色绑定。
69
+ Major update addressing three core issues: characters occluded by furniture, unnatural movement, and pets bound to characters.
8
70
 
9
71
  ---
10
72
 
11
- ### 新增
12
-
13
- - **独立宠物系统** (`js/pets/Pet.js`, `js/pets/PetManager.js`)
14
- - 宠物不再绑定 Agent,拥有独立的 AI 行为循环
15
- - 5 种宠物类型:猫 (walk)、狗 (walk)、机器人 (walk)、鸟 (fly)、仓鼠 (crawl)
16
- - 宠物自主移动:随机漫步、找 Agent 蹭腿、找其他宠物互动、原地睡觉
17
- - 鸟类飞行正弦波浮动 + 翅膀扇动动画
18
- - 仓鼠偶发高速冲刺行为
19
- - 宠物配置 localStorage 持久化,默认初始化猫 +
20
- - 支持动态增删任意数量的宠物
21
-
22
- - **POI 漫游系统** (`AgentSlot.js`)
23
- - Agent 空闲时 25% 概率前往 POI(水机、书架、窗户、植物)
24
- - 15% 概率走向同事工位进行社交互动
25
- - 到达 POI 后显示表情气泡(☕ 🌤️ 📖 👋 🌿)
26
- - 漫游范围扩大至全画面区域
27
-
28
- - **新宠物精灵** (`SpriteGenerator.js`)
29
- - `_drawBird()`: 蓝色身体、橙色喙/爪、2 帧翅膀扇动动画
30
- - `_drawHamster()`: 小麦色、粉色鼓腮、圆耳朵、2 帧尾巴摆动
31
-
32
- ### 改进
33
-
34
- - **3/4 俯视视角** 采用经典 RPG 视角(类 Stardew Valley / Pokemon)
35
- - 角色站在桌子后方(Y 值更小 = 画面偏上 = 视觉偏远)
36
- - 桌子在角色前方(Y 值更大 = 画面偏下 = 视觉偏近)
37
- - 角色上半身完全可见,不再被家具遮挡
38
-
39
- - **家具精灵重绘** (`SpriteGenerator.js`)
40
- - 桌子:3/4 视角可见桌面顶部 + 正面,木纹细节,48×20px
41
- - 显示器 笔记本电脑:键盘底座 + 倾斜屏幕,Apple 风格 logo,20×16px
42
- - 椅子:可见椅座坐垫 + 椅背 + 脚轮,16×18px
43
-
44
- - **三阶段渲染管线** (`ClawSkinApp.js`)
45
- - Phase 1: 渲染所有椅子(永远可见)
46
- - Phase 2: Y 坐标排序渲染角色(深度排序)
47
- - Phase 3: 渲染所有桌面 + 笔记本 + 咖啡杯(永远可见)
48
- - Phase 4: 渲染独立宠物
49
-
50
- - **平滑移动** (`AgentSlot.js`)
51
- - 所有移动使用线性插值 (lerp),告别瞬移/闪现
52
- - 返回工位也是平滑行走,不再直接 teleport
53
- - 移动速度提升:0.06~0.08(原 0.04~0.06)
54
- - 行走时带自然的正弦波摇晃效果
55
-
56
- ### 修复
57
-
58
- - 修复 Agent 漫游时桌子/椅子消失的问题家具现在永远渲染
59
- - 修复宠物跟随 Agent 一起瞬移的问题宠物已完全解耦
60
- - 修复 Agent 漫游后闪现回工位的问题改为平滑走回
61
- - 修复多 Agent 场景中角色遮挡关系错误 — 引入 Y-sort 深度排序
62
-
63
- ### 文件变更
64
-
65
- | 文件 | 类型 | 说明 |
66
- |------|------|------|
67
- | `js/sprites/SpriteGenerator.js` | 修改 | 重绘家具精灵 (3/4 视角),新增鸟/仓鼠精灵 |
68
- | `js/scenes/OfficeScene.js` | 修改 | 工位坐标重新计算,renderDesk 渲染顺序调整 |
69
- | `js/app/ClawSkinApp.js` | 修改 | 三阶段渲染管线,集成 PetManager,Agent 社交引用 |
70
- | `js/app/AgentSlot.js` | 重写 | lerp 平滑移动,POI 漫游系统,社交行为 |
71
- | `js/character/CharacterSprite.js` | 修改 | 移除宠物渲染代码 |
72
- | `js/pets/Pet.js` | **新建** | 独立宠物实体类 |
73
- | `js/pets/PetManager.js` | **新建** | 宠物集合管理器 |
74
- | `app.html` | 修改 | 添加 Pet/PetManager script 标签 |
75
- | `index.html` | 修改 | 添加 Pet/PetManager script 标签 |
76
- | `app.html` | 修改 | 添加 Pet/PetManager script 标签 |
73
+ ### Added
74
+
75
+ - **Independent Pet System** (`js/pets/Pet.js`, `js/pets/PetManager.js`)
76
+ - Pets are no longer bound to agents; they have their own AI behavior loop
77
+ - 5 pet types: Cat (walk), Dog (walk), Robot (walk), Bird (fly), Hamster (crawl)
78
+ - Autonomous movement: random walk, rub against agents, interact with other pets, nap in place
79
+ - Bird flight with sine-wave bobbing + wing-flap animation
80
+ - Hamster occasional speed bursts
81
+ - Pet config persisted to localStorage; defaults to cat + dog
82
+
83
+ - **POI Wandering System** (`AgentSlot.js`)
84
+ - Idle agents have 25% chance to visit POIs (water cooler, bookshelf, window, plant)
85
+ - 15% chance to walk to a colleague's desk for social interaction
86
+ - Emoji bubbles on POI arrival (☕ 🌤️ 📖 👋 🌿)
87
+ - Expanded roaming range to full canvas area
88
+
89
+ - **New Pet Sprites** (`SpriteGenerator.js`)
90
+ - `_drawBird()`: Blue body, orange beak/claws, 2-frame wing-flap animation
91
+ - `_drawHamster()`: Wheat-colored, pink cheek pouches, round ears, 2-frame tail wiggle
92
+
93
+ ### Improved
94
+
95
+ - **3/4 Top-Down Perspective** — Classic RPG view (Stardew Valley / Pokémon style)
96
+ - Characters stand behind desks (lower Y = further back visually)
97
+ - Desks in front of characters (higher Y = closer to viewer)
98
+ - Upper body fully visible, no longer occluded by furniture
99
+
100
+ - **Furniture Sprite Redraw** (`SpriteGenerator.js`)
101
+ - Desk: 3/4 view with visible top surface + front face, wood grain detail, 48×20px
102
+ - Monitor Laptop: keyboard base + tilted screen, Apple-style logo, 20×16px
103
+ - Chair: visible seat cushion + backrest + casters, 16×18px
104
+
105
+ - **Three-Phase Render Pipeline** (`ClawSkinApp.js`)
106
+ - Phase 1: Render all chairs (always visible)
107
+ - Phase 2: Y-sorted character rendering (depth sort)
108
+ - Phase 3: Render all desks + laptops + cups (always visible)
109
+ - Phase 4: Render independent pets
110
+
111
+ - **Smooth Movement** (`AgentSlot.js`)
112
+ - All movement uses linear interpolation (lerp), no more teleporting
113
+ - Returning to desk is also a smooth walk
114
+ - Movement speed increased: 0.06–0.08 (from 0.04–0.06)
115
+ - Natural sine-wave sway while walking
116
+
117
+ ### Fixed
118
+
119
+ - Fixed desks/chairs disappearing when agents wander — furniture now always renders
120
+ - Fixed pets teleporting with agents pets fully decoupled
121
+ - Fixed agents snapping back to desk now smooth walk-back
122
+ - Fixed character occlusion in multi-agent scenes introduced Y-sort depth sorting
123
+
124
+ ### Files Changed
125
+
126
+ | File | Change | Description |
127
+ |------|--------|-------------|
128
+ | `js/sprites/SpriteGenerator.js` | Modified | Redrawn furniture sprites (3/4 view), added bird/hamster sprites |
129
+ | `js/scenes/OfficeScene.js` | Modified | Recalculated workstation coords, adjusted renderDesk order |
130
+ | `js/app/ClawSkinApp.js` | Modified | Three-phase render pipeline, PetManager integration |
131
+ | `js/app/AgentSlot.js` | Rewritten | Lerp smooth movement, POI wandering, social behavior |
132
+ | `js/character/CharacterSprite.js` | Modified | Removed pet rendering code |
133
+ | `js/pets/Pet.js` | **New** | Independent pet entity class |
134
+ | `js/pets/PetManager.js` | **New** | Pet collection manager |
135
+ | `app.html` | Modified | Added Pet/PetManager script tags |
136
+ | `index.html` | Modified | Added Pet/PetManager script tags |
77
137
 
78
138
  ---
79
139
 
80
140
  ## [0.1.0] - 2026-02-28
81
141
 
82
- ### 初始版本
83
-
84
- - Canvas 2D 渲染,零外部依赖
85
- - 32×32 像素角色程序化生成(16 帧动画)
86
- - 5 种肤色、7 种发色、5 种发型、5 种服装类型
87
- - 4 种配饰:眼镜、帽子、耳机、鸭舌帽
88
- - 3 种宠物:猫、狗、机器人
89
- - 3 个场景:办公室、黑客地下室、咖啡馆
90
- - 8 种状态动画:idletypingthinkingexecutingbrowsingerrorsleepingwaving
91
- - 对话气泡系统
92
- - 捏脸编辑器 UI
93
- - Demo 模式(模拟状态切换)
94
- - Agent 支持(工位自动布局)
95
- - Gateway WebSocket 连接(OpenClaw 协议)
96
- - 点击 Agent 打开编辑器
97
- - localStorage 配置持久化
98
- - 嵌入式 iframe 页面
142
+ ### Initial Release
143
+
144
+ - Pure Canvas 2D rendering, zero external dependencies
145
+ - 32×32 pixel character procedural generation (16-frame animation)
146
+ - 5 skin tones × 7 hair colors × 5 hairstyles × 5 outfit types
147
+ - 4 accessories: glasses, hat, headphones, cap
148
+ - 3 pets: cat, dog, robot
149
+ - 3 scenes: Office, Hacker Den, Cozy Café
150
+ - 8 state animations: idle, typing, thinking, executing, browsing, error, sleeping, waving
151
+ - Dialogue bubble system with typewriter effect
152
+ - Character editor UI
153
+ - Demo mode (simulated state cycling)
154
+ - Multi-agent support (auto workstation layout)
155
+ - Gateway WebSocket connection (OpenClaw protocol)
156
+ - Click agent to open editor
157
+ - localStorage config persistence
158
+ - Embeddable iframe page
package/README.md CHANGED
@@ -1,134 +1,90 @@
1
1
  # 🎨 ClawSkin
2
2
 
3
- **Pixel Agent Skin Engine** — Give your AI assistant a face, an office, and a daily life.
3
+ **Give your AI agent a pixel life.**
4
4
 
5
- A pixel character engine that visualizes AI agent states in real-time. Pure Canvas 2D, zero dependencies, zero build tools.
5
+ ClawSkin turns your AI assistant into a living pixel character sitting at a desk, typing code, sipping coffee, petting a cat. Watch your agent work in real-time, or just enjoy the cozy vibes.
6
+
7
+ <p align="center">
8
+ <img src="docs/images/screenshot.png" alt="ClawSkin — Pixel agents working in an office" width="720">
9
+ </p>
6
10
 
7
11
  <p align="center">
8
12
  <img src="https://img.shields.io/badge/Canvas_2D-Procedural-blue" alt="Canvas 2D">
9
- <img src="https://img.shields.io/badge/JavaScript-ES6+-yellow?logo=javascript&logoColor=white" alt="JavaScript">
10
13
  <img src="https://img.shields.io/badge/Dependencies-0-brightgreen" alt="Zero Dependencies">
11
14
  <img src="https://img.shields.io/badge/Build-None-brightgreen" alt="Zero Build">
12
15
  <img src="https://img.shields.io/github/license/clawlabz/clawskin" alt="License">
13
16
  </p>
14
17
 
15
- ## ✨ Features
18
+ ---
16
19
 
17
- - 🧑‍🎨 **Character Customization** — 5 skin tones × 5 hairstyles × 5 outfits × 4 accessories × 5 pets = 2,500+ combinations
18
- - 🏠 **3 Scenes** — Office, Hacker Den, Cozy Café (each with ambient animations and particles)
19
- - 🎬 **8 State Animations** — idle, thinking, typing, executing, browsing, error, wave, sleeping
20
- - 💬 **Dialogue Bubbles** — Typewriter effect with emoji support
21
- - 👥 **Multi-Agent** — Display multiple AI agents simultaneously with independent states
22
- - 🐾 **Pixel Pets** — Cats, dogs, robots, birds, hamsters with autonomous AI behavior
23
- - 🎮 **Demo Mode** — Runs standalone without any backend connection
24
- - 📦 **Zero Dependencies** — Pure static files, just Node.js to serve
20
+ ## What is this?
25
21
 
26
- ## 🚀 Quick Start
22
+ A pixel companion that mirrors what your AI agent is doing — **in real-time**.
27
23
 
28
- ```bash
29
- git clone https://github.com/clawlabz/clawskin.git
30
- cd clawskin
31
- npm start
32
- # → http://localhost:3000
33
- ```
24
+ When your agent thinks, the character scratches its head. When it writes code, the character types furiously. When it browses the web, it stares at the screen. When it sleeps... it sleeps. 💤
34
25
 
35
- Opens the ClawSkin app and auto-connects to your local OpenClaw Gateway (`ws://localhost:18789`).
26
+ > Zero dependencies. Zero build tools. Just pixels.
36
27
 
37
- > **Why `npm start` instead of opening the HTML directly?**
38
- > Browsers block WebSocket connections from `file://` pages due to origin restrictions.
39
- > The built-in server runs on `http://localhost` which Gateway accepts. Zero dependencies — just Node.js.
28
+ ## Highlights
40
29
 
41
- ### CLI Options
30
+ 🧑‍🎨 **Customize Everything** — Mix skin tones, hairstyles, outfits, and accessories. 2,500+ unique looks.
42
31
 
43
- ```bash
44
- npm start # Default: localhost:3000, opens browser
45
- npm start -- --no-open # Don't open browser
46
- npm start -- --port 8080 # Custom port
47
- npm start -- --host 0.0.0.0 # Expose to network (see Security below)
48
- ```
32
+ 🏠 **3 Cozy Scenes** — Office, Hacker Den, and Café. Each with ambient weather, particles, and hidden easter eggs.
49
33
 
50
- ## 🏗️ Architecture
34
+ 🐾 **Pixel Pets** — Cats, dogs, birds, hamsters, and robots that wander around, nap, and react when you click them.
51
35
 
52
- ```
53
- clawSkin/
54
- ├── public/
55
- │ ├── index.html # Landing page (demo + customization)
56
- │ ├── app.html # Full-screen app (main product)
57
- │ ├── css/
58
- │ └── js/
59
- │ ├── app/ # ClawSkinApp, GatewayClient, Settings
60
- │ ├── scenes/ # Office / Hacker / Café scenes
61
- │ ├── character/ # Sprite rendering + animations
62
- │ ├── sprites/ # Procedural sprite generator
63
- │ ├── pets/ # Pet entity + manager
64
- │ ├── state/ # Agent state sync + demo mode
65
- │ └── ui/ # Character editor + scene picker
66
- ├── serve.cjs # Zero-dependency HTTP server
67
- └── docs/
68
- └── ARCHITECTURE.md # Detailed architecture doc
69
- ```
36
+ 💬 **Chat with Your Agent** — Click an agent to open a chat panel. Talk to them directly from the pixel world.
70
37
 
71
- ### Character Layer System
38
+ 🌦️ **Weather System** — Click the window to cycle through sunny, rainy, snowy, and night modes.
72
39
 
73
- ```
74
- Layer 5: Accessory — glasses / hat / headphones
75
- Layer 4: Hair — 5 styles with color variants
76
- Layer 3: Outfit — hoodie / suit / lab coat / ...
77
- Layer 2: Expression — happy / thinking / confused / sleepy
78
- Layer 1: Body — base 32×32 pixel humanoid + skin tone
79
- Layer 0: Shadow
80
- ```
81
-
82
- ### Agent State Mapping
40
+ 🎯 **Easter Eggs Everywhere** — Click the clock, bookshelf, plants, arcade machine... everything has a surprise.
83
41
 
84
- | Agent State | Pixel Character Behavior |
85
- |-------------|-------------------------|
86
- | `idle` | Sitting, drinking coffee, petting cat |
87
- | `thinking` | Thought bubble "..." |
88
- | `writing` | Fast typing, screen flickers |
89
- | `executing` | Walks to server rack |
90
- | `browsing` | Staring at screen, occasional clicks |
91
- | `error` | ❌ above head, frustrated expression |
92
- | `heartbeat` | Waves at window |
93
- | `sleeping` | Head on desk 💤 |
42
+ 🍖 **Feed Your Pets** Click the floor to drop a treat. Watch the nearest pet run over and munch it.
94
43
 
95
- ## 🔒 Security
96
-
97
- ClawSkin is designed to run locally as a companion UI. Here are the security considerations:
44
+ ## 🚀 Quick Start
98
45
 
99
- ### Local server (`serve.cjs`)
46
+ **One command, zero install:**
100
47
 
101
- - **Binds to `127.0.0.1` by default** — only accessible from your machine. Use `--host 0.0.0.0` explicitly if you need network access.
102
- - **`/api/config` endpoint** — returns the Gateway URL detected from `~/.openclaw/openclaw.json` for auto-connect convenience. **Auth tokens are never served** by this endpoint; users must enter tokens manually in the UI.
103
- - **Security headers** — CSP, X-Content-Type-Options, X-Frame-Options, and Referrer-Policy are set on all responses.
48
+ ```bash
49
+ npx @clawlabz/clawskin
50
+ ```
104
51
 
105
- ### Browser storage
52
+ That's it. Opens at `http://localhost:3000` with a live demo.
106
53
 
107
- - **Settings** (Gateway URL, scene choice, character config) are persisted in `localStorage`.
108
- - **Gateway auth token** is stored in `localStorage` after the user enters it manually. This is standard browser behavior (same as any web app with "remember me"). The token never leaves the browser.
109
- - **Device identity** — An Ed25519 keypair is generated and stored in `localStorage` for Gateway device pairing. The private key is stored as base64url in plaintext. This is a known tradeoff: `localStorage` is accessible to any JavaScript on the same origin. For a locally-run pixel companion, this is acceptable. If you need stronger protection, use the browser in a dedicated profile.
54
+ <details>
55
+ <summary>Or clone the repo</summary>
110
56
 
111
- ### WebSocket connection
57
+ ```bash
58
+ git clone https://github.com/clawlabz/clawskin.git
59
+ cd clawskin
60
+ npm start
61
+ ```
62
+ </details>
112
63
 
113
- - ClawSkin requests **read-only scopes** (`operator.read`, `operator.events`) from the Gateway it does not request admin privileges.
114
- - For remote connections, use `wss://` (e.g. via Tailscale Serve) to encrypt traffic.
64
+ To connect to your AI agent, click **⚡ CONNECT** and enter your [OpenClaw Gateway](https://github.com/anthropics/openclaw) URL.
115
65
 
116
66
  ## 🔗 Part of the Claw Ecosystem
117
67
 
118
68
  ```
119
- ClawSkin (you are here) → ClawArena → ClawGenesis
120
- Free / visual hook Light game Deep simulation
69
+ ClawSkin → ClawArena → ClawGenesis
70
+ Pixel companion AI battle game AI civilization
121
71
  ```
122
72
 
123
- ClawSkin characters can be reused as avatars in [ClawArena](https://github.com/clawlabz/clawarena) spectating scenes.
73
+ ClawSkin characters can be reused as avatars across the Claw ecosystem.
74
+
75
+ ## 📖 Documentation
76
+
77
+ - [Technical Architecture](docs/TECHNICAL.md) — render pipeline, state mapping, Gateway protocol
78
+ - [Architecture Overview](docs/ARCHITECTURE.md) — system design
79
+ - [Changelog](CHANGELOG.md) — version history
80
+ - [Roadmap](docs/ROADMAP.md) — what's next
124
81
 
125
82
  ## 🤝 Contributing
126
83
 
127
- Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
84
+ Contributions welcome! Ideas:
128
85
 
129
- Ideas for contributions:
130
86
  - 🎨 New scenes (bedroom, spaceship, garden...)
131
- - 👕 New outfit/hairstyle/accessory sprites
87
+ - 👕 New outfits, hairstyles, accessories
132
88
  - 🐾 New pet companions
133
89
  - 🌐 i18n support
134
90
 
@@ -0,0 +1,134 @@
1
+ # ClawSkin Technical Documentation
2
+
3
+ ## Architecture
4
+
5
+ ```
6
+ clawSkin/
7
+ ├── public/
8
+ │ ├── index.html # Landing page (demo + customization)
9
+ │ ├── app.html # Full-screen app (main product)
10
+ │ └── js/
11
+ │ ├── app/ # ClawSkinApp, GatewayClient, Settings
12
+ │ ├── scenes/ # Office / Hacker / Café scenes
13
+ │ ├── character/ # Sprite rendering + animations
14
+ │ ├── sprites/ # Procedural sprite generator
15
+ │ ├── pets/ # Pet entity + manager
16
+ │ ├── state/ # Agent state sync + demo mode
17
+ │ └── ui/ # Character editor + scene picker
18
+ ├── serve.cjs # Zero-dependency HTTP server
19
+ └── docs/
20
+ └── TECHNICAL.md # This file
21
+ ```
22
+
23
+ ## Character Layer System
24
+
25
+ ```
26
+ Layer 5: Accessory — glasses / hat / headphones
27
+ Layer 4: Hair — 5 styles with color variants
28
+ Layer 3: Outfit — hoodie / suit / lab coat / ...
29
+ Layer 2: Expression — happy / thinking / confused / sleepy
30
+ Layer 1: Body — base 32×32 pixel humanoid + skin tone
31
+ Layer 0: Shadow
32
+ ```
33
+
34
+ ## Agent State Mapping
35
+
36
+ | Agent State | Pixel Character Behavior |
37
+ |-------------|-------------------------|
38
+ | `idle` | Sitting, drinking coffee, petting cat |
39
+ | `thinking` | Thought bubble "..." |
40
+ | `writing` | Fast typing, screen flickers |
41
+ | `executing` | Walks to server rack |
42
+ | `browsing` | Staring at screen, occasional clicks |
43
+ | `error` | ❌ above head, frustrated expression |
44
+ | `heartbeat` | Waves at window |
45
+ | `sleeping` | Head on desk 💤 |
46
+
47
+ ## Render Pipeline
48
+
49
+ Three-phase rendering with painter's algorithm (back to front):
50
+
51
+ 1. **Scene Background** — walls, floor, windows, ambient weather effects, decorations
52
+ 2. **Workstation Layer** (per agent, Y-sorted):
53
+ - Chairs (behind character)
54
+ - Characters (depth-sorted by Y)
55
+ - Desks + laptops + cups (in front of character)
56
+ 3. **Overlay Layer**:
57
+ - Pets (independent wander, Y-sorted)
58
+ - Name tags + speech bubbles (always on top)
59
+
60
+ ## Weather System
61
+
62
+ Each scene supports weather cycling via window/panel click:
63
+
64
+ | Scene | States |
65
+ |-------|--------|
66
+ | Office | Sunny → Night (moon + stars) → Rain (lightning) → Snow |
67
+ | Café | Rain → Sunny → Snow → Fog |
68
+ | Hacker Den | Neon Purple → Red Alert → Matrix Green → Blackout |
69
+
70
+ Weather affects: window content, global ambient overlay, particle systems.
71
+
72
+ ## Pet AI Behavior
73
+
74
+ Decision cycle runs every 3–11 seconds:
75
+
76
+ | Roll | Action |
77
+ |------|--------|
78
+ | < 0.25 | Walk toward a random agent (rub legs) |
79
+ | < 0.40 | Walk toward another pet |
80
+ | < 0.60 | Random walk within floor bounds |
81
+ | < 0.60 + sleepChance | Sleep in place |
82
+ | else | Idle |
83
+
84
+ Pet types: Cat (walk), Dog (walk), Robot (walk), Bird (fly + sine bob), Hamster (crawl + speed bursts)
85
+
86
+ Collision detection against desk obstacles with axis-aligned sliding.
87
+
88
+ ## Gateway Protocol
89
+
90
+ ClawSkin connects to OpenClaw Gateway via WebSocket (protocol v3).
91
+
92
+ ### Connection Flow
93
+ 1. Open WebSocket → receive `connect.challenge` event
94
+ 2. Send `connect` RPC with client info + auth token
95
+ 3. On success → discover agents via `sessions.list`
96
+ 4. Route incoming events by `sessionKey` pattern: `agent:<agentId>:<platform>:...`
97
+
98
+ ### Key RPC Methods
99
+ - `connect` — authenticate and establish session
100
+ - `sessions.list` — discover active agent sessions
101
+ - `chat.send` — send message to agent (requires `idempotencyKey`)
102
+ - `chat.history` — fetch conversation history
103
+ - `agent.identity.get` — get agent metadata
104
+ - `status` / `health` — server status
105
+
106
+ ### Event Types
107
+ - `chat` (states: `delta`, `final`, `aborted`, `error`) — streaming chat responses
108
+ - `agent` (streams: `tool`, `lifecycle`, `compaction`) — agent activity events
109
+ - `presence` — connection status
110
+
111
+ ## Security
112
+
113
+ ### Local Server (`serve.cjs`)
114
+ - Binds to `127.0.0.1` by default — only accessible from your machine
115
+ - `/api/config` returns Gateway URL from `~/.openclaw/openclaw.json` (tokens never served)
116
+ - Security headers: CSP, X-Content-Type-Options, X-Frame-Options, Referrer-Policy
117
+
118
+ ### Browser Storage
119
+ - Settings persisted in `localStorage` (Gateway URL, scene, character config)
120
+ - Gateway auth token stored in `localStorage` after manual entry
121
+ - Ed25519 device identity keypair for Gateway pairing (base64url in localStorage)
122
+
123
+ ### WebSocket
124
+ - Requests read-only scopes (`operator.read`, `operator.events`)
125
+ - Use `wss://` for remote connections (e.g. via Tailscale Serve)
126
+
127
+ ## CLI Options
128
+
129
+ ```bash
130
+ npm start # Default: localhost:3000, opens browser
131
+ npm start -- --no-open # Don't open browser
132
+ npm start -- --port 8080 # Custom port
133
+ npm start -- --host 0.0.0.0 # Expose to network
134
+ ```
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawlabz/clawskin",
3
- "version": "1.0.4",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "Pixel Agent Skin Engine \u2014 Procedural 32\u00d732 character generator with scenes, animations & customization",
6
6
  "keywords": [
package/public/_redirects CHANGED
@@ -1 +0,0 @@
1
- / /app.html 302