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

@memberjunction/ng-agent-client

v5.40.2

Published

MemberJunction: Angular adapter for the Agent Client SDK - injectable service, navigation tools, RxJS bridges

Readme

@memberjunction/ng-agent-client

Thin Angular wrapper around @memberjunction/ai-agent-client. Provides Angular dependency injection and automatic lifecycle cleanup -- nothing more.

What This Package Does

  • AgentClientService -- An @Injectable({ providedIn: 'root' }) singleton that owns an AgentClientSession internally.
  • Pass-through API -- Every public method and observable on AgentClientSession is exposed directly. No transformation, no added logic.
  • Lifecycle management -- Calls session.Dispose() in ngOnDestroy to prevent memory leaks.

What This Package Does NOT Do

  • No business logic
  • No tool handlers -- the consuming application registers tools
  • No GraphQL code -- that lives in the core SDK
  • No WebSocket code -- removed; transport is handled by GraphQLDataProvider

Usage

import { Component, inject, OnInit, OnDestroy } from '@angular/core';
import { AgentClientService } from '@memberjunction/ng-agent-client';
import { Subject, takeUntil } from 'rxjs';

@Component({ ... })
export class MyChatComponent implements OnInit, OnDestroy {
    private agentClient = inject(AgentClientService);
    private destroy$ = new Subject<void>();

    ngOnInit(): void {
        // Register tools
        this.agentClient.RegisterTool({
            Name: 'NavigateToRecord',
            Description: 'Open an entity record',
            ParameterSchema: { type: 'object', properties: { EntityName: { type: 'string' } } },
            Handler: async (params) => {
                // app-specific logic
                return { Success: true, Data: 'done' };
            },
        });

        // Listen for events
        this.agentClient.ToolRequested$
            .pipe(takeUntil(this.destroy$))
            .subscribe(event => console.log('Tool requested:', event.Request.ToolName));

        // Start session
        this.agentClient.StartSession('session-id');
    }

    async SendMessage(text: string): Promise<void> {
        const result = await this.agentClient.RunAgent({
            AgentId: 'agent-uuid',
            Messages: [{ role: 'user', content: text }],
        });
        console.log('Agent result:', result.Success);
    }

    ngOnDestroy(): void {
        this.destroy$.next();
        this.destroy$.complete();
        // AgentClientService.ngOnDestroy() calls session.Dispose() automatically
    }
}

API

All methods and observables mirror AgentClientSession from the core SDK:

| Member | Type | Description | |---|---|---| | ToolRequested$ | Observable | Emitted before tool execution | | ToolExecuted$ | Observable | Emitted after tool execution | | AgentProgress$ | Observable | Agent progress updates | | SessionActive$ | Observable | Session state changes | | Error$ | Observable | Errors during communication or execution | | SessionId | string \| null | Current session ID | | IsActive | boolean | Whether a session is active | | RegisterTool(tool) | method | Register a client-side tool handler | | UnregisterTool(name) | method | Remove a tool | | GetRegisteredTools() | method | List all registered tools | | StartSession(id) | method | Start listening for tool requests | | StopSession() | method | Stop and clean up | | RunAgent(params) | method | Execute an agent | | RunAgentFromConversationDetail(params) | method | Execute from conversation detail |

Using the Core SDK Directly

This Angular wrapper is a convenience, not a requirement. The core SDK (@memberjunction/ai-agent-client) already provides RxJS observables and requires no Angular-specific APIs. If you run into issues with Angular's providedIn: 'root' singleton pattern — such as duplicate instances from multiple module imports or npm hoisting conflicts — you can use AgentClientSession directly:

import { AgentClientSession } from '@memberjunction/ai-agent-client';

// Create and manage the session yourself
const session = new AgentClientSession();
session.RegisterTool({ Name: 'MyTool', ... });
session.StartSession('session-id');

// Same observables, same API — no Angular DI involved
session.ToolRequested$.subscribe(event => { ... });
await session.RunAgent({ AgentId: 'sage-id', Messages: [...] });

// Clean up when done
session.Dispose();

This is particularly useful in non-standard Angular setups (micro-frontends, lazy-loaded feature modules with their own injectors, or hybrid apps).

Further Reading