AIPET

PET SDK Reference

This page is a compact reference for custom PET plugins used by AIPET. The authoritative repo doc remains pets/README.md, but this HTML version is useful when reviewing the SDK in-browser.

Core Shape

Each plugin registers itself with registerCustomPetPlugin({...}).

registerCustomPetPlugin({
  css: `#pet.pet-custom.my-pet {}`,
  render() {
    return `<div id="my-pet-root"></div>`;
  },
  onMount({ petElement }) {
    petElement.classList.add('my-pet');
  },
  onUnmount({ petElement }) {
    petElement.classList.remove('my-pet');
  }
});

High-Value Hooks

  • onAnimationChange for base state transitions
  • onSocialEvent for semantic reactions and easter eggs
  • onGesture for lightweight gesture pulses
  • onVisionState for tracked people, faces, objects, gestures
  • onSystemState for throttling, thermal, CPU, battery cues

Behavior States

Normalized states expected by the runtime:

Extended states available to plugins:

Social Event Contract

onSocialEvent receives { type, context, ...hookContext }.

Current important social event types:

Recommended pattern: use onGesture for fast generic gesture effects, but use onSocialEvent when a gesture is promoted into a stronger semantic event such as MIDDLE_FINGER.

Implementation Guidance