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

@agent-assistant/traits

v0.5.0

Published

Validated immutable assistant traits for Agent Assistant SDK

Downloads

16,474

Readme

@agent-assistant/traits

@agent-assistant/traits is a TypeScript-first leaf package for validated, immutable assistant trait data.

It defines how an assistant presents itself and which formatting hints it prefers. It does not own runtime config, persona prompts, routing, model choice, memory, or product behavior.

API

import {
  createTraitsProvider,
  TraitsValidationError,
} from '@agent-assistant/traits';

import type {
  AssistantTraits,
  SurfaceFormattingTraits,
  TraitsProvider,
} from '@agent-assistant/traits';

Data Model

AssistantTraits

interface AssistantTraits {
  voice: string;
  formality: string;
  proactivity: string;
  riskPosture: string;
  domain?: string;
  vocabulary?: string[];
}

Rules:

  • voice must be a non-empty string. Known values are concise, conversational, formal, and technical.
  • Unknown voice values are accepted with console.warn so products can extend the register without forking the package.
  • formality must be casual, professional, or academic.
  • proactivity must be low, medium, or high.
  • riskPosture must be cautious, moderate, or assertive.
  • domain, if present, must be a non-empty string.
  • vocabulary, if present, must be a non-empty array of non-empty strings.

SurfaceFormattingTraits

interface SurfaceFormattingTraits {
  preferredResponseLength?: number;
  preferRichBlocks?: boolean;
  preferMarkdown?: boolean;
}

Rules:

  • preferredResponseLength, if present, must be a positive integer.
  • preferRichBlocks, if present, must be a boolean.
  • preferMarkdown, if present, must be a boolean.

These are hints for product-owned format hooks. They do not replace surface capability checks.

TraitsProvider

interface TraitsProvider {
  readonly traits: Readonly<AssistantTraits>;
  readonly surfaceFormatting?: Readonly<SurfaceFormattingTraits>;
}

Consumers should depend on the read-only provider contract, not mutate or rebuild the provider at runtime.

Creating a Provider

import { createTraitsProvider } from '@agent-assistant/traits';

const traits = createTraitsProvider(
  {
    voice: 'concise',
    formality: 'professional',
    proactivity: 'medium',
    riskPosture: 'moderate',
    domain: 'knowledge-and-workspace',
    vocabulary: ['digest', 'workspace', 'context'],
  },
  {
    preferredResponseLength: 800,
    preferRichBlocks: false,
    preferMarkdown: true,
  },
);

createTraitsProvider validates inputs, copies them, freezes the returned provider, freezes the nested trait objects, and freezes the copied vocabulary array when present.

Validation Errors

import { createTraitsProvider, TraitsValidationError } from '@agent-assistant/traits';

try {
  createTraitsProvider({
    voice: 'concise',
    formality: 'semi-formal',
    proactivity: 'medium',
    riskPosture: 'moderate',
  });
} catch (error) {
  if (error instanceof TraitsValidationError) {
    console.error(error.field);
    console.error(error.invalidValue);
    console.error(error.message);
  }
}

TraitsValidationError extends Error and exposes:

  • field: the failing trait field name
  • invalidValue: the rejected value
  • message: a readable explanation

Usage Boundaries

This package owns trait data only.

  • No workforce persona ownership
  • No prompt generation
  • No product-specific logic
  • No cloud or runtime service assumptions
  • No dynamic learning or adaptation engine
  • No imports from other Relay Assistant packages

Traits and workforce personas are intentionally separate. Products may compose trait values into persona prompts or synthesizer inputs, but that composition belongs outside this package.

Adaptation Pattern

The v1 adaptation layer is read-only and product-owned: packages and products read a TraitsProvider and apply its values to their own formatting or synthesis logic.

Example formatting usage:

const traits = runtime.definition.traits;

const useMarkdown =
  caps.supportsMarkdown && (traits?.surfaceFormatting?.preferMarkdown ?? true);

const responseVoice = traits?.traits.voice ?? 'concise';

Example synthesis usage:

const traits = context.definition?.traits;

return assembleResponse(results, {
  voice: traits?.traits.voice ?? 'concise',
  formality: traits?.traits.formality ?? 'professional',
});

The package does not generate prompts, emit formatted output, or interpret domain vocabulary beyond validation.

Core Integration

@agent-assistant/core can attach a provider on AssistantDefinition:

const assistant = createAssistant({
  id: 'sage',
  name: 'Sage',
  traits: createTraitsProvider({
    voice: 'concise',
    formality: 'professional',
    proactivity: 'medium',
    riskPosture: 'moderate',
  }),
  capabilities: {
    reply: () => undefined,
  },
});

The field is optional. Assistants without traits continue to work unchanged.

Local Development

From packages/traits:

npm install
npm run build
npm test

This package is runnable in isolation and has zero runtime dependencies.

TRAITS_PACKAGE_IMPLEMENTED