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

dpml

v0.3.0

Published

DPML - Deepractice Prompt Markup Language

Readme

dpml

The main package for DPML (Deepractice Prompt Markup Language).

Installation

npm install dpml
# or
bun add dpml

Usage

import { createDPML, defineSchema, defineTransformer } from 'dpml';

// Define schema
const schema = defineSchema({
  element: 'prompt',
  attributes: [{ name: 'role', required: true }],
});

// Define transformer
const transformer = defineTransformer({
  name: 'my-transformer',
  transform: input => ({
    role: input.document.rootNode.attributes.get('role'),
    content: input.document.rootNode.content,
  }),
});

// Create DPML instance
const dpml = createDPML({
  schema,
  transformers: [transformer],
});

// Compile content
const result = await dpml.compile('<prompt role="assistant">Hello</prompt>');

Built-in Elements

DPML provides built-in elements that are automatically recognized regardless of your schema definition.

<resource> Element

The <resource> element is used to reference external resources. It's automatically processed by the built-in resource transformer.

<prompt>
  <resource src="arp:text:file://./config.md"/>
  <resource src="deepractice.ai/sean/[email protected]"/>
</prompt>

Attributes:

  • src - Resource locator (required for meaningful use, but tolerant like HTML)

Protocol Detection:

The src attribute is automatically parsed to detect the protocol:

| Protocol | Format | Example | | --------- | ------------------- | ----------------------------------- | | arp | Starts with arp: | arp:text:file://./config.md | | rxl | Domain/path pattern | deepractice.ai/path/[email protected] | | unknown | Everything else | Invalid or empty src |

Accessing Resources:

import { createDPML, defineSchema } from 'dpml';
import type { ResourceResult } from 'dpml';

const schema = defineSchema({ element: 'prompt' });
const dpml = createDPML({ schema, transformers: [] });

const result = await dpml.compile<ResourceResult>(`
  <prompt>
    <resource src="arp:text:file://./rules.md"/>
    <resource src="localhost/[email protected]"/>
  </prompt>
`);

console.log(result.resources);
// [
//   { src: 'arp:text:file://./rules.md', protocol: 'arp', node: DPMLNode },
//   { src: 'localhost/[email protected]', protocol: 'rxl', node: DPMLNode }
// ]

Design Philosophy (HTML-like tolerance):

  • DPML does not validate the src content at parse time
  • Invalid or empty src values are accepted (marked as protocol: 'unknown')
  • Resource loading is delegated to the application layer
  • This follows HTML's approach: parse tolerantly, handle errors at runtime

API

createDPML(config)

Creates a DPML instance.

Config:

  • schema - Schema definition for validation
  • transformers - Array of transformers to apply

Returns: DPML instance with methods:

  • compile<T>(content) - Parse, validate, and transform content
  • parse(content) - Parse content to document
  • validate(content) - Validate content against schema
  • extend(config) - Extend configuration
  • getSchema() - Get current schema
  • getTransformers() - Get current transformers

defineSchema(definition)

Creates a schema definition.

Definition:

  • element - Element name (for ElementSchema)
  • root - Root element (for DocumentSchema)
  • attributes - Attribute definitions
  • children - Child element definitions
  • content - Content constraints

defineTransformer(definition)

Creates a transformer definition.

Definition:

  • name - Transformer name (required)
  • description - Optional description
  • transform - Transform function (required)

Built-in Transformers

DPML automatically registers the following built-in transformers:

Resource Transformer (dpml:resource-extractor)

Automatically extracts all <resource> elements from the document and adds them to the result as a resources array.

  • Runs before user-defined transformers
  • Adds resources: ResourceInfo[] to the result
  • Does not modify the document structure

Types

import type {
  // Core types
  DPML,
  DPMLConfig,
  Schema,
  Transformer,
  DPMLDocument,
  DPMLNode,
  ValidationResult,
  // Resource types
  ResourceInfo,
  ResourceResult,
} from 'dpml';

ResourceInfo

interface ResourceInfo {
  /** Original src attribute value */
  src: string | undefined;
  /** Detected protocol: 'arp', 'rxl', or 'unknown' */
  protocol: 'arp' | 'rxl' | 'unknown';
  /** Reference to the original DPMLNode */
  node: unknown;
}

ResourceResult

interface ResourceResult {
  /** Extracted resource references */
  resources: ResourceInfo[];
  /** Other properties from processing result */
  [key: string]: unknown;
}

License

MIT