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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fractary/forge

v1.1.4

Published

Core SDK for Forge asset management with multi-resolver architecture

Readme

@fractary/forge

Core SDK for AI Agent & Tool Management

@fractary/forge is a comprehensive TypeScript SDK for managing, resolving, and distributing AI agents, tools, and workflows. It provides a flexible resolution system with local, global, and remote registry support.

npm version License: MIT TypeScript


✨ Features

  • 3-Tier Resolution: Local → Global → Remote registries
  • Plugin System: Install and distribute agent/tool collections
  • Version Management: Semver-based version constraints
  • Cache System: TTL-based caching for performance
  • Type-Safe: Full TypeScript support with Zod validation
  • Export Support: Export to LangChain, Claude Code, n8n
  • Fork Workflows: Fork and customize components with upstream merging

📦 Installation

npm install @fractary/forge

Requirements:

  • Node.js >= 18.0.0
  • TypeScript >= 5.3 (for TypeScript projects)

🚀 Quick Start

Basic Usage

import { ForgeClient } from '@fractary/forge';

// Initialize client
const client = new ForgeClient();

// List available agents
const agents = await client.agents.list();
console.log('Available agents:', agents);

// Get specific agent
const agent = await client.agents.get('my-agent');
console.log('Agent:', agent);

// Install plugin
await client.plugins.install('@fractary/faber-plugin', {
  global: true
});

With Configuration

import { ForgeClient } from '@fractary/forge';

const client = new ForgeClient({
  resolvers: {
    local: {
      enabled: true,
      paths: ['.fractary/agents', '.fractary/tools']
    },
    global: {
      enabled: true,
      path: '~/.fractary/registry'
    },
    remote: {
      enabled: true,
      registries: [
        {
          name: 'fractary-core',
          type: 'manifest',
          url: 'https://raw.githubusercontent.com/fractary/plugins/main/registry.json',
          priority: 1
        }
      ]
    }
  },
  cache: {
    enabled: true,
    ttl: 3600
  }
});

📚 Core API

Agents

// List agents
const agents = await client.agents.list({ source: 'local' });

// Get agent with dependencies
const agent = await client.agents.get('my-agent', {
  includeTools: true
});

// Create agent
await client.agents.create({
  name: 'my-agent',
  version: '1.0.0',
  llm: {
    provider: 'anthropic',
    model: 'claude-3-5-sonnet-20241022',
    temperature: 0.7
  },
  systemPrompt: 'You are a helpful assistant.',
  tools: ['web-search']
});

// Validate agent
const validation = await client.agents.validate('my-agent');

Tools

// List tools
const tools = await client.tools.list();

// Get tool
const tool = await client.tools.get('web-search');

// Create tool
await client.tools.create({
  name: 'my-tool',
  version: '1.0.0',
  description: 'Custom tool',
  parameters: {
    type: 'object',
    properties: {
      query: { type: 'string' }
    }
  },
  implementation: {
    type: 'function',
    handler: './handlers/my-tool.js'
  }
});

Plugins

// Search plugins
const results = await client.plugins.search('faber');

// Install plugin
await client.plugins.install('@fractary/faber-plugin', {
  global: true
});

// List installed
const plugins = await client.plugins.list();

// Uninstall
await client.plugins.uninstall('@fractary/faber-plugin');

Cache

// Get stats
const stats = await client.cache.getStats();

// Clear cache
await client.cache.clear();

// Clear with pattern
await client.cache.clear({ pattern: '@fractary/*' });

🔧 Advanced Features

Custom Resolvers

import { Resolver, ResolvedAsset } from '@fractary/forge';

class CustomResolver implements Resolver {
  name = 'custom';

  async resolve(
    name: string,
    type: 'agent' | 'tool',
    version?: string
  ): Promise<ResolvedAsset | null> {
    // Custom resolution logic
    return null;
  }
}

const client = new ForgeClient({
  customResolvers: [new CustomResolver()]
});

Error Handling

import {
  AssetNotFoundError,
  ValidationError,
  ResolutionError
} from '@fractary/forge';

try {
  const agent = await client.agents.get('my-agent');
} catch (error) {
  if (error instanceof AssetNotFoundError) {
    console.error('Agent not found');
  } else if (error instanceof ValidationError) {
    console.error('Validation failed:', error.errors);
  }
}

TypeScript Support

import type {
  Agent,
  Tool,
  AgentDefinition,
  ToolDefinition
} from '@fractary/forge';

const agentDef: AgentDefinition = {
  name: 'my-agent',
  version: '1.0.0',
  llm: {
    provider: 'anthropic',
    model: 'claude-3-5-sonnet-20241022'
  },
  systemPrompt: 'You are helpful.'
};

📖 Documentation

🏗️ Architecture

ForgeClient
├── Agents API
├── Tools API
├── Plugins API
└── Cache API
      │
      ▼
Resolution Manager
├── Local Resolver (.fractary/)
├── Global Resolver (~/.fractary/registry/)
└── Remote Resolver (registries)

🛠️ Development

# Clone repository
git clone https://github.com/fractary/forge.git
cd forge/sdk/js

# Install dependencies
npm install

# Build
npm run build

# Test
npm test

# Watch mode
npm run dev

See Developer Guide for contribution guidelines.

📄 License

MIT © Fractary

🔗 Links

🤝 Related Packages


Made with ❤️ by the Fractary team