open-agents-ai 0.45.0 → 0.46.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/README.md +131 -7
- package/dist/index.js +986 -222
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -396,23 +396,86 @@ If a user sends another message while their sub-agent is still running, it's inj
|
|
|
396
396
|
|
|
397
397
|
| Level | MaxTurns | Tools | Memory |
|
|
398
398
|
|-------|----------|-------|--------|
|
|
399
|
-
| **Admin** (`--admin
|
|
400
|
-
| **
|
|
399
|
+
| **Admin DM** (`--admin`, private chat) | 30 | All tools except shell (overridable) | Full read + write |
|
|
400
|
+
| **Admin Group** (admin in group chat) | 15 | Read-only + web + vision/OCR/transcription | Full read + write |
|
|
401
|
+
| **Public** (everyone else) | 8 | memory r/w (scoped), web fetch/search | Scoped per-chat |
|
|
401
402
|
|
|
402
|
-
**Admin**
|
|
403
|
+
**Admin DM** — full agent experience in private chat. File read, grep, glob, memory, web research, all tools except shell (which can be unblocked via config).
|
|
403
404
|
|
|
404
|
-
**
|
|
405
|
+
**Admin Group** — when the admin speaks in a group chat, the agent responds with read-only capabilities. No system-mutating tools (no shell, no file write, no code execution). Vision, OCR, transcription, and web tools are available for analyzing shared media and answering questions.
|
|
406
|
+
|
|
407
|
+
**Public** — lightweight assistant with safety guardrails. No file access, no shell, no code. Web search, scoped memory, and general knowledge only. Reply discretion active in groups.
|
|
405
408
|
|
|
406
409
|
### Streaming Responses
|
|
407
410
|
|
|
408
411
|
While the sub-agent is working, users see:
|
|
409
412
|
1. **Typing indicator** — "typing..." appears immediately and refreshes every 4 seconds until the response is ready
|
|
410
|
-
2. **
|
|
411
|
-
3. **
|
|
413
|
+
2. **Admin live streaming** — a placeholder message is sent immediately, then progressively edited via `editMessageText` with accumulated content + intermediate states (tool calls, results, status updates). Admin sees `🔧 tool_name(...)` and `✔ tool_name: result` inline as the agent works
|
|
414
|
+
3. **Markdown → HTML conversion** — all responses are automatically converted from GitHub-flavored Markdown to Telegram-compatible HTML (`<b>`, `<i>`, `<code>`, `<pre>`, `<s>`, `<a>`) with plaintext fallback
|
|
415
|
+
4. **Final message** — committed via `editMessageText` (admin) or `sendMessage` (public) when the agent completes
|
|
416
|
+
|
|
417
|
+
### Public User Isolation
|
|
418
|
+
|
|
419
|
+
Public users get **per-chat isolated memory** — each chat has its own scoped memory namespace (`telegram-{chatId}-{topic}`) so public users can store and retrieve facts about their conversation without accessing or polluting global agent memory. Public tools include: `memory_read`, `memory_write` (scoped), `memory_search`, `web_search`, `web_fetch`.
|
|
420
|
+
|
|
421
|
+
### Context-Aware Tool Policy
|
|
422
|
+
|
|
423
|
+
Tools are gated per execution context. The system enforces strict separation between what's available in a terminal session versus a public Telegram group:
|
|
424
|
+
|
|
425
|
+
| Context | Default Tools | Notes |
|
|
426
|
+
|---------|--------------|-------|
|
|
427
|
+
| `terminal` | All tools | Wide open — shell, file read/write, everything |
|
|
428
|
+
| `telegram-admin-dm` | All except shell | Admin DM — full tools, shell blocked by default (overridable) |
|
|
429
|
+
| `telegram-admin-group` | Read-only + web + vision/OCR | Admin in public group — no system mutation tools |
|
|
430
|
+
| `telegram-public` | Memory r/w, web fetch/search | Public users — minimal safe tools only |
|
|
431
|
+
| `api` | All tools | API endpoint — configurable |
|
|
432
|
+
|
|
433
|
+
**System tools** (`shell`, `file_write`, `file_edit`, `file_read`, `file_patch`, `batch_edit`, `grep_search`, `glob_find`, `list_directory`, `code_sandbox`, `codebase_map`, `git_info`, etc.) are **never exposed** in public-facing contexts.
|
|
434
|
+
|
|
435
|
+
**User overrides** — customize tool availability via config (`~/.open-agents/config.json`):
|
|
436
|
+
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"toolPolicies": {
|
|
440
|
+
"blockedTools": {
|
|
441
|
+
"shell": ["*"],
|
|
442
|
+
"web_crawl": ["telegram-public"]
|
|
443
|
+
},
|
|
444
|
+
"contextAllowlist": {
|
|
445
|
+
"telegram-admin-group": ["transcribe_file", "transcribe_url"]
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Resolution logic**: blocked takes priority over allowed. If the allowed set is empty, all tools are available (minus blocked). If non-empty, only those tools pass through (minus blocked).
|
|
452
|
+
|
|
453
|
+
### Group Chat Distinction
|
|
454
|
+
|
|
455
|
+
The bridge distinguishes between **private DMs** and **group/supergroup chats**, even for admin users:
|
|
456
|
+
|
|
457
|
+
- **Admin DM** → full tool access, live streaming via `editMessageText`, project context injected
|
|
458
|
+
- **Admin in group** → read-only tools + web + vision/OCR, no live streaming, concise responses
|
|
459
|
+
- **Public in group** → minimal safe tools, reply discretion active
|
|
460
|
+
|
|
461
|
+
**Reply discretion** — in group chats, the agent evaluates whether a message warrants a response. Casual greetings, messages directed at other users, and chatter that doesn't involve the bot are silently skipped (the agent returns `no_reply` as its summary). This prevents the bot from flooding group conversations with unnecessary responses.
|
|
462
|
+
|
|
463
|
+
### Media Handling
|
|
464
|
+
|
|
465
|
+
Photos, audio, voice messages, video, video notes, and documents sent via Telegram are automatically downloaded and processed:
|
|
466
|
+
|
|
467
|
+
1. **Download** — files are fetched via the Telegram `getFile` API and cached to `.oa/media-cache/`
|
|
468
|
+
2. **Processing** — routed to the appropriate pipeline:
|
|
469
|
+
- Images → `vision` / `image_read` / `ocr` tools
|
|
470
|
+
- Audio/voice → `transcribe_file` tool
|
|
471
|
+
- Video/video notes → `transcribe_file` (audio track extraction)
|
|
472
|
+
- Documents → `pdf_to_text` / `ocr_pdf` for PDFs, `file_read` for text
|
|
473
|
+
3. **Context injection** — processing results are prepended to the user's message as additional context for the sub-agent
|
|
474
|
+
4. **Cache cleanup** — media files are cached for 30 minutes, then automatically deleted. Only metadata (filename, type, chat ID, timestamp, processing result summary) is persisted long-term per chat
|
|
412
475
|
|
|
413
476
|
### Rate Limit Handling
|
|
414
477
|
|
|
415
|
-
The bridge automatically handles Telegram's rate limits (HTTP 429) with exponential backoff using the `retry_after` field.
|
|
478
|
+
The bridge automatically handles Telegram's rate limits (HTTP 429) with exponential backoff using the `retry_after` field. Live message edits are throttled to max 1 per second per chat.
|
|
416
479
|
|
|
417
480
|
**Safety filter** — every public Telegram-sourced task is wrapped with strict safety instructions:
|
|
418
481
|
- Never share private information, API keys, file paths, or system internals
|
|
@@ -423,6 +486,67 @@ The bridge automatically handles Telegram's rate limits (HTTP 429) with exponent
|
|
|
423
486
|
|
|
424
487
|
**Combined with blessed mode** — `/full-send-bless` + `/telegram` creates a persistent, always-on agent that processes Telegram messages around the clock while keeping the model warm.
|
|
425
488
|
|
|
489
|
+
## Emotion Engine — Affective State Modulation
|
|
490
|
+
|
|
491
|
+
The agent stack includes a real-time emotion system that modulates behavior based on an appraisal-based affective model. Built on Russell's circumplex model of affect, the engine maintains a continuous emotional state defined by two axes:
|
|
492
|
+
|
|
493
|
+
- **Valence** (-1 to +1): displeasure ↔ pleasure
|
|
494
|
+
- **Arousal** (0 to 1): calm ↔ energized
|
|
495
|
+
|
|
496
|
+
Every agent event (tool success/failure, task completion, errors, context pressure) is appraised and shifts the emotional state, which decays back toward a baseline over ~60 seconds. The emotional state modulates agent behavior:
|
|
497
|
+
|
|
498
|
+
| Quadrant | Valence | Arousal | Behavioral Effect |
|
|
499
|
+
|----------|---------|---------|-------------------|
|
|
500
|
+
| Excited/Manic | High+ | High | Bold action, creative solutions, fast iteration |
|
|
501
|
+
| Determined/Stressed | Low- | High | Intense focus, double-checking, persistence |
|
|
502
|
+
| Content/Calm | High+ | Low | Methodical approach, patient exploration |
|
|
503
|
+
| Subdued/Cautious | Low- | Low | Careful, deliberate, risk-averse |
|
|
504
|
+
|
|
505
|
+
### Emotion Center (LLM-Generated Labels)
|
|
506
|
+
|
|
507
|
+
The emotion label and emoji displayed in the TUI are **not from a static list** — they are generated by the "emotion center," a dedicated LLM call with high temperature (0.9) that receives the current valence/arousal coordinates and freely chooses an evocative word and emoji. While guided toward face emojis (😊 😤 🤔 😰 🤩), the emotion center can diverge to animals (🦊), objects (🔥), or esoteric choices (🌊) at its own discretion.
|
|
508
|
+
|
|
509
|
+
### TUI Status Bar
|
|
510
|
+
|
|
511
|
+
The current emotion is displayed in the status bar between the SNR indicator and the Exp (expert speed ratio):
|
|
512
|
+
|
|
513
|
+
```
|
|
514
|
+
In: 1,234 | Out: 567 | Ctx: 8,192/131,072 | SNR: 85% | 🔥 exhilarated | Exp: 3.2x | Cost: $0.00
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Proactive Admin Outreach
|
|
518
|
+
|
|
519
|
+
When the Telegram bridge is active with `--admin`, the emotion engine can proactively message the admin:
|
|
520
|
+
- **Excitement threshold** (arousal ≥ 0.85, valence > 0.5): shares task completions and success streaks
|
|
521
|
+
- **Distress threshold** (valence ≤ -0.7, arousal > 0.6): signals consecutive failures that may need human guidance
|
|
522
|
+
- Outreach is rate-limited to at most once per 5 minutes
|
|
523
|
+
|
|
524
|
+
### Momentum Effects
|
|
525
|
+
|
|
526
|
+
Consecutive outcomes amplify emotional shifts (modeled after PRISM's SDE snowball effect):
|
|
527
|
+
- 3+ consecutive successes → escalating excitement multiplier
|
|
528
|
+
- 2+ consecutive failures → escalating stress multiplier
|
|
529
|
+
|
|
530
|
+
### Research Foundations
|
|
531
|
+
|
|
532
|
+
The emotion system is informed by peer-reviewed and preprint research:
|
|
533
|
+
|
|
534
|
+
1. **Russell Circumplex Model** — Wu et al. "AI shares emotion with humans across languages and cultures" (arXiv:2506.13978, 2025). Confirms LLM emotion spaces are structurally congruent with the circumplex model; human emotion concepts can causally steer LLM affective states.
|
|
535
|
+
|
|
536
|
+
2. **VIGIL EmoBank** — Cruz, "VIGIL: A Reflective Runtime for Self-Healing Agents" (arXiv:2512.07094, 2025). Persistent emotional state store with appraisal pipeline and decay policies; emotional state drives behavioral interventions.
|
|
537
|
+
|
|
538
|
+
3. **EILS Homeostatic Signals** — Tiwari, "Emotion-Inspired Learning Signals" (arXiv:2512.22200, 2025). Bio-inspired curiosity/stress/confidence signals create closed-loop homeostatic regulation of exploration vs. exploitation.
|
|
539
|
+
|
|
540
|
+
4. **Concurrent Modular Agent** — Maruyama et al. (arXiv:2508.19042, 2025). Practical realization of Minsky's Society of Mind theory with asynchronous LLM modules and shared global state.
|
|
541
|
+
|
|
542
|
+
5. **Swarm Emotional Modulation** — Freire-Obregón (arXiv:2603.09963, 2026). Arousal drives commitment speed (exploitation pressure); valence drives risk tolerance in collective decision dynamics.
|
|
543
|
+
|
|
544
|
+
6. **PRISM SDE** — Lu et al. (arXiv:2512.19933, 2025). Stochastic differential equations for continuous emotional evolution with personality-conditional action selection.
|
|
545
|
+
|
|
546
|
+
7. **PsySET Benchmark** — Banayeeanzade et al. (arXiv:2510.04484, 2025). Prompting is effective for emotion steering; emotional states have systemic cross-domain effects on reasoning quality.
|
|
547
|
+
|
|
548
|
+
8. **EmotionBench** — Huang et al. (arXiv:2308.03656, 2023). LLMs cannot maintain emotional state across turns implicitly — argues for explicit external mood state representation (which this engine implements).
|
|
549
|
+
|
|
426
550
|
## Listen Mode — Live Bidirectional Audio
|
|
427
551
|
|
|
428
552
|
Listen mode enables real-time voice communication with the agent. Your microphone audio is captured, streamed through Whisper, and the transcription is injected directly into the input line — creating a hands-free coding workflow.
|