agent-robot-avatar 0.3.1 → 0.5.2

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 CHANGED
@@ -1,446 +1,186 @@
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) | [繁體中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-TW.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) | [Español](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.es.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) | [Français](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.fr.md)
8
-
9
- ![Version](https://img.shields.io/badge/version-v0.3.1-111111?style=flat-square) [![License](https://img.shields.io/badge/license-MIT-0A7EA4?style=flat-square)](./LICENSE) [![CI](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml/badge.svg?branch=main)](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml) [![Ko-fi](https://img.shields.io/badge/Ko--fi-Support-FF5E5B?style=flat-square&logo=ko-fi&logoColor=white)](https://ko-fi.com/P0E625WIOI)
10
-
11
- ![Vanilla JavaScript](https://img.shields.io/badge/Vanilla-JavaScript-F7DF1E?style=flat-square&logo=javascript&logoColor=000) ![Web Component](https://img.shields.io/badge/Web-Native%20Component-5A67D8?style=flat-square) ![SVG](https://img.shields.io/badge/Rendering-SVG-FFB13B?style=flat-square&logo=svg&logoColor=000) ![Zero Dependencies](https://img.shields.io/badge/Dependencies-0-2EA44F?style=flat-square) ![14 Agent States](https://img.shields.io/badge/Agent%20states-14-8B5CF6?style=flat-square) ![Pointer Following](https://img.shields.io/badge/Pointer-following-00A67E?style=flat-square) ![Jelly Drag](https://img.shields.io/badge/Drag-jelly%20physics-FF69B4?style=flat-square)
12
-
13
- A lightweight, expressive robot avatar Web Component for AI agents and other 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
- Agent Robot Avatar is built with SVG and vanilla JavaScript. It has no third-party animation framework dependency, works as a native custom element, and exposes a compact API for expressions, interaction states, pointer behavior, waiting feedback, and head-shape customization.
22
-
23
- **Current public version: v0.3.1**
24
-
25
- <p align="center">
26
- <img src="./assets/demo/agent-robot-avatar-demo.gif" alt="Agent Robot Avatar interactive animation demo" width="560">
27
- </p>
28
-
29
- ## Live Demo
30
-
31
- Try the interactive demo: [Open Agent Robot Avatar](https://cx-artlab.github.io/agent-robot-avatar/?lang=en)
32
-
33
- ## Highlights
34
-
35
- - Pure SVG + vanilla JavaScript
36
- - Native Web Component
37
- - No third-party animation framework
38
- - Automatic blinking and subtle idle gaze
39
- - Pointer-following eyes and inertial head movement
40
- - Jelly-style local drag deformation with elastic recovery
41
- - Programmatically controlled Agent states and expressions
42
- - Distinct waiting, failure, warning, review, blocked-content, and system-error semantics
43
- - Semantic `action-state` lifecycle events for host integrations
44
- - Reduced-motion support and visibility-aware frame pausing
45
- - Configurable sleep wake policy
46
- - Adjustable head roundness
47
- - Floating antenna with optional status flashing
48
- - Demo UI kept separate from the reusable component
49
-
50
- ## Quick start
51
-
52
- When using the repository source directly, keep `agent-robot-avatar.js` together with the `src/` directory, then load the public entry:
53
-
54
- ```html
55
- <script type="module" src="./agent-robot-avatar.js"></script>
56
- ```
57
-
58
- Add the custom element:
59
-
60
- ```html
61
- <agent-robot-avatar id="avatar"></agent-robot-avatar>
62
- ```
63
-
64
- The avatar enters its default idle behavior automatically. No initialization code is required.
65
-
66
- A minimal runnable example is available at [`examples/basic.html`](./examples/basic.html). An accessibility-oriented integration example is available at [`examples/accessibility.html`](./examples/accessibility.html).
67
-
68
- Bundler-based projects can install and use the component from npm with:
69
-
70
- ```bash
71
- npm install agent-robot-avatar
72
- ```
73
-
74
- ```js
75
- import 'agent-robot-avatar';
76
- ```
77
-
78
- The package includes TypeScript declarations for actions, events, and public methods. No TypeScript setup is required beyond normal package installation.
79
-
80
- ## Basic API
81
-
82
- Trigger an expression or state with `play()`:
83
-
84
- ```js
85
- const avatar = document.querySelector('#avatar');
86
-
87
- avatar.play('success');
88
- avatar.play('failure');
89
- avatar.play('warning');
90
- avatar.play('inspect');
91
- avatar.play('blocked');
92
- avatar.play('error');
93
- ```
94
-
95
- Return to the default idle state:
96
-
97
- ```js
98
- avatar.reset();
99
- ```
100
-
101
- `reset()` cancels the current program action, pending waits, head animations, drag/rebound state, and delayed drag reactions, then returns to idle. Cancelled animation promises continue to resolve normally rather than rejecting. Removing the element performs the same internal cleanup without emitting cleanup-only `face-state` or `action-state` notifications, and also tears down its per-instance media-query listener and observers without restarting rendering as a cleanup side effect. Reattaching starts from idle, preserves appearance and behavior attributes/settings, and installs connected runtime resources once.
102
-
103
- A valid new action replaces the previous active action. The old semantic action receives `cancel`; it cannot resume later and overwrite the replacement. An unknown action throws before destructive cleanup. A no-op action such as `wake` while already awake leaves the current action unchanged.
104
-
105
- ## Actions and states
106
-
107
- | State | API name | Intended use |
108
- | --- | --- | --- |
109
- | Idle | `idle` | Default idle state |
110
- | Bored | `bored` | Long idle periods or no active task |
111
- | Waiting | `waiting` | A request has been sent and a result is still pending |
112
- | Input | `input` | The user is typing |
113
- | Send | `send` | Content was sent / nod feedback |
114
- | Success | `success` | A task completed successfully |
115
- | Failure | `failure` | A task completed unsuccessfully |
116
- | Warning | `warning` | A risky or destructive action needs confirmation |
117
- | Inspect | `inspect` | Reviewing, checking, or verifying a result |
118
- | Blocked | `blocked` | A request is blocked, disallowed, or cannot proceed |
119
- | System error | `error` | Connection, service, or system failure |
120
- | Surprise | `surprise` | An unexpected event or result |
121
- | Sleep | `sleep` | Enter the component sleep state |
122
- | Wake | `wake` | Wake the component from sleep |
123
-
124
- The state names intentionally distinguish task results from system conditions. For example, `failure` means the requested task finished unsuccessfully, while `error` is reserved for connection, service, or system failures. `waiting` represents an active pending request; `bored` represents inactivity. `sleep` describes the avatar component state only and does not imply that the real Agent is offline.
125
-
126
- Semantic aliases are also available:
127
-
128
- ```js
129
- avatar.play('failed'); // same as failure
130
- avatar.play('fail'); // same as failure
131
- avatar.play('verify'); // same as inspect
132
- avatar.play('review'); // same as inspect
133
- avatar.play('angry'); // same visual expression as blocked
134
- avatar.play('policy-blocked'); // same as blocked
135
- avatar.play('system-error'); // same as error
136
- avatar.play('connection-error'); // same as error
137
- ```
138
-
139
- ## Continuous waiting
140
-
141
- For real Agent workflows, use the dedicated waiting lifecycle when a request is in progress:
142
-
143
- ```js
144
- avatar.startWaiting();
145
-
146
- // Stop when the request ends without replacing it with another action.
147
- avatar.stopWaiting();
148
- ```
149
-
150
- `startWaiting()` remains active until `stopWaiting()`, `reset()`, or another program action replaces it. A replacement reports `cancel`; `stopWaiting()` reports a normal `end` when waiting is active. For backward compatibility, calling `stopWaiting()` during another active program action still returns the avatar to idle; that action now receives exactly one `cancel`. Calling it with no active action does not manufacture a lifecycle event. Drag deformation remains available while waiting, but decorative drag expressions are suppressed and discarded rather than replayed after waiting ends.
151
-
152
- A typical request lifecycle can be written as:
153
-
154
- ```js
155
- avatar.startWaiting();
156
- try {
157
- const result = await runAgentRequest();
158
- await avatar.play(result.ok ? 'success' : 'failure');
159
- } catch (error) {
160
- await avatar.play('error');
161
- }
162
- ```
163
-
164
- The visual `error` action eventually returns to idle. That visual completion does not mean the underlying request, connection, or business error has been resolved; the host application remains the source of truth.
165
-
166
- ## Semantic action event
167
-
168
- `face-state` remains available for backward compatibility and describes visual face states. It may contain visual terms such as `happy` or `sad`, so it should not be treated as a reliable business-result event.
169
-
170
- For semantic integration, listen to `action-state`:
171
-
172
- ```js
173
- avatar.addEventListener('action-state', (event) => {
174
- const { action, phase, source } = event.detail;
175
- console.log(action, phase, source);
176
- });
177
- ```
178
-
179
- `action-state` uses this contract:
180
-
181
- - `action`: normalized action name. Aliases such as `failed`/`fail` become `failure`; `verify`/`review` become `inspect`.
182
- - `phase`: `start`, followed by exactly one `end` or `cancel` for each action that actually starts.
183
- - `source`: `api`, `interaction`, or `automatic`.
184
- - Continuous actions such as `startWaiting()` and active input do not emit `end` just because one animation cycle completes.
185
- - Replacement or `reset()` emits `cancel`; `stopWaiting()` emits `end` for active waiting, or `cancel` for a different active action that it resets to idle.
186
- - No-op calls emit no lifecycle event.
187
- - Decorative drag feedback uses `action: "reaction"` and `source: "interaction"`, so it cannot be confused with an API-level task success/failure.
188
- - The event bubbles and is `composed`, so it can be observed above the custom element/Shadow DOM boundary.
189
- - Disconnect cleanup is silent and does not manufacture host-facing status notifications.
190
-
191
- The event describes avatar actions, not real request outcomes. The host must decide what the underlying Agent state actually means.
192
-
193
- ## Accessibility integration
194
-
195
- For accessible status text, map program actions to localized host text rather than announcing every visual change:
196
-
197
- ```html
198
- <div id="agent-status" role="status" aria-live="polite"></div>
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.1 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
+ ![Version](https://img.shields.io/badge/version-v0.5.2-111111?style=flat-square) [![License](https://img.shields.io/badge/license-MIT-0A7EA4?style=flat-square)](./LICENSE) [![CI](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml/badge.svg?branch=main)](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml) [![Ko-fi](https://img.shields.io/badge/Ko--fi-Support-FF5E5B?style=flat-square&logo=ko-fi&logoColor=white)](https://ko-fi.com/P0E625WIOI)
10
+
11
+ ![Vanilla JavaScript](https://img.shields.io/badge/Vanilla-JavaScript-F7DF1E?style=flat-square&logo=javascript&logoColor=000) ![Web Component](https://img.shields.io/badge/Web-Native%20Component-5A67D8?style=flat-square) ![SVG](https://img.shields.io/badge/Rendering-SVG-FFB13B?style=flat-square&logo=svg&logoColor=000) ![Zero Dependencies](https://img.shields.io/badge/Dependencies-0-2EA44F?style=flat-square)
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
+ ## Install
49
+
50
+ ```bash
51
+ npm install agent-robot-avatar
52
+ ```
53
+
54
+ ```js
55
+ import 'agent-robot-avatar';
56
+ ```
57
+
58
+ Or load the repository source directly:
59
+
60
+ ```html
61
+ <script type="module" src="./agent-robot-avatar.js"></script>
62
+ ```
63
+
64
+ Then add the component:
65
+
66
+ ```html
67
+ <agent-robot-avatar id="avatar"></agent-robot-avatar>
68
+ ```
69
+
70
+ No initialization code is required. The avatar enters its default idle behavior automatically.
71
+
72
+ ## Basic usage
73
+
74
+ ```js
75
+ const avatar = document.querySelector('#avatar');
76
+
77
+ avatar.play('success');
78
+ avatar.play('warning');
79
+ avatar.play('error');
80
+
81
+ avatar.reset();
82
+ ```
83
+
84
+ Available actions:
85
+
86
+ `idle` · `bored` · `waiting` · `waiting-wrap` · `input` · `send` · `success` · `failure` · `warning` · `inspect` · `blocked` · `error` · `surprise` · `love` · `random` · `sleep` · `wake`
87
+
88
+ `failure` is intended for a task that completed unsuccessfully, while `error` is intended for connection, service, or system failures.
89
+
90
+ `love` expresses affection or thanks: the two eyes lean together into a single heart, beat three times, then return.
91
+
92
+ `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.
93
+
94
+ For a real Agent request lifecycle:
95
+
96
+ ```js
97
+ avatar.startWaiting();
98
+
99
+ // Alternative waiting motion: eyes turn out through one side and return through the other.
100
+ avatar.startWaiting({ variant: 'wrap' });
101
+
102
+ try {
103
+ const result = await runAgentRequest();
104
+ await avatar.play(result.ok ? 'success' : 'failure');
105
+ } catch (error) {
106
+ await avatar.play('error');
107
+ }
108
+ ```
109
+
110
+ ## Common options
111
+
112
+ ```html
113
+ <agent-robot-avatar
114
+ size="160"
115
+ color="#08090b"
116
+ auto-sleep="30000"
117
+ wake-on="activity"
118
+ motion="auto">
119
+ </agent-robot-avatar>
120
+ ```
121
+
122
+ | Attribute | Purpose |
123
+ | --- | --- |
124
+ | `size` | Avatar size in pixels |
125
+ | `color` | Main avatar color |
126
+ | `auto-sleep` | Idle time before automatic sleep; `0` disables it |
127
+ | `wake-on` | Automatic wake policy: `activity`, `interaction`, or `manual` |
128
+ | `motion` | Motion policy: `auto`, `reduce`, or `full` |
129
+ | `press-squeeze` | Center press-and-hold squeeze; set to `false` to disable |
130
+ | `antenna-drag` | Antenna drag, spring return, and angry reaction; set to `false` to disable |
131
+
132
+ Common runtime controls:
133
+
134
+ ```js
135
+ avatar.setPointerFollow(false);
136
+ avatar.setHeadRoundness(75);
137
+ avatar.setAntennaFlash(true);
138
+ avatar.setPressSqueeze(true);
139
+ avatar.setAntennaDrag(true);
140
+ ```
141
+
142
+ 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.
143
+
144
+ ## Events and integration
145
+
146
+ The component emits `face-state` for visual state changes and `action-state` for semantic action lifecycle changes.
147
+
148
+ For host integrations and accessibility status text, prefer `action-state`. See [`examples/accessibility.html`](./examples/accessibility.html) for a runnable request-lifecycle example.
149
+
150
+ A minimal integration example is available at [`examples/basic.html`](./examples/basic.html).
151
+
152
+ ## Compatibility
153
+
154
+ Designed for modern browsers with support for ES Modules, Custom Elements, SVG, Pointer Events, Web Animations API, `IntersectionObserver`, `ResizeObserver`, and `matchMedia`.
155
+
156
+ Automated browser tests cover Chromium, Firefox, and WebKit.
157
+
158
+ ## Contributing
159
+
160
+ Issues and pull requests are welcome. See [`CONTRIBUTING.md`](./CONTRIBUTING.md) before submitting changes.
161
+
162
+ ## Project status
163
+
164
+ **Current public version: v0.5.2**
165
+
166
+ The public API is intentionally kept compact while the project evolves toward a future `1.0.0` stability commitment.
167
+
168
+ Agent Robot Avatar is independently developed and is not affiliated with, endorsed by, or representative of any AI platform or brand.
169
+
170
+ ## Character design and visual identity
171
+
172
+ The Agent Robot Avatar character, including its robot appearance and visual identity, is an original design by CX ArtLab.
173
+
174
+ 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.
175
+
176
+ Third-party product names mentioned in this project describe possible use cases only and do not indicate affiliation or endorsement.
177
+
178
+ ## License
179
+
180
+ MIT License. See [`LICENSE`](./LICENSE).
181
+
182
+ ---
183
+
184
+ If this project is useful to you, you can buy me a coffee.
185
+
186
+ <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>