agent-robot-avatar 0.3.2 → 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/CHANGELOG.md +170 -124
- package/LICENSE +21 -21
- package/README.md +186 -446
- package/agent-robot-avatar.js +28 -25
- package/docs/README.de.md +186 -166
- package/docs/README.es.md +186 -225
- package/docs/README.fr.md +186 -225
- package/docs/README.ja.md +186 -225
- package/docs/README.ko.md +186 -225
- package/docs/README.pt.md +186 -225
- package/docs/README.ru.md +186 -0
- package/docs/README.zh-CN.md +190 -396
- package/docs/README.zh-TW.md +186 -227
- package/index.d.ts +128 -111
- package/package.json +77 -77
- package/src/agent-robot-avatar-actions.js +400 -400
- package/src/agent-robot-avatar-antenna-flash.js +127 -127
- 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 +161 -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 +905 -860
- package/src/agent-robot-avatar-version.js +3 -3
- package/src/agent-robot-avatar-waiting.js +130 -121
- package/src/agent-robot-avatar-wrap.js +66 -0
package/docs/README.zh-TW.md
CHANGED
|
@@ -1,227 +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) | [
|
|
8
|
-
|
|
9
|
-
   
|
|
12
|
-
|
|
13
|
-
一個輕量、富有表現力的機器人頭像 Web Component
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Agent Robot Avatar
|
|
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
|
-
avatar.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
avatar.play('
|
|
105
|
-
|
|
106
|
-
avatar.play('
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
## 互動 Demo
|
|
188
|
-
|
|
189
|
-
`demo/index.html` 包含全部公開表情、指標跟隨、果凍拖曳、等待生命週期、頭部圓角調整、顏色 / 行為控制,以及模擬 Agent 對話。Demo 專用 JavaScript 全部集中在 `demo/`,不會進入可重複使用的 npm runtime。
|
|
190
|
-
|
|
191
|
-
## 專案結構
|
|
192
|
-
|
|
193
|
-
```text
|
|
194
|
-
agent-robot-avatar.js 正式元件入口
|
|
195
|
-
src/ 可重複使用的元件 runtime 與表情模組
|
|
196
|
-
demo/ 完整互動 Demo 與 Demo 專用程式
|
|
197
|
-
examples/ 最小整合範例
|
|
198
|
-
assets/support/ 支持專案 / 付款 QR 圖片
|
|
199
|
-
docs/ 多語言文件
|
|
200
|
-
README.md 英文主文件
|
|
201
|
-
CHANGELOG.md 正式版本記錄
|
|
202
|
-
CONTRIBUTING.md 貢獻指南
|
|
203
|
-
package.json 套件與發佈資訊
|
|
204
|
-
LICENSE MIT License
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## 發佈與相容性
|
|
208
|
-
|
|
209
|
-
套件已以 `agent-robot-avatar` 名稱發佈至 npm,並內建動作、事件與公開方法的 TypeScript 型別宣告。元件面向支援 ES Modules、Custom Elements、SVG、Pointer Events 與 Web Animations API 的現代瀏覽器。
|
|
210
|
-
|
|
211
|
-
## 參與貢獻
|
|
212
|
-
|
|
213
|
-
歡迎 Issue 與 Pull Request。提交前請閱讀 [`CONTRIBUTING.md`](../CONTRIBUTING.md)。
|
|
214
|
-
|
|
215
|
-
## 專案狀態
|
|
216
|
-
|
|
217
|
-
v0.3.2 是目前的公開版本。v0.1.0 作為第一個公開版本繼續保留。公開 API 目前刻意保持精簡,讓專案能在未來 `1.0.0` 穩定性承諾前持續謹慎演進。
|
|
218
|
-
|
|
219
|
-
Agent Robot Avatar 是獨立開發的開源專案,不隸屬、代表或獲得任何 AI 平台或品牌的官方背書。
|
|
220
|
-
|
|
221
|
-
## License
|
|
222
|
-
|
|
223
|
-
MIT License。詳見 [`LICENSE`](../LICENSE)。
|
|
224
|
-
|
|
225
|
-
## 請我喝杯咖啡
|
|
226
|
-
|
|
227
|
-
<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
|
+
一個輕量、富有表現力的機器人頭像 Web Component,適用於 AI Agent 與互動式應用。
|
|
14
|
+
|
|
15
|
+
可用於 AI 助理、Agent 介面、桌面夥伴、虛擬寵物、數位吉祥物、聊天機器人頭像,以及其他互動角色體驗。
|
|
16
|
+
|
|
17
|
+
適用於 AI 助理與 Agent 介面,包括類似 ChatGPT、Claude、Codex、Cursor、Grok Bot、Gemini CLI 與 OpenCode 的產品與體驗。
|
|
18
|
+
|
|
19
|
+
使用 SVG 與原生 JavaScript 建構,以原生 Custom Element 運作,執行階段零依賴。
|
|
20
|
+
|
|
21
|
+
Agent Robot Avatar 也可作為 AG-UI 風格 Agent 介面的視覺回饋層。
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<img src="../assets/demo/agent-robot-avatar-demo.gif" alt="Agent Robot Avatar 互動動畫示範" width="560">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
## 線上 Demo
|
|
28
|
+
|
|
29
|
+
[開啟互動 Demo](https://cx-artlab.github.io/agent-robot-avatar/?lang=zh-TW)
|
|
30
|
+
|
|
31
|
+
## 特點
|
|
32
|
+
|
|
33
|
+
- 原生 Web Component
|
|
34
|
+
- SVG 渲染 + 原生 JavaScript
|
|
35
|
+
- 執行階段零依賴
|
|
36
|
+
- 自動眨眼與輕微待機動作
|
|
37
|
+
- 眼睛跟隨指標與頭部慣性移動
|
|
38
|
+
- 果凍式局部拖曳形變與彈性復原
|
|
39
|
+
- 按住擠壓與可拖曳的彈簧天線互動
|
|
40
|
+
- 可透過程式控制 Agent 狀態與表情
|
|
41
|
+
- 支援 waiting、success、failure、warning、review、blocked、system error 等回饋
|
|
42
|
+
- 支援減少動態效果
|
|
43
|
+
- 可設定自動睡眠行為
|
|
44
|
+
- 可調整頭部圓角
|
|
45
|
+
- 可選天線狀態閃爍
|
|
46
|
+
- 內含 TypeScript 型別宣告
|
|
47
|
+
|
|
48
|
+
## 安裝
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install agent-robot-avatar
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import 'agent-robot-avatar';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
也可以直接載入儲存庫原始碼:
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<script type="module" src="./agent-robot-avatar.js"></script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
接著加入元件:
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<agent-robot-avatar id="avatar"></agent-robot-avatar>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
不需要初始化程式碼,頭像會自動進入預設待機狀態。
|
|
71
|
+
|
|
72
|
+
## 基本用法
|
|
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
|
+
可用動作:
|
|
85
|
+
|
|
86
|
+
`idle` · `bored` · `waiting` · `waiting-wrap` · `input` · `send` · `success` · `failure` · `warning` · `inspect` · `blocked` · `error` · `surprise` · `love` · `random` · `sleep` · `wake`
|
|
87
|
+
|
|
88
|
+
`failure` 用於表示任務執行完成但結果失敗;`error` 用於連線、服務或系統錯誤。
|
|
89
|
+
|
|
90
|
+
`love` 用於表達喜歡或感謝:兩隻眼睛向中間靠攏合成一顆愛心,跳動三下後恢復。
|
|
91
|
+
|
|
92
|
+
`random` 播放老虎機式的轉動:兩隻眼睛各自在滾筒上滾動,隨後左眼減速、彈跳著停下,右眼稍後停下。`slot` 是它的別名。
|
|
93
|
+
|
|
94
|
+
典型的 Agent 請求流程:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
avatar.startWaiting();
|
|
98
|
+
|
|
99
|
+
// 第二種等待:眼睛從一側轉出,再從另一側轉入。
|
|
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
|
+
## 常用選項
|
|
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
|
+
| 屬性 | 用途 |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `size` | 頭像像素尺寸 |
|
|
125
|
+
| `color` | 頭像主色 |
|
|
126
|
+
| `auto-sleep` | 自動睡眠前的閒置時間;`0` 為關閉 |
|
|
127
|
+
| `wake-on` | 自動喚醒策略:`activity`、`interaction` 或 `manual` |
|
|
128
|
+
| `motion` | 動態效果策略:`auto`、`reduce` 或 `full` |
|
|
129
|
+
| `press-squeeze` | 按住頭像中心進行擠壓;設為 `false` 可關閉 |
|
|
130
|
+
| `antenna-drag` | 拖曳天線、彈簧復原並接憤怒表情;設為 `false` 可關閉 |
|
|
131
|
+
|
|
132
|
+
常用執行階段控制:
|
|
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
|
+
按住頭像中心會開始擠壓;移動超過 4 個 CSS 像素後,同一次指標操作會切換為原有的頭部拖曳。拖曳天線沿用頭部拖曳的距離限制,復原後接原有的憤怒反應。
|
|
143
|
+
|
|
144
|
+
## 事件與整合
|
|
145
|
+
|
|
146
|
+
元件透過 `face-state` 回報視覺狀態變化,透過 `action-state` 回報語意動作生命週期變化。
|
|
147
|
+
|
|
148
|
+
宿主應用整合與無障礙狀態播報建議優先使用 `action-state`。可查看 [`examples/accessibility.html`](../examples/accessibility.html) 中的請求生命週期範例。
|
|
149
|
+
|
|
150
|
+
最小整合範例位於 [`examples/basic.html`](../examples/basic.html)。
|
|
151
|
+
|
|
152
|
+
## 相容性
|
|
153
|
+
|
|
154
|
+
面向支援 ES Modules、Custom Elements、SVG、Pointer Events、Web Animations API、`IntersectionObserver`、`ResizeObserver` 和 `matchMedia` 的現代瀏覽器。
|
|
155
|
+
|
|
156
|
+
自動瀏覽器測試涵蓋 Chromium、Firefox 和 WebKit。
|
|
157
|
+
|
|
158
|
+
## 參與貢獻
|
|
159
|
+
|
|
160
|
+
歡迎提交 Issue 和 Pull Request。提交修改前請閱讀 [`CONTRIBUTING.md`](../CONTRIBUTING.md)。
|
|
161
|
+
|
|
162
|
+
## 專案狀態
|
|
163
|
+
|
|
164
|
+
**目前公開版本:v0.5.2**
|
|
165
|
+
|
|
166
|
+
公開 API 會在未來 `1.0.0` 穩定性承諾前繼續保持精簡並謹慎演進。
|
|
167
|
+
|
|
168
|
+
Agent Robot Avatar 為獨立開發的開源專案,不隸屬、代表或獲得任何 AI 平台或品牌的官方背書。
|
|
169
|
+
|
|
170
|
+
## 角色設計與視覺識別
|
|
171
|
+
|
|
172
|
+
Agent Robot Avatar 角色,包括機器人外觀與視覺識別,均為 CX ArtLab 的原創設計。
|
|
173
|
+
|
|
174
|
+
MIT License 適用於軟體和原始碼,允許在應用中使用、修改和散布該頭像,但不會轉移 Agent Robot Avatar 名稱、角色身分或視覺識別的所有權,也不授予將其作為其他方原創角色或獨立品牌展示的權利。
|
|
175
|
+
|
|
176
|
+
本專案提及的第三方產品名稱僅用於說明可能的使用情境,不代表任何關聯或官方認可。
|
|
177
|
+
|
|
178
|
+
## 授權條款
|
|
179
|
+
|
|
180
|
+
MIT License。詳見 [`LICENSE`](../LICENSE)。
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 請我喝杯咖啡
|
|
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>
|