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

@rekayasa/erica-bubble

v1.4.13

Published

Erica AI Chat Widget - A self-contained React component for integrating Erica AI assistant

Readme

@rekayasa/erica-bubble

React chat widget with conversation history, attachments/OCR, charts, reports and template downloads.

Install

npm install @rekayasa/erica-bubble @copilotkit/[email protected] @copilotkit/[email protected]

React/React DOM 18 or 19 and ECharts 5 or 6 are peer dependencies. Import @rekayasa/erica-bubble/styles.css once.

Procsi gateway authentication

The host owns authentication and token storage. Obtain the runtime URL from trusted host/bootstrap configuration, not from a user-controlled link. The account comes from this URL and server configuration; browser identity, language and agent identifiers grant no permissions.

import { EricaProvider, EricaChat, EricaDrawer } from '@rekayasa/erica-bubble';
import '@rekayasa/erica-bubble/styles.css';

// session is the host's authenticated session manager, not widget storage.
function Assistant({ session }) {
  if (!session.loggedIn) return null;
  return (
    <EricaProvider
      authMode="gateway"
      runtimeUrl={session.widgetRuntimeUrl} // https://gateway.example/api/erica/<account>
      sessionKey={`${session.userId}:${session.accountId}:${session.loginGeneration}`}
      getToken={() => session.getAccessToken()}
      onTokenRefreshed={token => session.setAccessToken(token)}
      onAuthError={status => session.endWidgetSession(status)}
      language="id"
    >
      <EricaDrawer>
        <EricaChat />
      </EricaDrawer>
    </EricaProvider>
  );
}

Gateway provider props:

| Prop | Contract | | --- | --- | | authMode | Required literal "gateway"; never falls back to PAT/guest authentication | | runtimeUrl | Required trusted HTTP(S) single-route endpoint ending /api/erica/<account>; no credentials, query or fragment | | sessionKey | Required nonempty user/account/login-generation isolation key; not a permission claim | | getToken | Fresh lookup before every request; returns token, null/undefined, or a Promise of either | | onTokenRefreshed | Latest host callback receives normalized bearer token (without Bearer ) from response Authorization | | onAuthError | Latest host callback, once per terminal session, with 401 or 403 | | language | Optional "id" or "en", sent as Accept-Language preference only |

pat, user and scopingEnable are disallowed in gateway mode. There is no frontend role/division/access policy registration in this mode. Backend policy remains authoritative; this widget does not implement row filtering.

Change sessionKey on every login generation/user/account change. On logout, unmount the provider (or change its key); returning no token also blocks the next request and terminates the widget. Simply replacing a JWT must not change sessionKey: refreshed tokens do not reset the thread. Callback/getter updates do not remount the session. Changing the normalized runtime URL also resets it. If EricaChat.runtimeUrl is provided in gateway mode it must match the provider URL; mismatches render nothing.

Each provider/session owns its SDK client and query/artifact/thread/tool state. Ending a session aborts requests and discards late response callbacks. A 401/403 ends the session, clears its cache and UI, with no retry, replay, guest-token exchange or token-refresh loop. Change sessionKey after host reauthentication to restart. Missing credentials send no request. Tokens are not persisted by the widget.

The same authenticated transport covers explicit runtime info, agent run/connect/stop and SDK requests (including binary downloads and multipart uploads). It replaces Authorization per request, strips guest/account headers, rejects redirects and pins credentials to the configured gateway origin and /api/erica/ path. Response bodies are not read or cloned to observe refresh headers. Gateway deployment must allow the widget origin, permit request Authorization/Accept-Language, and expose Authorization via Access-Control-Expose-Headers; otherwise refresh headers are not readable by browsers.

The supported gateway protocol is single-route SSE: POST {method:"info"}, agent/run and agent/connect envelopes with params.agentId="default" and AG-UI body, plus agent/stop with params.threadId. The server pins forwarded properties. CopilotKit uses a self-managed local agent with no runtimeUrl, preventing hidden registry/fallback requests and remote-agent collisions. Intelligence/WebSocket runtimes are not supported by this transport. AG-UI/RxJS are internal bundled implementation details, not additional public peers.

Legacy integrations

Existing EricaProvider calls with pat, user, language, optional scopingEnable and EricaChat runtimeUrl remain supported with authMode omitted (or "legacy"). They retain the existing Canvas /api/widget/<account> runtime, guest-token exchange/refresh, account header and legacy XML context behavior. Do not use that browser-supplied context as a server authorization boundary. New gateway integrations must use the gateway union above, not PAT credentials.

Chat and UI

  • EricaChat.runtimeUrl: required operationally for legacy; optional in gateway mode.
  • EricaChat.requiresSandbox: defaults to false; opt in only for agents requiring a workspace.
  • EricaDrawer: displays chart/report artifacts alongside chat.
  • History can select prior conversations or start a new thread; file uploads support deferred OCR submission.
  • Existing persisted XML in thread messages is hidden from displayed/copied user messages.

Public TypeScript exports include EricaChatProps, EricaProviderProps, EricaGatewayProviderProps, EricaLegacyProviderProps and EricaProviderUserProps.