@codesoul-co/hypha-inference / agent-prompts
- Package index:
@codesoul-co/hypha-inference - Source:
packages/inference/src/agent-prompts.ts - Exports: 16
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
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
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
| Symbol | Kind | Signature | Description |
|---|---|---|---|
AgentPromptRegistry | class | new AgentPromptRegistry(): AgentPromptRegistry | Agent Prompt Registry class with 6 public constructor or member entries; its exact declarations are listed below. |
agentPromptRefSchema | constant | 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; }> | Runtime schema for Agent Prompt Ref. |
agentPromptSpecSchema | constant | const 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. |
agentPromptVariableSpecSchema | constant | 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; requi... | Runtime schema for Agent Prompt Variable Spec. |
agentPromptSubjectHash | function | agentPromptSubjectHash(spec: Pick<AgentPromptSpec, "id" | "version" | "revision" | "contentHash">): string | Agent Prompt Subject Hash function with 1 public call signature; parameters and return types are listed below. |
renderAgentPrompt | function | renderAgentPrompt(spec: AgentPromptSpec, variables: Record<string, unknown>): string | Render Agent Prompt function with 1 public call signature; parameters and return types are listed below. |
AgentPromptApproval | interface | interface AgentPromptApproval | Agent Prompt Approval interface with 14 public fields or methods. |
AgentPromptPrincipal | interface | interface AgentPromptPrincipal | Agent Prompt Principal interface with 4 public fields or methods. |
AgentPromptRef | interface | interface AgentPromptRef | Agent Prompt Ref interface with 4 public fields or methods. |
AgentPromptResolution | interface | interface AgentPromptResolution | Agent Prompt Resolution interface with 3 public fields or methods. |
AgentPromptResolutionContext | interface | interface AgentPromptResolutionContext | Agent Prompt Resolution Context interface with 3 public fields or methods. |
AgentPromptSpec | interface | interface AgentPromptSpec | Agent Prompt Spec interface with 19 public fields or methods. |
AgentPromptVariableSpec | interface | interface AgentPromptVariableSpec | Agent Prompt Variable Spec interface with 5 public fields or methods. |
ResolvedAgentPromptBlock | interface | interface ResolvedAgentPromptBlock | Resolved Agent Prompt Block interface with 18 public fields or methods. |
AgentPromptRole | type | type AgentPromptRole = 'system' | 'developer' | Public type alias for Agent Prompt Role; the declaration contains its complete type expression. |
AgentPromptVariableType | type | type 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (): AgentPromptRegistry | Creates an instance of this class. |
get | method | get(id: string, version?: string): AgentPromptSpec | null | Public method; parameters and return type are shown in the signature. |
list | method | list(): AgentPromptSpec[] | Public method; parameters and return type are shown in the signature. |
register | method | register(input: AgentPromptSpec, options?: { replace?: boolean; expectedRevision?: number; }): AgentPromptSpec | Public method; parameters and return type are shown in the signature. |
resolve | method | resolve(refs: AgentPromptRef[], context: AgentPromptResolutionContext): AgentPromptResolution | Public method; parameters and return type are shown in the signature. |
unregister | method | unregister(id: string, version?: string): boolean | Public 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
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
// 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
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
export declare function agentPromptSubjectHash(spec: Pick<AgentPromptSpec, 'id' | 'version' | 'revision' | 'contentHash'>): string;Call signature
agentPromptSubjectHash(spec: Pick<AgentPromptSpec, "id" | "version" | "revision" | "contentHash">): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spec | Pick<AgentPromptSpec, "id" | "version" | "revision" | "contentHash"> | Yes | Required 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
export declare function renderAgentPrompt(spec: AgentPromptSpec, variables: Record<string, unknown>): string;Call signature
renderAgentPrompt(spec: AgentPromptSpec, variables: Record<string, unknown>): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spec | AgentPromptSpec | Yes | Required parameter; accepted values are defined by the type column. |
variables | Record<string, unknown> | Yes | Required 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
agentId | property | agentId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
approvedBy | property | approvedBy: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
contentHash | property | contentHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
domainId | property | domainId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expiresAt | property | expiresAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principalId | property | principalId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
promptId | property | promptId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
promptRevision | property | promptRevision: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
promptVersion | property | promptVersion: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
status | property | status: "approved" | Public property; its type, readonly modifier and optionality are shown in the signature. |
subjectHash | property | subjectHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
subjectType | property | subjectType: "agent_prompt" | Public property; its type, readonly modifier and optionality are shown in the signature. |
taskId | property | taskId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public 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
export interface AgentPromptPrincipal {
principalId: string;
tenantId?: string;
agentId?: string;
domainId?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
agentId | property | agentId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
domainId | property | domainId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principalId | property | principalId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public 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
export interface AgentPromptRef {
id: string;
version?: string;
required?: boolean;
priority?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
priority | property | priority?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
required | property | required?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
version | property | version?: string | Public 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
export interface AgentPromptResolution {
instructions: string;
blocks: ResolvedAgentPromptBlock[];
missing: AgentPromptRef[];
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
blocks | property | blocks: ResolvedAgentPromptBlock[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
instructions | property | instructions: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
missing | property | missing: 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
export interface AgentPromptResolutionContext {
variables: Record<string, unknown>;
principal: AgentPromptPrincipal;
approvals?: AgentPromptApproval[];
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
approvals | property | approvals?: AgentPromptApproval[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal: AgentPromptPrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
variables | property | variables: 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
agentIds | property | agentIds?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
cacheable | property | cacheable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
contentHash | property | contentHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
description | property | description?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
domainIds | property | domainIds?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ownerId | property | ownerId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
provenance | property | provenance?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
revision | property | revision?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
role | property | role: AgentPromptRole | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope?: "tenant" | "owner" | "global" | Public property; its type, readonly modifier and optionality are shown in the signature. |
stable | property | stable?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
template | property | template: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
trustLevel | property | trustLevel?: "trusted" | "reviewed" | "untrusted" | Public property; its type, readonly modifier and optionality are shown in the signature. |
variables | property | variables?: AgentPromptVariableSpec[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
version | property | version: string | Public 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
export interface AgentPromptVariableSpec {
name: string;
type: AgentPromptVariableType;
required?: boolean;
default?: unknown;
description?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
default | property | default?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
description | property | description?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
required | property | required?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
type | property | type: AgentPromptVariableType | Public 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
cacheable | property | cacheable: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
content | property | content: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
hash | property | hash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
order | property | order: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
ownerId | property | ownerId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
provenance | property | provenance?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
role | property | role: AgentPromptRole | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: "tenant" | "owner" | "global" | Public property; its type, readonly modifier and optionality are shown in the signature. |
stable | property | stable: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
templateContentHash | property | templateContentHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
templateId | property | templateId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
templateRevision | property | templateRevision: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
templateVersion | property | templateVersion: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
trustLevel | property | trustLevel: "trusted" | "reviewed" | "untrusted" | Public property; its type, readonly modifier and optionality are shown in the signature. |
type | property | type: "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
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
export type AgentPromptVariableType = 'string' | 'number' | 'boolean' | 'array' | 'object';