npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@charivo/avatar

v0.2.6

Published

Avatar control tools for Charivo LLM and realtime sessions

Readme

@charivo/avatar

Catalog-constrained avatar control tools for Charivo LLM and realtime sessions.

@charivo/avatar depends only on @charivo/core. It builds setExpression, playMotion, and lookAt tool definitions/handlers from your model's expression and motion catalog, plus a matching instruction string and a result projector that turns successful tool calls into avatar:* events.

Pair createAvatarControlTools(...) with buildAvatarControlInstructions(...) when you want the model to use avatar actions proactively. Keep those instructions in the app/session layer rather than in @charivo/llm or @charivo/realtime so non-avatar sessions in those packages stay generic.

Install

pnpm add @charivo/avatar

Exports

  • createAvatarControlTools(catalog)
  • buildAvatarControlInstructions(catalog)
  • createAvatarResultProjector()
  • AVATAR_CONTROL_TOOL_NAMES
  • SET_EXPRESSION_TOOL_NAME
  • PLAY_MOTION_TOOL_NAME
  • LOOK_AT_TOOL_NAME
  • type ExpressionArgs, type MotionArgs, type LookAtArgs

createAvatarControlTools(catalog) returns ToolRegistration[] from @charivo/core, so it works with both LLMManager (@charivo/llm) and RealtimeManager (@charivo/realtime) tool registries. setExpression and playMotion are included only when catalog.expressions / catalog.motions are non-empty; lookAt is always included.

Usage With RealtimeManager

import { createRealtimeManager } from "@charivo/realtime";
import {
  buildAvatarControlInstructions,
  createAvatarControlTools,
  createAvatarResultProjector,
} from "@charivo/avatar";

const catalog = { expressions: ["Smile", "Sad"], motions: { Idle: 2, TapBody: 3 } };

const manager = createRealtimeManager(client, {
  tools: createAvatarControlTools(catalog),
  resultProjectors: [createAvatarResultProjector()],
});

await manager.startSession({
  provider: "openai",
  instructions: buildAvatarControlInstructions(catalog),
});

Usage With LLMManager

import { createLLMManager } from "@charivo/llm";
import { createRemoteLLMClient } from "@charivo/llm/remote";
import {
  buildAvatarControlInstructions,
  createAvatarControlTools,
  createAvatarResultProjector,
} from "@charivo/avatar";

const catalog = { expressions: ["Smile", "Sad"], motions: { Idle: 2, TapBody: 3 } };

const manager = createLLMManager(createRemoteLLMClient({ apiEndpoint: "/api/chat" }), {
  tools: createAvatarControlTools(catalog),
  resultProjectors: [createAvatarResultProjector()],
  toolInstructions: buildAvatarControlInstructions(catalog),
});

LLMManager only runs the tool loop when the underlying LLMClient also implements callWithTools (e.g. @charivo/llm/remote talking to a route that forwards tools to generateResponseWithTools). See the LLM package README for the remote request/response shape and the round cap.

Events

createAvatarResultProjector() emits, on successful tool execution:

  • avatar:expression{ expressionId }
  • avatar:motion{ group, index }
  • avatar:gaze{ x, y }

@charivo/render's RenderManager already listens for these three events, so wiring a RenderManager picks them up automatically.

Instruction Composition

buildAvatarControlInstructions(catalog) returns generic, catalog-aware guidance (it adjusts wording based on which of expressions/motions are available). If your app needs stronger product-specific acting guidance, append it at the app layer instead of expanding this package's default text:

const instructions = [
  buildAvatarControlInstructions(catalog),
  "Keep replies short and natural for this product.",
].join("\n");

Migrating From @charivo/realtime-avatar

@charivo/realtime-avatar is deprecated; its published versions re-export this package. Replace the dependency and imports:

s/@charivo\/realtime-avatar/@charivo\/avatar/

All exports listed above are unchanged.