API Reference@helix-hq/ai-kit

@helix-hq/ai-kit

Public API of @helix-hq/ai-kit.

The complete public surface of @helix-hq/ai-kit, generated from the published type declarations. Anything absent here is not part of the package's contract.

import { JSONSchema } from 'zod/v4/core';

// @public
export type AiCapability = {
    id: string;
    sections: PromptSection[];
    tools: AiToolDescriptor[];
    artifacts: ArtifactSpec[];
};

// @public
export type AiToolDescriptor = {
    name: string;
    description: string;
    parameters: JSONSchema.JSONSchema;
    execute: (input: unknown) => unknown;
};

// @public (undocumented)
export type ArtifactCollector = {
    handle: (event: ArtifactEvent) => void;
    flush: () => void;
};

// @public (undocumented)
export type ArtifactEmitter = (event: ArtifactEvent) => void;

// @public
export type ArtifactEvent =
/** A whole value, for `replace` artifacts. */
    {
    type: 'artifact-value';
    kind: string;
    value: unknown;
} |
/** Discard what was built so far: what follows is a replacement, not an edit. */
    {
    type: 'artifact-reset';
    kind: string;
} |
/** A fragment of a `jsonl-patch` artifact. Boundaries are arbitrary. */
    {
    type: 'artifact-delta';
    kind: string;
    chunk: string;
} |
/** No more of this artifact is coming. */
    {
    type: 'artifact-end';
    kind: string;
};

// @public (undocumented)
export type ArtifactHandlers = {
    onValue?: (kind: string, value: unknown) => void;
    onPatchLine?: (kind: string, line: string) => void;
    onReset?: (kind: string) => void;
    onEnd?: (kind: string) => void;
    onUnknown?: (kind: string, reason: string) => void;
};

// @public
export type ArtifactMode = 'replace' | 'jsonl-patch';

// @public
export type ArtifactSpec = {
    kind: string;
    description: string;
    schema?: JSONSchema.JSONSchema;
    mode: ArtifactMode;
};

// @public
export const artifactTools: (artifacts: ArtifactSpec[], emit: ArtifactEmitter) => AiToolDescriptor[];

// @public
export const coerceArguments: (schema: JSONSchema._JSONSchema, input: unknown) => unknown;

// @public
export const composeAssistant: (capabilities: AiCapability[], options?: ComposeOptions) => ComposedAssistant;

// @public
export type ComposedAssistant = {
    system: string;
    sections: PromptSection[];
    tools: AiToolDescriptor[];
    artifacts: ArtifactSpec[];
};

// @public (undocumented)
export type ComposeOptions = {
    intro?: string;
    sections?: PromptSection[];
};

// @public
export const createArtifactCollector: (artifacts: ArtifactSpec[], handlers: ArtifactHandlers) => ArtifactCollector;

// @public
export const extendCapability: (capability: AiCapability, extension: {
    sections?: PromptSection[];
    tools?: AiToolDescriptor[];
    artifacts?: ArtifactSpec[];
}) => AiCapability;

// @public
export type PromptSection = {
    id: string;
    title: string;
    body: string;
};

// (No @packageDocumentation comment for this package)

On this page

No Headings