alpha-avatar-plugins-status 0.6.0__py3-none-any.whl
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.
- alpha_avatar_plugins_status-0.6.0.dist-info/METADATA +641 -0
- alpha_avatar_plugins_status-0.6.0.dist-info/RECORD +33 -0
- alpha_avatar_plugins_status-0.6.0.dist-info/WHEEL +4 -0
- alphaavatar/plugins/status/__init__.py +80 -0
- alphaavatar/plugins/status/log.py +16 -0
- alphaavatar/plugins/status/policy.py +219 -0
- alphaavatar/plugins/status/renderer.py +222 -0
- alphaavatar/plugins/status/sink.py +376 -0
- alphaavatar/plugins/status/templates/en/finalizing.avatar_engine.after_tool.txt +3 -0
- alphaavatar/plugins/status/templates/en/finalizing.default.default.txt +3 -0
- alphaavatar/plugins/status/templates/en/ready.avatar_engine.session_ready.txt +15 -0
- alphaavatar/plugins/status/templates/en/thinking.avatar_engine.thinking.txt +15 -0
- alphaavatar/plugins/status/templates/en/tool_error.deepresearch.default.txt +3 -0
- alphaavatar/plugins/status/templates/en/tool_error.default.default.txt +3 -0
- alphaavatar/plugins/status/templates/en/tool_progress.default.default.txt +3 -0
- alphaavatar/plugins/status/templates/en/tool_start.deepresearch.download.txt +3 -0
- alphaavatar/plugins/status/templates/en/tool_start.deepresearch.research.txt +3 -0
- alphaavatar/plugins/status/templates/en/tool_start.deepresearch.scrape.txt +3 -0
- alphaavatar/plugins/status/templates/en/tool_start.deepresearch.search.txt +3 -0
- alphaavatar/plugins/status/templates/en/tool_start.default.default.txt +3 -0
- alphaavatar/plugins/status/templates/zh/finalizing.avatar_engine.after_tool.txt +3 -0
- alphaavatar/plugins/status/templates/zh/finalizing.default.default.txt +3 -0
- alphaavatar/plugins/status/templates/zh/ready.avatar_engine.session_ready.txt +15 -0
- alphaavatar/plugins/status/templates/zh/thinking.avatar_engine.thinking.txt +15 -0
- alphaavatar/plugins/status/templates/zh/tool_error.deepresearch.default.txt +3 -0
- alphaavatar/plugins/status/templates/zh/tool_error.default.default.txt +3 -0
- alphaavatar/plugins/status/templates/zh/tool_progress.default.default.txt +3 -0
- alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.download.txt +3 -0
- alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.research.txt +3 -0
- alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.scrape.txt +3 -0
- alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.search.txt +3 -0
- alphaavatar/plugins/status/templates/zh/tool_start.default.default.txt +3 -0
- alphaavatar/plugins/status/version.py +14 -0
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: alpha-avatar-plugins-status
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: AlphaAvatar Framework plugin for intermediate status events
|
|
5
|
+
Project-URL: Source, https://github.com/AlphaAvatar/AlphaAvatar
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: AI,agents,avatar,llm,progress,realtime,status
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
17
|
+
Classifier: Topic :: Multimedia :: Video
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# AlphaAvatar Status Plugin
|
|
23
|
+
|
|
24
|
+
🟢 **AlphaAvatar Status Plugin** provides the default runtime implementation for AlphaAvatar's intermediate status system.
|
|
25
|
+
|
|
26
|
+
It is used to send short, user-facing or UI-facing status updates while the agent is thinking, calling tools, processing tool results, or recovering from tool errors.
|
|
27
|
+
|
|
28
|
+
The core status protocol lives in:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
alphaavatar.agents.status
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This plugin provides replaceable implementations for:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
StatusPolicy -> decides whether / when a status event should be emitted
|
|
38
|
+
StatusRenderer -> converts a StatusEvent into short user-facing text
|
|
39
|
+
StatusSink -> delivers the event to logs, UI, text channels, or voice
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Why this plugin exists
|
|
45
|
+
|
|
46
|
+
Long-running agent interactions often contain noticeable waiting periods:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
User input
|
|
50
|
+
-> LLM prefix caching / first-token wait
|
|
51
|
+
-> tool-call generation
|
|
52
|
+
-> tool execution
|
|
53
|
+
-> tool-output prefix caching
|
|
54
|
+
-> final answer generation
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Without intermediate feedback, users may feel the assistant is stuck.
|
|
58
|
+
|
|
59
|
+
This plugin reduces perceived latency by emitting short status updates such as:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
我想一下。
|
|
63
|
+
我查一下。
|
|
64
|
+
我整理一下。
|
|
65
|
+
I’ll check that.
|
|
66
|
+
I’m putting it together.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
These statuses can be delivered through:
|
|
70
|
+
|
|
71
|
+
* Logs
|
|
72
|
+
* LiveKit data channel events
|
|
73
|
+
* UI action events
|
|
74
|
+
* Text status messages
|
|
75
|
+
* Voice status speech
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Architecture
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
StatusEvent
|
|
83
|
+
↓
|
|
84
|
+
StatusEmitter
|
|
85
|
+
↓
|
|
86
|
+
StatusPolicy
|
|
87
|
+
↓
|
|
88
|
+
StatusRenderer
|
|
89
|
+
↓
|
|
90
|
+
StatusSink(s)
|
|
91
|
+
├── LoggerStatusSink
|
|
92
|
+
├── StatusActionEventSink
|
|
93
|
+
└── TextOrVoiceStatusSink
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Main flow
|
|
99
|
+
|
|
100
|
+
### 1. A component emits a `StatusEvent`
|
|
101
|
+
|
|
102
|
+
Examples:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
StatusEvent(
|
|
106
|
+
type=StatusType.THINKING,
|
|
107
|
+
source=AvatarModule.AVATAR_ENGINE,
|
|
108
|
+
stage="thinking",
|
|
109
|
+
)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
StatusEvent(
|
|
114
|
+
type=StatusType.TOOL_START,
|
|
115
|
+
source=AvatarModule.DEEPRESEARCH,
|
|
116
|
+
stage=DeepResearchOp.SEARCH,
|
|
117
|
+
message="我查一下。",
|
|
118
|
+
)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### 2. `StatusPolicy` decides whether to emit it
|
|
124
|
+
|
|
125
|
+
The policy controls:
|
|
126
|
+
|
|
127
|
+
* Delay before emission
|
|
128
|
+
* Per-turn max event count
|
|
129
|
+
* Duplicate event suppression
|
|
130
|
+
* Per-source throttling
|
|
131
|
+
* Immediate events, such as tool start events
|
|
132
|
+
|
|
133
|
+
This prevents the assistant from speaking or displaying too many status messages.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### 3. `StatusRenderer` generates short text
|
|
138
|
+
|
|
139
|
+
If the event already has `message`, the renderer uses it directly.
|
|
140
|
+
|
|
141
|
+
Otherwise, it loads a template from:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
alphaavatar/plugins/status/templates/
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Template files are selected by:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
{status_type}.{source}.{stage}.txt
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
For example:
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
templates/zh/tool_start.deepresearch.search.txt
|
|
157
|
+
templates/en/thinking.avatar_engine.thinking.txt
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Each file can contain multiple templates, one per line. The renderer randomly selects one.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### 4. `StatusSink` delivers the event
|
|
165
|
+
|
|
166
|
+
The plugin currently provides three sinks:
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
LoggerStatusSink
|
|
170
|
+
Writes structured status logs.
|
|
171
|
+
|
|
172
|
+
StatusActionEventSink
|
|
173
|
+
Sends structured UI/action events through LiveKit data channel.
|
|
174
|
+
|
|
175
|
+
TextOrVoiceStatusSink
|
|
176
|
+
Sends short text or voice status depending on room type and interaction mode.
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## File structure
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
alphaavatar/plugins/status/
|
|
185
|
+
├── __init__.py
|
|
186
|
+
├── policy.py
|
|
187
|
+
├── renderer.py
|
|
188
|
+
├── sink.py
|
|
189
|
+
├── log.py
|
|
190
|
+
├── version.py
|
|
191
|
+
└── templates/
|
|
192
|
+
├── en/
|
|
193
|
+
└── zh/
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## File responsibilities
|
|
199
|
+
|
|
200
|
+
### `__init__.py`
|
|
201
|
+
|
|
202
|
+
Registers the default status plugin.
|
|
203
|
+
|
|
204
|
+
It builds:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
DefaultStatusPolicy
|
|
208
|
+
DefaultStatusRenderer
|
|
209
|
+
CompositeStatusSink
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
and returns a configured `StatusEmitter`.
|
|
213
|
+
|
|
214
|
+
This is the main plugin entry point.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### `policy.py`
|
|
219
|
+
|
|
220
|
+
Contains `DefaultStatusPolicy`.
|
|
221
|
+
|
|
222
|
+
Responsibilities:
|
|
223
|
+
|
|
224
|
+
* Decide whether a status event should be emitted
|
|
225
|
+
* Apply delay rules
|
|
226
|
+
* Avoid duplicate statuses
|
|
227
|
+
* Avoid excessive status messages in one turn
|
|
228
|
+
* Let important tool events pass through without being blocked by generic thinking events
|
|
229
|
+
|
|
230
|
+
Typical logic:
|
|
231
|
+
|
|
232
|
+
```text
|
|
233
|
+
avatar_engine.thinking
|
|
234
|
+
delayed and low-frequency
|
|
235
|
+
|
|
236
|
+
deepresearch.tool_start
|
|
237
|
+
immediate and more important
|
|
238
|
+
|
|
239
|
+
tool_error
|
|
240
|
+
high priority
|
|
241
|
+
|
|
242
|
+
memory/persona internal events
|
|
243
|
+
usually suppressed
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Modify this file when you want to tune status frequency or priority.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### `renderer.py`
|
|
251
|
+
|
|
252
|
+
Contains `DefaultStatusRenderer`.
|
|
253
|
+
|
|
254
|
+
Responsibilities:
|
|
255
|
+
|
|
256
|
+
* Use `event.message` if provided
|
|
257
|
+
* Detect language from event metadata, such as query text
|
|
258
|
+
* Load templates from `templates/`
|
|
259
|
+
* Randomly select one matching template
|
|
260
|
+
* Fall back from specific templates to generic templates
|
|
261
|
+
|
|
262
|
+
Matching order:
|
|
263
|
+
|
|
264
|
+
```text
|
|
265
|
+
{type}.{source}.{stage}.txt
|
|
266
|
+
{type}.{source}.default.txt
|
|
267
|
+
{type}.default.default.txt
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Example:
|
|
271
|
+
|
|
272
|
+
```text
|
|
273
|
+
tool_start.deepresearch.search.txt
|
|
274
|
+
tool_start.deepresearch.default.txt
|
|
275
|
+
tool_start.default.default.txt
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Modify this file when you want to change template loading behavior.
|
|
279
|
+
|
|
280
|
+
Modify files under `templates/` when you only want to change copywriting.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### `sink.py`
|
|
285
|
+
|
|
286
|
+
Contains delivery implementations.
|
|
287
|
+
|
|
288
|
+
#### `CompositeStatusSink`
|
|
289
|
+
|
|
290
|
+
Runs multiple sinks together.
|
|
291
|
+
|
|
292
|
+
#### `LoggerStatusSink`
|
|
293
|
+
|
|
294
|
+
Writes status events to logs.
|
|
295
|
+
|
|
296
|
+
Useful for debugging whether an event was emitted.
|
|
297
|
+
|
|
298
|
+
#### `StatusActionEventSink`
|
|
299
|
+
|
|
300
|
+
Publishes structured status action events through LiveKit data channel.
|
|
301
|
+
|
|
302
|
+
Useful for UI state machines, avatar animations, loading indicators, and activity timelines.
|
|
303
|
+
|
|
304
|
+
Example payload type:
|
|
305
|
+
|
|
306
|
+
```text
|
|
307
|
+
agent_status_action
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
#### `TextOrVoiceStatusSink`
|
|
311
|
+
|
|
312
|
+
Delivers user-facing short status text.
|
|
313
|
+
|
|
314
|
+
It decides delivery mode based on room type and interaction mode.
|
|
315
|
+
|
|
316
|
+
Example behavior:
|
|
317
|
+
|
|
318
|
+
```text
|
|
319
|
+
WhatsApp / Telegram / Slack / Discord
|
|
320
|
+
-> text status
|
|
321
|
+
|
|
322
|
+
Web app
|
|
323
|
+
-> text + voice, or text only depending on delivery mode config
|
|
324
|
+
|
|
325
|
+
Voice-only room
|
|
326
|
+
-> voice status
|
|
327
|
+
|
|
328
|
+
API room
|
|
329
|
+
-> no voice by default
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
It also applies voice-specific throttling so generic thinking does not block more useful tool progress.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### `templates/`
|
|
337
|
+
|
|
338
|
+
Stores user-facing status copy.
|
|
339
|
+
|
|
340
|
+
Templates are grouped by language:
|
|
341
|
+
|
|
342
|
+
```text
|
|
343
|
+
templates/en/
|
|
344
|
+
templates/zh/
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Each file can contain multiple candidate lines.
|
|
348
|
+
|
|
349
|
+
Example:
|
|
350
|
+
|
|
351
|
+
```text
|
|
352
|
+
templates/zh/tool_start.deepresearch.search.txt
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
```text
|
|
356
|
+
我查一下。
|
|
357
|
+
我帮你搜一下。
|
|
358
|
+
我先查查相关信息。
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Example:
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
templates/en/thinking.avatar_engine.thinking.txt
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
```text
|
|
368
|
+
Let me think.
|
|
369
|
+
Hmm, let me think.
|
|
370
|
+
Give me a second.
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Rules:
|
|
374
|
+
|
|
375
|
+
* One template per line
|
|
376
|
+
* Empty lines are ignored
|
|
377
|
+
* Lines starting with `#` are ignored
|
|
378
|
+
* Keep voice-friendly templates short
|
|
379
|
+
* Avoid hidden reasoning
|
|
380
|
+
* Avoid saying results have been found before the tool finishes
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Status types
|
|
385
|
+
|
|
386
|
+
Current status types are defined in the core status protocol:
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
class StatusType(StrEnum):
|
|
390
|
+
READY = "ready"
|
|
391
|
+
|
|
392
|
+
THINKING = "thinking"
|
|
393
|
+
|
|
394
|
+
TOOL_START = "tool_start"
|
|
395
|
+
TOOL_PROGRESS = "tool_progress"
|
|
396
|
+
TOOL_END = "tool_end"
|
|
397
|
+
TOOL_ERROR = "tool_error"
|
|
398
|
+
|
|
399
|
+
FINALIZING = "finalizing"
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Suggested usage:
|
|
403
|
+
|
|
404
|
+
```text
|
|
405
|
+
READY
|
|
406
|
+
Agent/session is ready.
|
|
407
|
+
|
|
408
|
+
THINKING
|
|
409
|
+
User input has been received, but the model has not produced a visible action yet.
|
|
410
|
+
|
|
411
|
+
TOOL_START
|
|
412
|
+
A tool starts running.
|
|
413
|
+
|
|
414
|
+
TOOL_PROGRESS
|
|
415
|
+
A long-running tool reports intermediate progress.
|
|
416
|
+
|
|
417
|
+
TOOL_END
|
|
418
|
+
A tool finishes successfully.
|
|
419
|
+
Usually useful for UI only, not voice.
|
|
420
|
+
|
|
421
|
+
TOOL_ERROR
|
|
422
|
+
A tool fails or receives invalid arguments.
|
|
423
|
+
|
|
424
|
+
FINALIZING
|
|
425
|
+
Tool output has returned and the model is organizing the result or deciding the next step.
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## Common event sources
|
|
431
|
+
|
|
432
|
+
Typical sources are:
|
|
433
|
+
|
|
434
|
+
```text
|
|
435
|
+
AvatarModule.AVATAR_ENGINE
|
|
436
|
+
AvatarModule.DEEPRESEARCH
|
|
437
|
+
AvatarModule.RAG
|
|
438
|
+
AvatarModule.MCP
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
The recommended pattern is:
|
|
442
|
+
|
|
443
|
+
```text
|
|
444
|
+
type = generic status category
|
|
445
|
+
source = module/plugin that emitted the event
|
|
446
|
+
stage = operation or lifecycle stage
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
Example:
|
|
450
|
+
|
|
451
|
+
```text
|
|
452
|
+
tool_start.deepresearch.search
|
|
453
|
+
tool_start.rag.query
|
|
454
|
+
tool_start.mcp.tool_call
|
|
455
|
+
finalizing.avatar_engine.after_tool
|
|
456
|
+
thinking.avatar_engine.thinking
|
|
457
|
+
ready.avatar_engine.session_ready
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## Adding a new template
|
|
463
|
+
|
|
464
|
+
To add a new Chinese template for DeepResearch search:
|
|
465
|
+
|
|
466
|
+
```text
|
|
467
|
+
templates/zh/tool_start.deepresearch.search.txt
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Example content:
|
|
471
|
+
|
|
472
|
+
```text
|
|
473
|
+
我查一下。
|
|
474
|
+
我帮你搜一下。
|
|
475
|
+
我先查查相关信息。
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
To add an English version:
|
|
479
|
+
|
|
480
|
+
```text
|
|
481
|
+
templates/en/tool_start.deepresearch.search.txt
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
Example content:
|
|
485
|
+
|
|
486
|
+
```text
|
|
487
|
+
I’ll check that.
|
|
488
|
+
I’ll look it up.
|
|
489
|
+
Let me search for that.
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
No Python code change is needed.
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
## Adding status support to a new tool
|
|
497
|
+
|
|
498
|
+
A tool should emit a `TOOL_START` event before a long-running operation.
|
|
499
|
+
|
|
500
|
+
Example:
|
|
501
|
+
|
|
502
|
+
```python
|
|
503
|
+
self.emit_status_nowait(
|
|
504
|
+
StatusEvent(
|
|
505
|
+
type=StatusType.TOOL_START,
|
|
506
|
+
source=AvatarModule.RAG,
|
|
507
|
+
stage=RAGOp.QUERY,
|
|
508
|
+
message=monologue,
|
|
509
|
+
metadata={
|
|
510
|
+
"op": RAGOp.QUERY.value,
|
|
511
|
+
"query": query,
|
|
512
|
+
},
|
|
513
|
+
)
|
|
514
|
+
)
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
For user-facing text, prefer passing `monologue` from the model:
|
|
518
|
+
|
|
519
|
+
```python
|
|
520
|
+
monologue: str | None = None
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
If `monologue` is not provided, the renderer falls back to a template file.
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
## Tool error handling
|
|
528
|
+
|
|
529
|
+
Tool runtime failures should emit:
|
|
530
|
+
|
|
531
|
+
```text
|
|
532
|
+
StatusType.TOOL_ERROR
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
The shared `ToolBase` can catch tool exceptions and emit a fallback error event.
|
|
536
|
+
|
|
537
|
+
The renderer will select a template such as:
|
|
538
|
+
|
|
539
|
+
```text
|
|
540
|
+
templates/zh/tool_error.default.default.txt
|
|
541
|
+
templates/en/tool_error.default.default.txt
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
or a more specific one:
|
|
545
|
+
|
|
546
|
+
```text
|
|
547
|
+
templates/zh/tool_error.deepresearch.default.txt
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
## Recommended extension points
|
|
553
|
+
|
|
554
|
+
### Change when status events are emitted
|
|
555
|
+
|
|
556
|
+
Edit:
|
|
557
|
+
|
|
558
|
+
```text
|
|
559
|
+
policy.py
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Change what status text says
|
|
563
|
+
|
|
564
|
+
Edit files under:
|
|
565
|
+
|
|
566
|
+
```text
|
|
567
|
+
templates/
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### Change how status events are delivered
|
|
571
|
+
|
|
572
|
+
Edit:
|
|
573
|
+
|
|
574
|
+
```text
|
|
575
|
+
sink.py
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### Add a new status plugin implementation
|
|
579
|
+
|
|
580
|
+
Create a new plugin package and register another implementation of:
|
|
581
|
+
|
|
582
|
+
```text
|
|
583
|
+
StatusPolicyBase
|
|
584
|
+
StatusRendererBase
|
|
585
|
+
StatusSinkBase
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
## Design principles
|
|
591
|
+
|
|
592
|
+
1. Keep `StatusType` small and generic.
|
|
593
|
+
2. Use `source` and `stage` for details.
|
|
594
|
+
3. Keep voice status short.
|
|
595
|
+
4. Do not expose hidden reasoning.
|
|
596
|
+
5. Let tools emit concrete progress.
|
|
597
|
+
6. Let the engine emit generic thinking/finalizing fallback.
|
|
598
|
+
7. Prefer UI action events for frequent or low-level progress.
|
|
599
|
+
8. Prefer voice only for meaningful user-facing moments.
|
|
600
|
+
9. Keep templates outside Python code.
|
|
601
|
+
10. Make status behavior easy to observe and tune.
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
605
|
+
## Example timeline
|
|
606
|
+
|
|
607
|
+
```text
|
|
608
|
+
User asks a question
|
|
609
|
+
↓
|
|
610
|
+
AvatarEngine emits THINKING after delay
|
|
611
|
+
"我想一下。"
|
|
612
|
+
|
|
613
|
+
Model decides to call DeepResearch
|
|
614
|
+
↓
|
|
615
|
+
DeepResearch emits TOOL_START
|
|
616
|
+
"我查一下。"
|
|
617
|
+
|
|
618
|
+
Tool returns result
|
|
619
|
+
↓
|
|
620
|
+
AvatarEngine emits FINALIZING after delay
|
|
621
|
+
"我整理一下。"
|
|
622
|
+
|
|
623
|
+
Model starts final answer
|
|
624
|
+
↓
|
|
625
|
+
Delayed FINALIZING is cancelled
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
---
|
|
629
|
+
|
|
630
|
+
## Packaging note
|
|
631
|
+
|
|
632
|
+
Template files must be included in the plugin package.
|
|
633
|
+
|
|
634
|
+
For setuptools, make sure `pyproject.toml` includes:
|
|
635
|
+
|
|
636
|
+
```toml
|
|
637
|
+
[tool.setuptools.package-data]
|
|
638
|
+
"alphaavatar.plugins.status" = ["templates/**/*.txt"]
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
Otherwise templates may work in local development but disappear after installation.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
alphaavatar/plugins/status/__init__.py,sha256=tscApQvc3u41CNtibUj8gjh8yh5rE9kGLi5OVmDNFIQ,2471
|
|
2
|
+
alphaavatar/plugins/status/log.py,sha256=8r2vMMio__f3yBnbDdww6DKcM6ZEMMf3pR0guK-3Tgk,656
|
|
3
|
+
alphaavatar/plugins/status/policy.py,sha256=7zknAfnPIiDF75Qh-1sYM682M8D5NWwp-4X6hYzkiW4,7022
|
|
4
|
+
alphaavatar/plugins/status/renderer.py,sha256=3bhPnj4UkKXsKU6lYjNN7e5sNyLfd-a22xwKBz7bdps,6452
|
|
5
|
+
alphaavatar/plugins/status/sink.py,sha256=bcNXpNO49rvACpgHAXGFGD6FFi25LVLG2iJRqw2zuOU,11992
|
|
6
|
+
alphaavatar/plugins/status/version.py,sha256=rIMzs0iq8ISq1B49DV_3nTha39KrlObNwvu88tNVb8w,604
|
|
7
|
+
alphaavatar/plugins/status/templates/en/finalizing.avatar_engine.after_tool.txt,sha256=O5TQI4ZI3FUx6-0GdaeQkAdadVGG2lyhyS4JpOzGhLM,83
|
|
8
|
+
alphaavatar/plugins/status/templates/en/finalizing.default.default.txt,sha256=FK3rVVTH9CDeXSLCBhsTIBvka5aIVG6zRB7c_cC3Jj4,70
|
|
9
|
+
alphaavatar/plugins/status/templates/en/ready.avatar_engine.session_ready.txt,sha256=3GvKMaCWzXJsA9Gtu9YvyQvtzGs6NLjuPwXtHm3RNE0,742
|
|
10
|
+
alphaavatar/plugins/status/templates/en/thinking.avatar_engine.thinking.txt,sha256=KOH0DMtoDrGOzoHeBkXGeFFxToasxJZPRC3MIH2lUS0,271
|
|
11
|
+
alphaavatar/plugins/status/templates/en/tool_error.deepresearch.default.txt,sha256=4CiHltUW8z2ooAkAWZMYj_eVF8r356-mKaOjB1IQmYY,115
|
|
12
|
+
alphaavatar/plugins/status/templates/en/tool_error.default.default.txt,sha256=NH4EY4MAeJthDeAW-0nMoxQisH9sSEdSoyhH3UcZyHs,106
|
|
13
|
+
alphaavatar/plugins/status/templates/en/tool_progress.default.default.txt,sha256=EVyklRaSw1eesmOf08EGcdZQbFDeEU6opMa6zy9q0YE,69
|
|
14
|
+
alphaavatar/plugins/status/templates/en/tool_start.deepresearch.download.txt,sha256=YHGunW0o4s7rnnbhY6bd6kXGmfBDs3bN6hq9wuXn3-I,85
|
|
15
|
+
alphaavatar/plugins/status/templates/en/tool_start.deepresearch.research.txt,sha256=LacdTHwdnbfTZwis5ggZnZOur6g9uqHNtaSS3E_vy5w,66
|
|
16
|
+
alphaavatar/plugins/status/templates/en/tool_start.deepresearch.scrape.txt,sha256=UX9vmyNSuy4oKtL-2YIgSNRo8uZS9zaPvObluco3hcg,91
|
|
17
|
+
alphaavatar/plugins/status/templates/en/tool_start.deepresearch.search.txt,sha256=b7wmwnbXjt9abtznJRv6tLgNF2Hnx8p6B6IhsvfTy2M,62
|
|
18
|
+
alphaavatar/plugins/status/templates/en/tool_start.default.default.txt,sha256=txTwxofCZWXUonPmtdHana9z2303B_H9BjVBpgz3hvw,67
|
|
19
|
+
alphaavatar/plugins/status/templates/zh/finalizing.avatar_engine.after_tool.txt,sha256=0aRg7Ga7juM7QCCvYal7wNq51HxLCdQ_PNzv43Pp-1s,66
|
|
20
|
+
alphaavatar/plugins/status/templates/zh/finalizing.default.default.txt,sha256=9h1HBZ2Li2xauvreChdKgn7h6CdtgTU6eoU_A2Puyes,57
|
|
21
|
+
alphaavatar/plugins/status/templates/zh/ready.avatar_engine.session_ready.txt,sha256=atZgN0UxDvpjI51iAb04x0gOqSfNLeMWJFTLSu3O7YY,753
|
|
22
|
+
alphaavatar/plugins/status/templates/zh/thinking.avatar_engine.thinking.txt,sha256=YW2y0dCAByAZjY0rpsAZsjGFTwyBgEDmIRZXcXr9QvM,282
|
|
23
|
+
alphaavatar/plugins/status/templates/zh/tool_error.deepresearch.default.txt,sha256=M3hSQ1v5EfqbDYgLK_rTVHkVoVjfzEz3_djT1njQpaw,114
|
|
24
|
+
alphaavatar/plugins/status/templates/zh/tool_error.default.default.txt,sha256=_lhz38qLUDLZ56ArXTdvdulMcvEYAo7px4S5fZ0p9Cw,114
|
|
25
|
+
alphaavatar/plugins/status/templates/zh/tool_progress.default.default.txt,sha256=OqDhKQrWKJ4beTxehqpmNHHoe0AnM0oEW3Jpjw7jtN4,57
|
|
26
|
+
alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.download.txt,sha256=kaSBhwDxFH29phAW2yHnkd45UfgQ8PQ8V52ENO6BQn4,87
|
|
27
|
+
alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.research.txt,sha256=tWqNYtIw5CWeyb0oE3ubc_hVeApwynedaXcxLFikcFo,78
|
|
28
|
+
alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.scrape.txt,sha256=48SneFdjU_aedY_8-03pXOSmLB-l_qnQYIvlO8fXiWw,81
|
|
29
|
+
alphaavatar/plugins/status/templates/zh/tool_start.deepresearch.search.txt,sha256=doWbtkNr19RIQd5uS7AhTah8sS5qegOyEvxPn9bFMzs,66
|
|
30
|
+
alphaavatar/plugins/status/templates/zh/tool_start.default.default.txt,sha256=8BBqzhaymg41SzGKJHVxTxjfJK_dkgQcgV1x5Ht4__g,60
|
|
31
|
+
alpha_avatar_plugins_status-0.6.0.dist-info/METADATA,sha256=9dRUm0SaRcknTAUenfR_tH1msaTTccZ5pzoapWpqh6E,11975
|
|
32
|
+
alpha_avatar_plugins_status-0.6.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
33
|
+
alpha_avatar_plugins_status-0.6.0.dist-info/RECORD,,
|