Skip to content

@codesoul-co/hypha-inference / agent-prompts

Using this module

Use the Agent prompts module for using the public contracts and operations for this capability boundary. It exports 1 class, 3 constants, 2 functions, 8 interfaces, 2 types.

Import from the package entrypoint

ts
import {
  AgentPromptRegistry,
  agentPromptRefSchema,
  agentPromptSpecSchema,
  agentPromptVariableSpecSchema,
  agentPromptSubjectHash,
  renderAgentPrompt,
} from '@codesoul-co/hypha-inference';

import type {
  AgentPromptApproval,
  AgentPromptPrincipal,
  AgentPromptRef,
  AgentPromptResolution,
  AgentPromptResolutionContext,
  AgentPromptSpec,
  AgentPromptVariableSpec,
  ResolvedAgentPromptBlock,
} from '@codesoul-co/hypha-inference';

// The complete export list is documented below.

Usage patterns

  • Use the 10 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 2 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
  • The 3 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Runtime validation example

ts
import { agentPromptRefSchema } from '@codesoul-co/hypha-inference';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = agentPromptRefSchema.parse(input);

Parse untrusted configuration, network, or persisted input with the runtime schema before passing it to functions or classes that expect a validated contract.

Public exports

SymbolKindSignatureDescription
AgentPromptRegistryclassnew AgentPromptRegistry(): AgentPromptRegistryAgent Prompt Registry class with 6 public constructor or member entries; its exact declarations are listed below.
agentPromptRefSchemaconstantconst agentPromptRefSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; required: z.ZodOptional<z.ZodBoolean>; priority: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { id: string; version?: string | undefined; priority?: number | undefined; required?: boolean | undefined; }, { id: string; version?: string | undefined; priority?: number | undefined; required?: boolean | undefined; }>Runtime schema for Agent Prompt Ref.
agentPromptSpecSchemaconstantconst agentPromptSpecSchema: z.ZodEffects<z.ZodObject<{ id: z.ZodString; version: z.ZodString; name: z.ZodString; description: z.ZodOptional<z.ZodString>; role: z.ZodEnum<["system", "developer"]>; template: z.ZodString; variables: z.ZodOptional<z.ZodArray<z.ZodObject<{ name: z.ZodString; type: z.ZodEnum<["string", "number", "boolean", "array", "object"]>; required: z.ZodOptional<z.ZodBoolean>; default: z.ZodOption...Runtime schema for Agent Prompt Spec.
agentPromptVariableSpecSchemaconstantconst agentPromptVariableSpecSchema: z.ZodObject<{ name: z.ZodString; type: z.ZodEnum<["string", "number", "boolean", "array", "object"]>; required: z.ZodOptional<z.ZodBoolean>; default: z.ZodOptional<z.ZodUnknown>; description: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { name: string; type: "string" | "number" | "boolean" | "object" | "array"; description?: string | undefined; default?: unknown; requi...Runtime schema for Agent Prompt Variable Spec.
agentPromptSubjectHashfunctionagentPromptSubjectHash(spec: Pick<AgentPromptSpec, "id" | "version" | "revision" | "contentHash">): stringAgent Prompt Subject Hash function with 1 public call signature; parameters and return types are listed below.
renderAgentPromptfunctionrenderAgentPrompt(spec: AgentPromptSpec, variables: Record<string, unknown>): stringRender Agent Prompt function with 1 public call signature; parameters and return types are listed below.
AgentPromptApprovalinterfaceinterface AgentPromptApprovalAgent Prompt Approval interface with 14 public fields or methods.
AgentPromptPrincipalinterfaceinterface AgentPromptPrincipalAgent Prompt Principal interface with 4 public fields or methods.
AgentPromptRefinterfaceinterface AgentPromptRefAgent Prompt Ref interface with 4 public fields or methods.
AgentPromptResolutioninterfaceinterface AgentPromptResolutionAgent Prompt Resolution interface with 3 public fields or methods.
AgentPromptResolutionContextinterfaceinterface AgentPromptResolutionContextAgent Prompt Resolution Context interface with 3 public fields or methods.
AgentPromptSpecinterfaceinterface AgentPromptSpecAgent Prompt Spec interface with 19 public fields or methods.
AgentPromptVariableSpecinterfaceinterface AgentPromptVariableSpecAgent Prompt Variable Spec interface with 5 public fields or methods.
ResolvedAgentPromptBlockinterfaceinterface ResolvedAgentPromptBlockResolved Agent Prompt Block interface with 18 public fields or methods.
AgentPromptRoletypetype AgentPromptRole = 'system' | 'developer'Public type alias for Agent Prompt Role; the declaration contains its complete type expression.
AgentPromptVariableTypetypetype AgentPromptVariableType = 'string' | 'number' | 'boolean' | 'array' | 'object'Public type alias for Agent Prompt Variable Type; the declaration contains its complete type expression.

AgentPromptRegistry

Agent Prompt Registry class with 6 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { AgentPromptRegistry } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export declare class AgentPromptRegistry {
    register(input: AgentPromptSpec, options?: {
            replace?: boolean;
            expectedRevision?: number;
        }): AgentPromptSpec;
    unregister(id: string, version?: string): boolean;
    get(id: string, version?: string): AgentPromptSpec | null;
    list(): AgentPromptSpec[];
    resolve(refs: AgentPromptRef[], context: AgentPromptResolutionContext): AgentPromptResolution;
}

Public members

MemberKindSignatureDescription
constructorconstructor(): AgentPromptRegistryCreates an instance of this class.
getmethodget(id: string, version?: string): AgentPromptSpec | nullPublic method; parameters and return type are shown in the signature.
listmethodlist(): AgentPromptSpec[]Public method; parameters and return type are shown in the signature.
registermethodregister(input: AgentPromptSpec, options?: { replace?: boolean; expectedRevision?: number; }): AgentPromptSpecPublic method; parameters and return type are shown in the signature.
resolvemethodresolve(refs: AgentPromptRef[], context: AgentPromptResolutionContext): AgentPromptResolutionPublic method; parameters and return type are shown in the signature.
unregistermethodunregister(id: string, version?: string): booleanPublic method; parameters and return type are shown in the signature.

agentPromptRefSchema

Runtime schema for Agent Prompt Ref.

  • Kind: constant
  • Import: import { agentPromptRefSchema } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export declare const agentPromptRefSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; required: z.ZodOptional<z.ZodBoolean>; priority: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { id: string; version?: string | undefined; priority?: number | undefined; required?: boolean | undefined; }, { id: string; version?: string | undefined; priority?: number | undefined; required?: boolean | undefined; }>;

agentPromptSpecSchema

Runtime schema for Agent Prompt Spec.

  • Kind: constant
  • Import: import { agentPromptSpecSchema } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const agentPromptSpecSchema: (typeof import('@codesoul-co/hypha-inference'))['agentPromptSpecSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

agentPromptVariableSpecSchema

Runtime schema for Agent Prompt Variable Spec.

  • Kind: constant
  • Import: import { agentPromptVariableSpecSchema } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export declare const agentPromptVariableSpecSchema: z.ZodObject<{ name: z.ZodString; type: z.ZodEnum<["string", "number", "boolean", "array", "object"]>; required: z.ZodOptional<z.ZodBoolean>; default: z.ZodOptional<z.ZodUnknown>; description: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { name: string; type: "string" | "number" | "boolean" | "object" | "array"; description?: string | undefined; default?: unknown; required?: boolean | undefined; }, { name: string; type: "string" | "number" | "boolean" | "object" | "array"; description?: string | undefined; default?: unknown; required?: boolean | undefined; }>;

agentPromptSubjectHash

Agent Prompt Subject Hash function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { agentPromptSubjectHash } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export declare function agentPromptSubjectHash(spec: Pick<AgentPromptSpec, 'id' | 'version' | 'revision' | 'contentHash'>): string;

Call signature

text
agentPromptSubjectHash(spec: Pick<AgentPromptSpec, "id" | "version" | "revision" | "contentHash">): string

Parameters

ParameterTypeRequiredDescription
specPick<AgentPromptSpec, "id" | "version" | "revision" | "contentHash">YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: string
  • Description: The return contract is defined by the type shown above.

renderAgentPrompt

Render Agent Prompt function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { renderAgentPrompt } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export declare function renderAgentPrompt(spec: AgentPromptSpec, variables: Record<string, unknown>): string;

Call signature

text
renderAgentPrompt(spec: AgentPromptSpec, variables: Record<string, unknown>): string

Parameters

ParameterTypeRequiredDescription
specAgentPromptSpecYesRequired parameter; accepted values are defined by the type column.
variablesRecord<string, unknown>YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: string
  • Description: The return contract is defined by the type shown above.

AgentPromptApproval

Agent Prompt Approval interface with 14 public fields or methods.

  • Kind: interface
  • Import: import type { AgentPromptApproval } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface AgentPromptApproval {
    taskId: string;
    subjectType: 'agent_prompt';
    subjectHash: string;
    promptId: string;
    promptVersion: string;
    promptRevision: number;
    contentHash: string;
    approvedBy: string;
    principalId?: string;
    tenantId?: string;
    agentId?: string;
    domainId?: string;
    expiresAt?: string;
    status: 'approved';
}

Contract members

MemberKindSignatureDescription
agentIdpropertyagentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
approvedBypropertyapprovedBy: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
contentHashpropertycontentHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
domainIdpropertydomainId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalIdpropertyprincipalId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
promptIdpropertypromptId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
promptRevisionpropertypromptRevision: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
promptVersionpropertypromptVersion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "approved"Public property; its type, readonly modifier and optionality are shown in the signature.
subjectHashpropertysubjectHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
subjectTypepropertysubjectType: "agent_prompt"Public property; its type, readonly modifier and optionality are shown in the signature.
taskIdpropertytaskId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

AgentPromptPrincipal

Agent Prompt Principal interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { AgentPromptPrincipal } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface AgentPromptPrincipal {
    principalId: string;
    tenantId?: string;
    agentId?: string;
    domainId?: string;
}

Contract members

MemberKindSignatureDescription
agentIdpropertyagentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
domainIdpropertydomainId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalIdpropertyprincipalId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

AgentPromptRef

Agent Prompt Ref interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { AgentPromptRef } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface AgentPromptRef {
    id: string;
    version?: string;
    required?: boolean;
    priority?: number;
}

Contract members

MemberKindSignatureDescription
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
prioritypropertypriority?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
requiredpropertyrequired?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

AgentPromptResolution

Agent Prompt Resolution interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { AgentPromptResolution } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface AgentPromptResolution {
    instructions: string;
    blocks: ResolvedAgentPromptBlock[];
    missing: AgentPromptRef[];
}

Contract members

MemberKindSignatureDescription
blockspropertyblocks: ResolvedAgentPromptBlock[]Public property; its type, readonly modifier and optionality are shown in the signature.
instructionspropertyinstructions: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
missingpropertymissing: AgentPromptRef[]Public property; its type, readonly modifier and optionality are shown in the signature.

AgentPromptResolutionContext

Agent Prompt Resolution Context interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { AgentPromptResolutionContext } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface AgentPromptResolutionContext {
    variables: Record<string, unknown>;
    principal: AgentPromptPrincipal;
    approvals?: AgentPromptApproval[];
}

Contract members

MemberKindSignatureDescription
approvalspropertyapprovals?: AgentPromptApproval[]Public property; its type, readonly modifier and optionality are shown in the signature.
principalpropertyprincipal: AgentPromptPrincipalPublic property; its type, readonly modifier and optionality are shown in the signature.
variablespropertyvariables: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.

AgentPromptSpec

Agent Prompt Spec interface with 19 public fields or methods.

  • Kind: interface
  • Import: import type { AgentPromptSpec } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface AgentPromptSpec {
    id: string;
    version: string;
    name: string;
    description?: string;
    role: AgentPromptRole;
    template: string;
    variables?: AgentPromptVariableSpec[];
    stable?: boolean;
    cacheable?: boolean;
    ownerId?: string;
    tenantId?: string;
    scope?: 'global' | 'tenant' | 'owner';
    trustLevel?: 'trusted' | 'reviewed' | 'untrusted';
    agentIds?: string[];
    domainIds?: string[];
    provenance?: Record<string, unknown>;
    revision?: number;
    contentHash?: string;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
agentIdspropertyagentIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
cacheablepropertycacheable?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
contentHashpropertycontentHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
domainIdspropertydomainIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
provenancepropertyprovenance?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
rolepropertyrole: AgentPromptRolePublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope?: "tenant" | "owner" | "global"Public property; its type, readonly modifier and optionality are shown in the signature.
stablepropertystable?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
templatepropertytemplate: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
trustLevelpropertytrustLevel?: "trusted" | "reviewed" | "untrusted"Public property; its type, readonly modifier and optionality are shown in the signature.
variablespropertyvariables?: AgentPromptVariableSpec[]Public property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

AgentPromptVariableSpec

Agent Prompt Variable Spec interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { AgentPromptVariableSpec } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface AgentPromptVariableSpec {
    name: string;
    type: AgentPromptVariableType;
    required?: boolean;
    default?: unknown;
    description?: string;
}

Contract members

MemberKindSignatureDescription
defaultpropertydefault?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requiredpropertyrequired?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: AgentPromptVariableTypePublic property; its type, readonly modifier and optionality are shown in the signature.

ResolvedAgentPromptBlock

Resolved Agent Prompt Block interface with 18 public fields or methods.

  • Kind: interface
  • Import: import type { ResolvedAgentPromptBlock } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export interface ResolvedAgentPromptBlock {
    id: string;
    type: 'prompt-template';
    role: AgentPromptRole;
    content: string;
    hash: string;
    stable: boolean;
    cacheable: boolean;
    order: number;
    templateId: string;
    templateVersion: string;
    templateRevision: number;
    templateContentHash: string;
    scope: 'global' | 'tenant' | 'owner';
    trustLevel: 'trusted' | 'reviewed' | 'untrusted';
    ownerId?: string;
    tenantId?: string;
    provenance?: Record<string, unknown>;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
cacheablepropertycacheable: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
contentpropertycontent: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
hashpropertyhash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
orderpropertyorder: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
provenancepropertyprovenance?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
rolepropertyrole: AgentPromptRolePublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: "tenant" | "owner" | "global"Public property; its type, readonly modifier and optionality are shown in the signature.
stablepropertystable: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
templateContentHashpropertytemplateContentHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
templateIdpropertytemplateId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
templateRevisionpropertytemplateRevision: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
templateVersionpropertytemplateVersion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
trustLevelpropertytrustLevel: "trusted" | "reviewed" | "untrusted"Public property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: "prompt-template"Public property; its type, readonly modifier and optionality are shown in the signature.

AgentPromptRole

Public type alias for Agent Prompt Role; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { AgentPromptRole } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export type AgentPromptRole = 'system' | 'developer';

AgentPromptVariableType

Public type alias for Agent Prompt Variable Type; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { AgentPromptVariableType } from '@codesoul-co/hypha-inference';
  • Source module: agent-prompts

Declaration

text
export type AgentPromptVariableType = 'string' | 'number' | 'boolean' | 'array' | 'object';