agent-robot-avatar 0.3.2 → 0.6.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/CHANGELOG.md +209 -124
- package/LICENSE +21 -21
- package/README.md +198 -446
- package/agent-robot-avatar.js +27 -25
- package/docs/README.de.md +185 -166
- package/docs/README.es.md +185 -225
- package/docs/README.fr.md +185 -225
- package/docs/README.ja.md +185 -225
- package/docs/README.ko.md +185 -225
- package/docs/README.pt.md +185 -225
- package/docs/README.ru.md +185 -0
- package/docs/README.zh-CN.md +202 -396
- package/docs/README.zh-TW.md +185 -227
- package/index.d.ts +141 -111
- package/package.json +79 -77
- package/src/agent-robot-avatar-actions.js +403 -400
- package/src/agent-robot-avatar-antenna.js +152 -152
- package/src/agent-robot-avatar-core.js +1155 -1152
- package/src/agent-robot-avatar-extension-host.js +78 -78
- package/src/agent-robot-avatar-failure.js +131 -131
- package/src/agent-robot-avatar-geometry.js +40 -40
- package/src/agent-robot-avatar-gestures.js +170 -0
- package/src/agent-robot-avatar-head-roundness.js +103 -103
- package/src/agent-robot-avatar-inspect.js +242 -242
- package/src/agent-robot-avatar-love.js +226 -0
- package/src/agent-robot-avatar-random.js +272 -0
- package/src/agent-robot-avatar-runtime.js +948 -860
- package/src/agent-robot-avatar-version.js +3 -3
- package/src/agent-robot-avatar-waiting.js +154 -121
- package/src/agent-robot-avatar-wrap.js +66 -0
- package/src/agent-robot-avatar-antenna-flash.js +0 -127
package/README.md
CHANGED
|
@@ -1,446 +1,198 @@
|
|
|
1
|
-
# Agent Robot Avatar
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="./assets/readme/agent-robot-avatar-header.jpg" alt="Agent Robot Avatar">
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
[English](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/README.md) | [简体中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-CN.md) | [
|
|
8
|
-
|
|
9
|
-
   
|
|
12
|
-
|
|
13
|
-
A lightweight, expressive robot avatar Web Component for AI agents and
|
|
14
|
-
|
|
15
|
-
Suitable for AI assistant and agent interfaces, including products and experiences similar to ChatGPT, Claude, Codex, Cursor, Grok Bot, Gemini CLI, and OpenCode.
|
|
16
|
-
|
|
17
|
-
It can also be used for desktop pets, virtual pets, desktop companions, digital mascots, chatbot avatars, and other interactive character experiences.
|
|
18
|
-
|
|
19
|
-
Agent Robot Avatar can also be used as a visual feedback layer for AG-UI-style agent interfaces.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
avatar.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
avatar
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
avatar.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
```js
|
|
202
|
-
const status = document.querySelector('#agent-status');
|
|
203
|
-
const messages = {
|
|
204
|
-
waiting: 'Processing…',
|
|
205
|
-
failure: 'Task failed.',
|
|
206
|
-
error: 'Connection problem.',
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
avatar.addEventListener('action-state', ({ detail }) => {
|
|
210
|
-
if (detail.source === 'interaction') return;
|
|
211
|
-
if (detail.phase === 'start' && messages[detail.action]) {
|
|
212
|
-
status.textContent = messages[detail.action];
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Use a normal `role="status"` for routine updates. Do not announce blinking, gaze changes, or decorative drag reactions, and do not automatically make every error an interruptive alert. If the host already announces the same status elsewhere, the avatar can remain decorative to avoid duplicate screen-reader output.
|
|
218
|
-
|
|
219
|
-
See [`examples/accessibility.html`](./examples/accessibility.html) for a runnable request-lifecycle example covering waiting, success, failure, connection errors, host cancellation, request replacement, and stale-result protection. Its live-region text follows host request state rather than low-level face changes.
|
|
220
|
-
|
|
221
|
-
## Wake policy
|
|
222
|
-
|
|
223
|
-
The `wake-on` attribute controls automatic wake behavior:
|
|
224
|
-
|
|
225
|
-
```html
|
|
226
|
-
<agent-robot-avatar wake-on="manual"></agent-robot-avatar>
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
| Value | Behavior |
|
|
230
|
-
| --- | --- |
|
|
231
|
-
| `activity` | Default. Page pointer/keyboard activity can wake a sleeping avatar, preserving previous behavior. |
|
|
232
|
-
| `interaction` | Only direct interaction with this avatar wakes it automatically. Activity elsewhere does not. |
|
|
233
|
-
| `manual` | Environment activity, including direct avatar interaction, does not automatically wake it. |
|
|
234
|
-
|
|
235
|
-
Explicit API intent remains explicit: `avatar.play('wake')` wakes the avatar in every mode, and `avatar.noteActivity()` records activity and wakes by default even when the host calls it from inside a real `keydown`, `pointerdown`, or `click` handler. Pass `false` to `noteActivity(false)` to record activity without waking. Automatic page/direct-interaction wakeups are handled separately and still obey `wake-on`; their `action-state` source is `automatic`, while an explicit host wake remains `api`. Other program actions may leave sleep when their action semantics require a new visible state. `reset()` always returns to idle.
|
|
236
|
-
|
|
237
|
-
Different avatar instances may use different `wake-on` values.
|
|
238
|
-
|
|
239
|
-
## Reduced motion
|
|
240
|
-
|
|
241
|
-
Use the `motion` attribute to control animation intensity:
|
|
242
|
-
|
|
243
|
-
```html
|
|
244
|
-
<agent-robot-avatar motion="auto"></agent-robot-avatar>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
| Value | Behavior |
|
|
248
|
-
| --- | --- |
|
|
249
|
-
| `auto` | Default. Follows `prefers-reduced-motion` and responds to preference changes at runtime. |
|
|
250
|
-
| `reduce` | Keeps recognizable static states while suppressing continuous or elastic decorative motion. |
|
|
251
|
-
| `full` | Uses the normal animation style regardless of the system reduced-motion preference. |
|
|
252
|
-
|
|
253
|
-
Reduced mode suppresses continuous waiting orbits, idle wandering/blinking motion, head-follow inertia, elastic rebound, antenna spring motion, and status flashing where appropriate. Waiting/input lifecycles remain active until the host ends or replaces them, even when their visual state is static. Automatic sleep uses an independent cancellable timer rather than the draw loop, so it still works while reduced motion has paused continuous rendering; activity and runtime `auto-sleep` changes reschedule it, and active waiting/input are not overwritten. Static state changes are committed before reduced rendering pauses, including the final closed-eye sleep pose. Switching modes does not revive cancelled work or change `action-state` lifecycle semantics.
|
|
254
|
-
|
|
255
|
-
## Pointer following
|
|
256
|
-
|
|
257
|
-
Pointer following is enabled by default and can be controlled programmatically:
|
|
258
|
-
|
|
259
|
-
```js
|
|
260
|
-
avatar.setPointerFollow(false);
|
|
261
|
-
avatar.setPointerFollow(true);
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
High-frequency pointer positions are coalesced to the latest update per animation frame. Pointer following remains active in normal mode when the avatar is not being dragged or owned by another expression.
|
|
265
|
-
|
|
266
|
-
## Antenna flashing
|
|
267
|
-
|
|
268
|
-
Antenna status flashing is disabled by default and can be enabled per avatar:
|
|
269
|
-
|
|
270
|
-
```js
|
|
271
|
-
avatar.setAntennaFlash(true);
|
|
272
|
-
avatar.setAntennaFlash(false);
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Inspect configuration
|
|
276
|
-
|
|
277
|
-
Inspect/review timing and geometry can be customized before loading the component:
|
|
278
|
-
|
|
279
|
-
```html
|
|
280
|
-
<script>
|
|
281
|
-
window.AgentRobotAvatarInspectConfig = {
|
|
282
|
-
aperture: 24,
|
|
283
|
-
scanOffset: 12,
|
|
284
|
-
};
|
|
285
|
-
</script>
|
|
286
|
-
<script type="module" src="./agent-robot-avatar.js"></script>
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
The existing configuration object is preserved. Values are converted with `Number(...)`, must be finite, and are clamped to supported ranges; missing or invalid values receive defaults. `aperture` is clamped to `6–40`, `scanOffset` to `0–24`, and timing values to their supported `0/40–2400 ms` ranges. The same `window.AgentRobotAvatarInspectConfig` object can still be modified after loading; values are normalized again when an inspect action begins. Invalid input cannot enter the animation calculations as `NaN`.
|
|
290
|
-
|
|
291
|
-
Default configuration keeps the existing v0.2.1 visual timing.
|
|
292
|
-
|
|
293
|
-
## Head roundness
|
|
294
|
-
|
|
295
|
-
The head shape can be adjusted from a squarer form to a rounder form without changing the eye clipping or drag-deformation system:
|
|
296
|
-
|
|
297
|
-
```js
|
|
298
|
-
avatar.setHeadRoundness(0); // squarer
|
|
299
|
-
avatar.setHeadRoundness(50); // default
|
|
300
|
-
avatar.setHeadRoundness(100); // rounder
|
|
301
|
-
|
|
302
|
-
console.log(avatar.getHeadRoundness());
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
Values are clamped to the `0–100` range. The interactive Demo uses three presets by default and can unlock continuous adjustment.
|
|
306
|
-
|
|
307
|
-
The component emits `head-roundness-change` when the value changes:
|
|
308
|
-
|
|
309
|
-
```js
|
|
310
|
-
avatar.addEventListener('head-roundness-change', (event) => {
|
|
311
|
-
console.log(event.detail.value);
|
|
312
|
-
});
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
## Visual state event
|
|
316
|
-
|
|
317
|
-
The component continues to emit `face-state` whenever its visual state changes:
|
|
318
|
-
|
|
319
|
-
```js
|
|
320
|
-
avatar.addEventListener('face-state', (event) => {
|
|
321
|
-
console.log(event.detail.state);
|
|
322
|
-
});
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
Use this event for visual synchronization or legacy integrations. Prefer `action-state` for business/Agent lifecycle logic and accessibility status text.
|
|
326
|
-
|
|
327
|
-
## Attributes
|
|
328
|
-
|
|
329
|
-
```html
|
|
330
|
-
<agent-robot-avatar
|
|
331
|
-
size="160px"
|
|
332
|
-
color="#08090b"
|
|
333
|
-
auto-sleep="30000"
|
|
334
|
-
wake-on="activity"
|
|
335
|
-
motion="auto">
|
|
336
|
-
</agent-robot-avatar>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
| Attribute | Description |
|
|
340
|
-
| --- | --- |
|
|
341
|
-
| `size` | Positive pixel size. Accepts plain numbers such as `140` and explicit pixels such as `140px`. Unsupported units, malformed strings, zero, negative, and non-finite values fall back to `112px`. |
|
|
342
|
-
| `color` | Main avatar color. |
|
|
343
|
-
| `auto-sleep` | Idle time before automatic sleep, in milliseconds; `0` disables automatic sleep. |
|
|
344
|
-
| `wake-on` | Automatic wake policy: `activity` (default), `interaction`, or `manual`. |
|
|
345
|
-
| `motion` | Motion policy: `auto` (default), `reduce`, or `full`. |
|
|
346
|
-
|
|
347
|
-
All attributes are optional. Dynamic size changes are supported; drag coordinates and pointer following use the element's current layout size.
|
|
348
|
-
|
|
349
|
-
## Default behavior
|
|
350
|
-
|
|
351
|
-
Without explicit API calls, the avatar already provides subtle ambient behavior:
|
|
352
|
-
|
|
353
|
-
- Random blinking
|
|
354
|
-
- Subtle gaze wandering
|
|
355
|
-
- Pointer following when the cursor is nearby
|
|
356
|
-
- Light inertial head movement
|
|
357
|
-
- Natural return to idle
|
|
358
|
-
- Optional automatic sleep
|
|
359
|
-
|
|
360
|
-
`motion="reduce"` or an active system reduced-motion preference simplifies these decorative behaviors.
|
|
361
|
-
|
|
362
|
-
## Drag interaction
|
|
363
|
-
|
|
364
|
-
The avatar supports direct mouse, pen, and touch pointer dragging. The head deforms locally around the interaction point instead of moving as a rigid object.
|
|
365
|
-
|
|
366
|
-
- Strong outward pull while idle: triggers an `angry` visual reaction after recovery
|
|
367
|
-
- Strong inward push toward the center while idle: triggers a `success` visual reaction after recovery
|
|
368
|
-
- Small drag: deformation only, with no expression trigger
|
|
369
|
-
- Active program actions such as waiting/input keep expression ownership; drag deformation remains available but its decorative reaction is discarded
|
|
370
|
-
- `pointercancel`, lost capture, reset, replacement actions, and disconnect restore drag geometry without delayed reaction
|
|
371
|
-
|
|
372
|
-
The avatar interaction region uses `touch-action: pinch-zoom`: single-pointer movement remains available to the custom drag gesture, while two-pointer pinch zoom remains allowed. Page scrolling initiated outside the avatar keeps the page's normal touch behavior. Desktop mouse interaction is unchanged.
|
|
373
|
-
|
|
374
|
-
## Rendering and visibility
|
|
375
|
-
|
|
376
|
-
The component pauses sustained frame rendering when it has no visible layout area or is outside the viewport. Parent-container hiding is covered through layout/intersection observation. When it becomes visible again, the avatar resumes the current valid state rather than replaying stale actions.
|
|
377
|
-
|
|
378
|
-
Finite action timers continue to settle while visual drawing is paused, so action promises do not depend on continuous rendering. The existing hidden-page and settled-sleep pause behavior remains in place. Observers and per-instance media-query listeners are cleaned up when an avatar is disconnected.
|
|
379
|
-
|
|
380
|
-
## Interactive Demo
|
|
381
|
-
|
|
382
|
-
`demo/index.html` contains the full interactive Demo, including:
|
|
383
|
-
|
|
384
|
-
- All public expression states
|
|
385
|
-
- Pointer following
|
|
386
|
-
- Jelly drag deformation
|
|
387
|
-
- Waiting lifecycle
|
|
388
|
-
- Head-roundness presets and continuous adjustment
|
|
389
|
-
- Color and behavior controls
|
|
390
|
-
- Simulated Agent conversation states
|
|
391
|
-
|
|
392
|
-
The interactive Demo and Demo-only JavaScript are isolated in `demo/` and are not included in the reusable package runtime.
|
|
393
|
-
|
|
394
|
-
## Project structure
|
|
395
|
-
|
|
396
|
-
```text
|
|
397
|
-
agent-robot-avatar.js Public component entry
|
|
398
|
-
src/ Reusable component runtime and expression modules
|
|
399
|
-
demo/ Interactive Demo and Demo-only helpers
|
|
400
|
-
examples/ Minimal integration examples
|
|
401
|
-
assets/support/ Support / payment QR assets
|
|
402
|
-
docs/ Localized documentation
|
|
403
|
-
README.md English main documentation
|
|
404
|
-
CHANGELOG.md Public release history
|
|
405
|
-
CONTRIBUTING.md Contribution guide
|
|
406
|
-
package.json Package metadata
|
|
407
|
-
LICENSE MIT License
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
## Distribution
|
|
411
|
-
|
|
412
|
-
The package is published on npm as `agent-robot-avatar`. It includes the public entry, TypeScript declarations, runtime modules, documentation, and support assets.
|
|
413
|
-
|
|
414
|
-
The npm package intentionally includes only the public entry, TypeScript declarations, `src/` runtime, documentation, and support assets; Demo-only files and test files are excluded.
|
|
415
|
-
|
|
416
|
-
## Compatibility
|
|
417
|
-
|
|
418
|
-
Agent Robot Avatar is designed for modern browsers with support for ES modules, Custom Elements, SVG, Pointer Events, the Web Animations API, `IntersectionObserver`, `ResizeObserver`, and `matchMedia`.
|
|
419
|
-
|
|
420
|
-
The automated browser suite covers Chromium, Firefox, and WebKit. Trusted touch-drag cancellation is additionally exercised through Chromium's touch emulation; see the PR/release validation notes for any real-device coverage.
|
|
421
|
-
|
|
422
|
-
## Contributing
|
|
423
|
-
|
|
424
|
-
Issues and pull requests are welcome. See [`CONTRIBUTING.md`](./CONTRIBUTING.md) before submitting changes.
|
|
425
|
-
|
|
426
|
-
## Project status
|
|
427
|
-
|
|
428
|
-
v0.3.2 is the current public release. v0.1.0 remains available as the first public version. The public API is intentionally small so it can evolve carefully before a future `1.0.0` stability commitment.
|
|
429
|
-
|
|
430
|
-
Agent Robot Avatar is independently developed and is not affiliated with, endorsed by, or representative of any AI platform or brand.
|
|
431
|
-
|
|
432
|
-
## Character design and visual identity
|
|
433
|
-
|
|
434
|
-
The Agent Robot Avatar character, including its robot appearance and visual identity, is an original design by CX ArtLab.
|
|
435
|
-
|
|
436
|
-
The MIT License applies to the software and source code. It permits use, modification, and distribution of the software, including use of the avatar within applications, but it does not transfer ownership of the Agent Robot Avatar name, character identity, or visual identity, and does not grant the right to present them as another party's original character, trademark, or standalone brand.
|
|
437
|
-
|
|
438
|
-
References to third-party AI products describe possible use cases or product inspiration only and do not indicate affiliation, endorsement, or ownership of the character design.
|
|
439
|
-
|
|
440
|
-
## License
|
|
441
|
-
|
|
442
|
-
MIT License. See [`LICENSE`](./LICENSE).
|
|
443
|
-
|
|
444
|
-
## Buy me a coffee
|
|
445
|
-
|
|
446
|
-
<a href='https://ko-fi.com/P0E625WIOI' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
|
1
|
+
# Agent Robot Avatar
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="./assets/readme/agent-robot-avatar-header.jpg" alt="Agent Robot Avatar">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[English](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/README.md) | [简体中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-CN.md) | [Español](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.es.md) | [Русский](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ru.md) | [Français](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.fr.md) | [Português](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.pt.md) | [Deutsch](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.de.md) | [日本語](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ja.md) | [한국어](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ko.md) | [繁體中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-TW.md)
|
|
8
|
+
|
|
9
|
+
 [](./LICENSE) [](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml) [](https://ko-fi.com/P0E625WIOI)
|
|
10
|
+
|
|
11
|
+
   
|
|
12
|
+
|
|
13
|
+
A lightweight, expressive robot avatar Web Component for AI agents and interactive applications.
|
|
14
|
+
|
|
15
|
+
Suitable for AI assistant and agent interfaces, including products and experiences similar to ChatGPT, Claude, Codex, Cursor, Grok Bot, Gemini CLI, and OpenCode.
|
|
16
|
+
|
|
17
|
+
It can also be used for desktop pets, virtual pets, desktop companions, digital mascots, chatbot avatars, and other interactive character experiences.
|
|
18
|
+
|
|
19
|
+
Agent Robot Avatar can also be used as a visual feedback layer for AG-UI-style agent interfaces.
|
|
20
|
+
|
|
21
|
+
Built with SVG and vanilla JavaScript, it works as a native custom element with zero runtime dependencies.
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<img src="./assets/demo/agent-robot-avatar-demo.gif" alt="Agent Robot Avatar interactive animation demo" width="560">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
## Live Demo
|
|
28
|
+
|
|
29
|
+
[Open the interactive demo](https://cx-artlab.github.io/agent-robot-avatar/)
|
|
30
|
+
|
|
31
|
+
## Highlights
|
|
32
|
+
|
|
33
|
+
- Native Web Component
|
|
34
|
+
- SVG rendering + vanilla JavaScript
|
|
35
|
+
- Zero runtime dependencies
|
|
36
|
+
- Automatic blinking and subtle idle behavior
|
|
37
|
+
- Pointer-following eyes and inertial head movement
|
|
38
|
+
- Jelly-style drag deformation with elastic recovery
|
|
39
|
+
- Press-and-hold squeeze and draggable spring antenna interactions
|
|
40
|
+
- Programmatically controlled Agent states and expressions
|
|
41
|
+
- Waiting, success, failure, warning, review, blocked, and system-error feedback
|
|
42
|
+
- Reduced-motion support
|
|
43
|
+
- Configurable sleep behavior
|
|
44
|
+
- Adjustable head roundness
|
|
45
|
+
- Optional antenna status flashing
|
|
46
|
+
- TypeScript declarations included
|
|
47
|
+
|
|
48
|
+
## Embedded eyes (experimental)
|
|
49
|
+
|
|
50
|
+
An independent, allocation-free C++11 eyes-only engine draws the same 18 expressions on robot and dev-board screens. Firmware examples cover 26 board and screen configurations across ESP32, ESP32-S3 and RP2040 — ST7789, ST7735, GC9A01 round, ILI9341/9342/9488, CO5300 AMOLED, ST7701S RGB panels and SSD1306/SH1106 OLEDs, including LilyGO, M5Stack, Waveshare, Seeed and Espressif boards. Every example compiles in CI; none is verified on real hardware yet, so please send a hardware report if you try one.
|
|
51
|
+
|
|
52
|
+
See the [embedded guide](https://github.com/CX-ArtLab/agent-robot-avatar/tree/main/embedded) and [中文说明](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/embedded/README.zh-CN.md). The Web component's installation and behavior are unchanged.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install agent-robot-avatar
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
import 'agent-robot-avatar';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or load the repository source directly:
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<script type="module" src="./agent-robot-avatar.js"></script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Then add the component:
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<agent-robot-avatar id="avatar"></agent-robot-avatar>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
No initialization code is required. The avatar enters its default idle behavior automatically.
|
|
77
|
+
|
|
78
|
+
## Basic usage
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
const avatar = document.querySelector('#avatar');
|
|
82
|
+
|
|
83
|
+
avatar.play('success');
|
|
84
|
+
avatar.play('wary');
|
|
85
|
+
avatar.play('refuse');
|
|
86
|
+
|
|
87
|
+
avatar.reset();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Available actions:
|
|
91
|
+
|
|
92
|
+
`idle` · `bored` · `waiting-spin` · `waiting-wrap` · `waiting-wave` · `input` · `affirm` · `success` · `failure` · `wary` · `inspect` · `angry` · `refuse` · `surprise` · `love` · `random` · `sleep` · `wake`
|
|
93
|
+
|
|
94
|
+
`waiting-wave` plays three 1.1-second waves: the eyes bob vertically with a staggered rhythm and amplitude of 10 SVG units, then settle. Use `startWaiting({ variant: 'wave' })` for seamless continuous waiting, and `stopWaiting()` to stop. It honors the component's reduced-motion setting and reports the canonical `waiting` action lifecycle.
|
|
95
|
+
|
|
96
|
+
Action names describe what the avatar does. `refuse` shakes the head, for a request the Agent cannot or will not carry out; `failure` is for a task or connection that did not succeed; `wary` turns the head and gives a guarded up-and-down look, for an action that needs confirmation. Names from 0.5 (`send`, `warning`, `error`, `blocked` and others) still work with a console notice until 1.0; see the [upgrade table](CHANGELOG.md#upgrading-from-05x).
|
|
97
|
+
|
|
98
|
+
`love` expresses affection or thanks: the two eyes lean together into a single heart, beat three times, then return.
|
|
99
|
+
|
|
100
|
+
`random` plays a slot-machine spin: each eye rolls over a drum, then the left eye slows, bounces and settles, followed by the right. `slot` is an alias.
|
|
101
|
+
|
|
102
|
+
For a real Agent request lifecycle:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
avatar.startWaiting();
|
|
106
|
+
|
|
107
|
+
// Alternative waiting motion: eyes turn out through one side and return through the other.
|
|
108
|
+
avatar.startWaiting({ variant: 'wrap' });
|
|
109
|
+
|
|
110
|
+
// Alternative waiting motion: staggered vertical eye waves.
|
|
111
|
+
avatar.startWaiting({ variant: 'wave' });
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
const result = await runAgentRequest();
|
|
115
|
+
await avatar.play(result.ok ? 'success' : 'failure');
|
|
116
|
+
} catch (error) {
|
|
117
|
+
await avatar.play('failure');
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Common options
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<agent-robot-avatar
|
|
125
|
+
size="160"
|
|
126
|
+
color="#08090b"
|
|
127
|
+
auto-sleep="30000"
|
|
128
|
+
wake-on="activity"
|
|
129
|
+
motion="auto">
|
|
130
|
+
</agent-robot-avatar>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
| Attribute | Purpose |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| `size` | Avatar size in pixels |
|
|
136
|
+
| `color` | Main avatar color |
|
|
137
|
+
| `auto-sleep` | Idle time before automatic sleep; `0` disables it |
|
|
138
|
+
| `wake-on` | Automatic wake policy: `activity`, `interaction`, or `manual` |
|
|
139
|
+
| `motion` | Motion policy: `auto`, `reduce`, or `full` |
|
|
140
|
+
| `press-squeeze` | Center press-and-hold squeeze; set to `false` to disable |
|
|
141
|
+
| `antenna-drag` | Antenna drag, spring return, and angry reaction; set to `false` to disable |
|
|
142
|
+
|
|
143
|
+
Common runtime controls:
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
avatar.setPointerFollow(false);
|
|
147
|
+
avatar.setHeadRoundness(75);
|
|
148
|
+
avatar.setPressSqueeze(true);
|
|
149
|
+
avatar.setAntennaDrag(true);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The avatar center begins the squeeze interaction. Moving more than 4 CSS pixels transfers the same pointer gesture to the existing head drag. Dragging the antenna uses the same pull limit as head dragging and ends with the existing angry reaction.
|
|
153
|
+
|
|
154
|
+
## Events and integration
|
|
155
|
+
|
|
156
|
+
The component emits `face-state` for visual state changes and `action-state` for semantic action lifecycle changes.
|
|
157
|
+
|
|
158
|
+
For host integrations and accessibility status text, prefer `action-state`. See [`examples/accessibility.html`](./examples/accessibility.html) for a runnable request-lifecycle example.
|
|
159
|
+
|
|
160
|
+
A minimal integration example is available at [`examples/basic.html`](./examples/basic.html).
|
|
161
|
+
|
|
162
|
+
## Compatibility
|
|
163
|
+
|
|
164
|
+
Designed for modern browsers with support for ES Modules, Custom Elements, SVG, Pointer Events, Web Animations API, `IntersectionObserver`, `ResizeObserver`, and `matchMedia`.
|
|
165
|
+
|
|
166
|
+
Automated browser tests cover Chromium, Firefox, and WebKit.
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
Issues and pull requests are welcome. See [`CONTRIBUTING.md`](./CONTRIBUTING.md) before submitting changes.
|
|
171
|
+
|
|
172
|
+
## Project status
|
|
173
|
+
|
|
174
|
+
**Current public version: v0.6.0**
|
|
175
|
+
|
|
176
|
+
The public API is intentionally kept compact while the project evolves toward a future `1.0.0` stability commitment.
|
|
177
|
+
|
|
178
|
+
Agent Robot Avatar is independently developed and is not affiliated with, endorsed by, or representative of any AI platform or brand.
|
|
179
|
+
|
|
180
|
+
## Character design and visual identity
|
|
181
|
+
|
|
182
|
+
The Agent Robot Avatar character, including its robot appearance and visual identity, is an original design by CX ArtLab.
|
|
183
|
+
|
|
184
|
+
The MIT License applies to the software and source code. It allows the avatar to be used, modified, and distributed as part of applications, but it does not transfer ownership of the Agent Robot Avatar name, character identity, or visual identity, or grant the right to present them as another party's original character or standalone brand.
|
|
185
|
+
|
|
186
|
+
Third-party product names mentioned in this project describe possible use cases only and do not indicate affiliation or endorsement.
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT License. See [`LICENSE`](./LICENSE).
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
If this project is useful to you, you can buy me a coffee.
|
|
195
|
+
|
|
196
|
+
<a href='https://ko-fi.com/P0E625WIOI' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
|
197
|
+
|
|
198
|
+
|