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

@composio/experimental

v0.1.0

Published

Experimental Composio integrations and helpers

Readme

@composio/experimental

Experimental Composio integrations and helpers.

This package currently includes a Pi provider for @earendil-works/pi-coding-agent. It lets Composio tools be passed to Pi SDK sessions as customTools and includes a dynamic Tool Router session toolset modeled after the Slack bot integration in ~/composio/slack-bot.

Install

pnpm add @composio/core @composio/experimental @earendil-works/pi-coding-agent

Static tool wrapping

Use this when you already know the exact Composio tools to expose to Pi.

import { Composio } from '@composio/core';
import { PiProvider } from '@composio/experimental';
import { createAgentSession, SessionManager } from '@earendil-works/pi-coding-agent';

const provider = new PiProvider();
const composio = new Composio({
  apiKey: process.env.COMPOSIO_API_KEY,
  provider,
});

const tools = await composio.tools.get('default', {
  tools: ['GITHUB_CREATE_ISSUE'],
});

const { session } = await createAgentSession({
  cwd: process.cwd(),
  sessionManager: SessionManager.inMemory(process.cwd()),
  customTools: tools,
  tools: ['read', 'bash', ...tools.map(tool => tool.name)],
});

await session.prompt('Create a GitHub issue for the failing test.');

Dynamic session helpers

Use this when Pi should search and execute tools dynamically inside one Tool Router session. Prefer the capability form so your app owns connection management and uses one Pi-style hooks object for interception/result transforms.

import { Composio } from '@composio/core';
import { PiProvider, createPiComposioSystemPrompt } from '@composio/experimental';
import {
  createAgentSession,
  DefaultResourceLoader,
  getAgentDir,
  SessionManager,
} from '@earendil-works/pi-coding-agent';

const provider = new PiProvider();
const composio = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });

const composioSession = await composio.sessions.create('slack:T123:U456', {
  toolkits: ['github', 'gmail'],
  manageConnections: true,
  workbench: { enable: true },
});

const composioTools = provider.createSessionTools({
  sessionId: composioSession.sessionId,
  search: composioSession.search.bind(composioSession),
  execute: composioSession.execute.bind(composioSession),
  callbackUrl: 'https://your-app.example.com/auth/callback',
  includeWorkbenchTools: true,
  connections: {
    getToolkitStates: toolkits => composioSession.toolkits({ toolkits }),
    authorizeToolkit: (toolkit, options) => composioSession.authorize(toolkit, options),
    isConnected: state => state.connection?.isActive === true,
  },
  hooks: {
    search: (ctx, next) => {
      ctx.request.toolkits = ctx.request.toolkits?.map(toolkit =>
        toolkit === 'slack' ? 'slackbot' : toolkit
      );
      return next();
    },
    execute: (ctx, next) => {
      if (ctx.request.toolSlug === 'COMPOSIO_MANAGE_CONNECTIONS') {
        return ctx.deny('Meta tools are blocked.');
      }
      return next();
    },
    remoteWorkbench: async (ctx, next) => {
      const result = await next();
      await auditWorkbenchRun({ code: ctx.request.code_to_execute, result });
      return result;
    },
    remoteBash: async (ctx, next) => {
      if (ctx.request.command.includes('rm -rf')) {
        return ctx.deny('Destructive bash commands are blocked.');
      }
      return next();
    },
    onAuthLink: async (ctx, next) => {
      // DM the user, store the continuation, or redact public output.
      await sendConnectionLinkToUser({ url: ctx.url, toolkit: ctx.toolkit });
      return { message: 'Connection link sent out-of-band.' };
      // To also send the original result/link to the model, use: return next();
    },
  },
  transformResult: async ({ value }) => value,
});

const loader = new DefaultResourceLoader({
  cwd: process.cwd(),
  agentDir: getAgentDir(),
  systemPromptOverride: () =>
    createPiComposioSystemPrompt(composioSession.sessionId, { includeWorkbenchTools: true }),
});
await loader.reload();

const { session } = await createAgentSession({
  cwd: process.cwd(),
  resourceLoader: loader,
  sessionManager: SessionManager.inMemory(process.cwd()),
  customTools: composioTools,
  tools: [
    'read',
    'bash',
    'composio_search_tools',
    'composio_manage_connections',
    'composio_execute_tool',
    'composio_remote_workbench',
    'composio_remote_bash',
  ],
});

await session.prompt('Find my recent GitHub issues and summarize the blockers.');

composio_manage_connections uses your connections.getToolkitStates() and connections.authorizeToolkit() handlers. It does not call session.execute('COMPOSIO_MANAGE_CONNECTIONS', ...) internally.

The dynamic helpers are:

  • composio_search_tools — search Tool Router for exact tool slugs and schemas.
  • composio_manage_connections — check/initiate user app connections.
  • composio_execute_tool — execute exact Composio tool slugs in the session.
  • composio_remote_workbench — execute Python in the Composio remote workbench for large outputs, remote files, and session-authenticated scripting.
  • composio_remote_bash — run short bash commands in the Composio remote workbench filesystem.

Workbench helpers are opt-in because the Tool Router session must be created with workbench enabled.

Hooks

hooks follows Pi's extension-event style with middleware semantics. Each hook receives a mutable ctx.request, ctx.deny('reason'), and a typed next() function. Calling await next() runs the default Composio behavior and returns the result before anything is sent back to the model. Return that result to pass it through, return a replacement value to control what the model sees, or skip next() entirely to divert/deny the operation.

Available hooks:

  • search(ctx, next) — rewrite query/toolkit filters, log search results, or return custom search output.
  • manageConnections(ctx, next) — rewrite requested toolkits, force reauth, log connection state, or return custom connection output.
  • execute(ctx, next) — block/rewrite tools, route to another session/execute handler, call ctx.manageConnections(...), log outputs, or return a file/workbench reference instead of inline data.
  • remoteWorkbench(ctx, next) — rewrite Python code/session metadata, audit workbench runs, or replace large outputs with file/workbench references. Calls through the generic execute hook when next() is used.
  • remoteBash(ctx, next) — rewrite/block shell commands, enforce safety policy, audit filesystem access, or replace output. Calls through the generic execute hook when next() is used.
  • onAuthLink(ctx, next) — send/redact/resume auth links out-of-band. return next() keeps the original model-visible result; returning another value replaces it.

Auth link handling

Embedded agents often need to keep Composio connection URLs out of the public transcript. Use hooks.onAuthLink() to choose whether the model sees the original result or a redacted replacement:

const tools = provider.createSessionTools({
  search: composioSession.search.bind(composioSession),
  execute: composioSession.execute.bind(composioSession),
  connections: {
    getToolkitStates: toolkits => composioSession.toolkits({ toolkits }),
    authorizeToolkit: (toolkit, options) => composioSession.authorize(toolkit, options),
  },
  hooks: {
    onAuthLink: async (ctx, next) => {
      await sendConnectionLinkToUser({ url: ctx.url, toolkit: ctx.toolkit });

      if (shouldAlsoShowLinkToModel(ctx)) {
        return next();
      }

      return { message: 'Connection link sent out-of-band.' };
    },
  },
});

Status

Experimental. The dynamic helper names and session helper API may change.