Skip to content

Add registerEvent to the React Native SDK #128

Description

@V3RON

Part of #95. Needs #126 and #127.

Why

React Native apps post events that agents can't discover, and app authors get no feedback when a posted event doesn't match what they meant to post.

Expected outcome

registerEvent({ name, description, payloadSchema? }) in @appduct/react-native, returning what registerTool returns. It goes through new TurboModule methods registerEvent(json) and unregisterEvent(name) to the native cores. payloadSchema takes a Standard Schema or raw JSON Schema, as tool schemas do. The JS layer keeps the Standard Schemas and uses them for development warnings.

Constraints and non-goals

  • Declaring an event is advisory. An undeclared postEvent still reaches agents, and every existing postEvent caller keeps working unchanged.
  • Production builds post as-is, with no checks.

How we know it is done

  1. After registerEvent({ name: "checkout_completed", description, payloadSchema }), events.list returns the event with its description and schema, and after the disposer runs it's gone.
  2. In development, posting an undeclared name warns and names the event, and the event still reaches appduct_events.
  3. In development, posting a payload that fails the declared schema warns.
  4. In production, neither warning fires, and payloads are posted as-is.
  5. docs/TOOLS.md and the shipped skill's writing-tools.md tell app authors to declare each event they post.

Alternatives considered

none

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:react-native-sdkpackages/react-nativeplatform:react-nativeAffects the React Native SDK, Expo plugin or Metro helperstatus:readySpec and fix direction are clear; an agent can pick it uptype:featureSomething Appduct should do that it does not today

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions