openpetswithchatandmcp/packages/agent-events/codemap.md
OpenPets Dev 6ab3bb64d8 feat(rebrand): rename OpenPets to FamiliarOS and pets to familiars
- Rename all user-facing and technical identifiers from OpenPets/Pet to FamiliarOS/Familiar.
- Rename packages from @open-pets/* to @familiaros/*; rename install-pet/pet-format packages.
- Rename plugin IDs and directories from openpets.* to familiaros.*.
- Rename IPC namespace from openpets:* to familiaros:* and state filenames from openpets-* to familiaros-* with legacy migration.
- Rename source files (pet-window, built-in-pet, default-pet-controller, etc.) to familiar equivalents.
- Update locales (en, es-419, ja, ko, pt-BR, zh-Hans, zh-Hant) and tray/pet context menu strings.
- Add Familiar naming feature: preference, settings input, tray menu display.
- Update assets and packaging config; all desktop tests pass.
2026-06-17 01:42:08 +00:00

1.4 KiB

packages/agent-events/

Speech pools and validation for agent feedback messages.

Responsibility

Provides categorized speech pools (thinking, success, error, permission) and validation logic for agent-facing messages. Ensures messages are safe (no code, URLs, paths, secrets) and appropriately sized (1-140 chars, single line).

Design

Category-Based Pools: Four speech categories with curated message pools:

  • thinking: "Thinking it through", "Let me check", etc.
  • success: "Done", "That worked", etc.
  • error: "Something failed", "Needs another look", etc.
  • permission: "Approval needed"

Validation Strategy: Regex-based validation rejecting:

  • Multi-line content (\r|\n)
  • Code-like patterns (backticks, keywords, braces)
  • URLs (https?://, www.)
  • File paths (slashes, drive letters)
  • Secrets (api_key, secret, password, token)

Random Selection: pickHookSpeech() uses bounded random index selection with fallback chains.

Flow

Agent Event → pickHookSpeech(category, randomFn) → validateHookSpeech(message) → Safe message

Integration Points

Consumers:

  • @familiaros/claude - Hook message generation
  • @familiaros/opencode - Plugin speech events

Exports:

  • hookSpeechPools - Readonly record of message arrays
  • pickHookSpeech() - Random selection with bounds checking
  • validateHookSpeech() - Security validation
  • HookSpeechCategory - Type union for categories