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

@lakex-react/ai

v0.2.1

Published

Configurable AI assistant card and selection toolbar for @lakex-react/core.

Readme

@lakex-react/ai

Shared AI service, assistant card, selection actions, and code-block actions for @lakex-react/core.

npm install @lakex-react/core @lakex-react/ai
import { LakexEditor } from '@lakex-react/core';
import {
  aiAssistantCard,
  createAIAgent,
  createAIService,
  createLakexAI,
  type LakexAIModelConfig,
} from '@lakex-react/ai';
import '@lakex-react/core/style.css';
import '@lakex-react/ai/style.css';

const models: LakexAIModelConfig[] = [
  { id: 1, name: 'deepseek', capabilities: ['text', 'structured-output'] },
  { id: 2, name: 'seedream', capabilities: ['text-to-image'] },
];

const service = createAIService(async (request) => {
  const response = await fetch('/api/ai/run', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      modelId: request.modelId,
      prompt: request.prompt,
      systemPrompt: request.systemPrompt || request.agent?.content,
      operation: request.operation,
      context: request.context,
      output: request.output,
      stream: request.output === 'text' && request.context !== 'drawing-board',
    }),
    signal: request.signal,
  });
  if (!response.ok) throw new Error('AI request failed');
  return response;
});

const ai = createLakexAI({
  service,
  models,
  defaultModels: { text: 1, code: 1, drawing: 1 },
  agents: [
    createAIAgent({
      name: 'OKR Manager',
      content: okrAgentYaml,
      modelId: 1,
    }, { models, service }),
    createAIAgent({
      name: 'Image generator',
      content: imageAgentYaml,
      modelId: 2,
      output: 'image',
    }, { models, service }),
  ],
});

<LakexEditor
  config={{
    customCard: { cards: [aiAssistantCard] },
    cardConfigs: { AI: ai },
  }}
/>

createLakexAI() adapts one AIService.run() to the drawing board, code-block AI, assistant card, and selection assistant. Ordinary features send a numeric modelId directly and do not require an Agent.

Agents are optional and appear only in the toolbox. Their content can be a complete YAML document. Image generation is also an Agent and should declare output: 'image'. createAIAgent() derives modelName and modelFunc from the selected model. You may provide your own modelFunc(systemPrompt, userPrompt); the deprecated func field remains readable for one compatibility cycle.

Provider credentials should stay on the server. The local example stores model connections in the gitignored examples/ai-apis.mock.json. /api/ai/run accepts modelId, resolves the matching endpoint/API key/model, and returns SSE for text or provider JSON for images. There is no separate server-side Agent registry.

Code auto-comment replaces the current code block. Code explanation streams a normal paragraph below it. Assistant and selection text results can be inserted as native editor content; image Agent results can be inserted as native image cards.

Lakex JSON Skills

Use the DOM-free subpath when an AI request needs Lakex native JSON output. Pass features explicitly whenever the caller knows the required nodes:

import { getLakexJsonSkills } from '@lakex-react/ai/json-skills';

const formatSkills = getLakexJsonSkills({
  features: ['table', 'image'],
});

const response = await aiService.run({
  ...request,
  systemPrompt: `${request.systemPrompt || ''}\n\n${formatSkills}`,
});

If features is omitted, input is used for best-effort Chinese/English keyword detection. An unrecognized input falls back to all compact v3 chunks:

getLakexJsonSkills({ input: userPrompt });

The subpath also exports resolveLakexJsonSkillFeatures(), detectLakexJsonSkillFeatures(), getLakexJsonSkillChunk(), and isLakexJsonSkillFeature() for callers that need lower-level control. All manifests and Markdown chunks live inside packages/ai/src/json-skills and are inlined during the package build; the published package does not depend on the repository-level docs or examples directories.

The full docs/lakex-json-format-skills.md file is retained as a developer reference and should not be sent to AI as one large prompt. The runtime loader uses the v3 chunk manifest instead.