Skip to content

@codesoul-co/hypha-inference / prompt-profile

Using this module

Use the Prompt profile module for using the public contracts and operations for this capability boundary. It exports 1 class, 3 constants, 9 interfaces, 2 types.

Import from the package entrypoint

ts
import {
  PromptProfileRegistry,
  PROMPT_PROFILE_SOURCES,
  PROMPT_PROFILE_STATUSES,
  promptProfileInputSchema,
} from '@codesoul-co/hypha-inference';

import type {
  PromptProfile,
  PromptProfileArtifactPort,
  PromptProfileInput,
  PromptProfileLayer,
  PromptProfilePrincipal,
  PromptProfileRef,
  PromptProfileRegistryOptions,
  PromptProfileResolution,
} from '@codesoul-co/hypha-inference';

// The complete export list is documented below.

Usage patterns

  • Use the 11 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 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 { promptProfileInputSchema } from '@codesoul-co/hypha-inference';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = promptProfileInputSchema.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
PromptProfileRegistryclassnew PromptProfileRegistry(options?: PromptProfileRegistryOptions): PromptProfileRegistryImmutable Prompt Profile revisions plus a CAS-protected publication lifecycle. Active revisions are never overwritten, so a Run can safely keep an exact ref.
PROMPT_PROFILE_SOURCESconstantconst PROMPT_PROFILE_SOURCES: readonly ["system", "developer", "domain", "skill", "mcp", "user"]PROMPT PROFILE SOURCES constant exported by the prompt-profile module.
PROMPT_PROFILE_STATUSESconstantconst PROMPT_PROFILE_STATUSES: readonly ["draft", "in_review", "active", "deprecated"]PROMPT PROFILE STATUSES constant exported by the prompt-profile module.
promptProfileInputSchemaconstantconst promptProfileInputSchema: z.ZodEffects<z.ZodObject<{ id: z.ZodString; version: z.ZodString; name: z.ZodString; description: z.ZodOptional<z.ZodString>; layers: z.ZodArray<z.ZodObject<{ id: z.ZodString; source: z.ZodEnum<["system", "developer", "domain", "skill", "mcp", "user"]>; content: z.ZodString; priority: z.ZodOptional<z.ZodNumber>; trustLevel: z.ZodOptional<z.ZodEnum<["trusted", "reviewed", "untrusted"...Runtime schema for Prompt Profile Input.
PromptProfileinterfaceinterface PromptProfile extends PromptProfileInputPrompt Profile interface with 31 public fields or methods.
PromptProfileArtifactPortinterfaceinterface PromptProfileArtifactPortPrompt Profile Artifact Port interface with 1 public fields or methods.
PromptProfileInputinterfaceinterface PromptProfileInputPrompt Profile Input interface with 19 public fields or methods.
PromptProfileLayerinterfaceinterface PromptProfileLayerPrompt Profile Layer interface with 7 public fields or methods.
PromptProfilePrincipalinterfaceinterface PromptProfilePrincipalPrompt Profile Principal interface with 7 public fields or methods.
PromptProfileRefinterfaceinterface PromptProfileRefPrompt Profile Ref interface with 3 public fields or methods.
PromptProfileRegistryOptionsinterfaceinterface PromptProfileRegistryOptionsPrompt Profile Registry Options interface with 3 public fields or methods.
PromptProfileResolutioninterfaceinterface PromptProfileResolutionPrompt Profile Resolution interface with 6 public fields or methods.
PromptProfileTraceSinkinterfaceinterface PromptProfileTraceSinkPrompt Profile Trace Sink interface with 1 public fields or methods.
PromptProfileSourcetypetype PromptProfileSource = (typeof PROMPT_PROFILE_SOURCES)[number]Public type alias for Prompt Profile Source; the declaration contains its complete type expression.
PromptProfileStatustypetype PromptProfileStatus = (typeof PROMPT_PROFILE_STATUSES)[number]Public type alias for Prompt Profile Status; the declaration contains its complete type expression.

PromptProfileRegistry

Immutable Prompt Profile revisions plus a CAS-protected publication lifecycle. Active revisions are never overwritten, so a Run can safely keep an exact ref.

  • Kind: class
  • Import: import { PromptProfileRegistry } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export declare class PromptProfileRegistry {
    constructor(options?: PromptProfileRegistryOptions);
    create(input: PromptProfileInput): PromptProfile;
    restore(input: PromptProfile): PromptProfile;
    submitForReview(ref: Required<PromptProfileRef>, input: {
            expectedLifecycleRevision: number;
            reviewedBy: string;
        }): PromptProfile;
    activate(ref: Required<PromptProfileRef>, input: {
            expectedLifecycleRevision: number;
            activatedBy: string;
        }): PromptProfile;
    deprecate(ref: Required<PromptProfileRef>, input: {
            expectedLifecycleRevision: number;
            deprecatedBy: string;
        }): PromptProfile;
    get(ref: PromptProfileRef): PromptProfile | null;
    list(id?: string, version?: string): PromptProfile[];
    clear(): void;
    resolve(ref: PromptProfileRef, context: {
            variables: Record<string, unknown>;
            principal: PromptProfilePrincipal;
            maxInlineBytes?: number;
            policyRevision?: string;
            dependencySnapshotHash?: string;
        }): Promise<PromptProfileResolution>;
}

Public members

MemberKindSignatureDescription
activatemethodactivate(ref: Required<PromptProfileRef>, input: { expectedLifecycleRevision: number; activatedBy: string; }): PromptProfilePublic method; parameters and return type are shown in the signature.
clearmethodclear(): voidPublic method; parameters and return type are shown in the signature.
constructorconstructor(options?: PromptProfileRegistryOptions): PromptProfileRegistryCreates an instance of this class.
createmethodcreate(input: PromptProfileInput): PromptProfilePublic method; parameters and return type are shown in the signature.
deprecatemethoddeprecate(ref: Required<PromptProfileRef>, input: { expectedLifecycleRevision: number; deprecatedBy: string; }): PromptProfilePublic method; parameters and return type are shown in the signature.
getmethodget(ref: PromptProfileRef): PromptProfile | nullPublic method; parameters and return type are shown in the signature.
listmethodlist(id?: string, version?: string): PromptProfile[]Public method; parameters and return type are shown in the signature.
resolvemethodresolve(ref: PromptProfileRef, context: { variables: Record<string, unknown>; principal: PromptProfilePrincipal; maxInlineBytes?: number; policyRevision?: string; dependencySnapshotHash?: string; }): Promise<PromptProfileResolution>Public method; parameters and return type are shown in the signature.
restoremethodrestore(input: PromptProfile): PromptProfilePublic method; parameters and return type are shown in the signature.
submitForReviewmethodsubmitForReview(ref: Required<PromptProfileRef>, input: { expectedLifecycleRevision: number; reviewedBy: string; }): PromptProfilePublic method; parameters and return type are shown in the signature.

PROMPT_PROFILE_SOURCES

PROMPT PROFILE SOURCES constant exported by the prompt-profile module.

  • Kind: constant
  • Import: import { PROMPT_PROFILE_SOURCES } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export declare const PROMPT_PROFILE_SOURCES: readonly ["system", "developer", "domain", "skill", "mcp", "user"];

PROMPT_PROFILE_STATUSES

PROMPT PROFILE STATUSES constant exported by the prompt-profile module.

  • Kind: constant
  • Import: import { PROMPT_PROFILE_STATUSES } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export declare const PROMPT_PROFILE_STATUSES: readonly ["draft", "in_review", "active", "deprecated"];

promptProfileInputSchema

Runtime schema for Prompt Profile Input.

  • Kind: constant
  • Import: import { promptProfileInputSchema } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

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

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.

PromptProfile

Prompt Profile interface with 31 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfile } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfile extends PromptProfileInput {
    revision: number;
    lifecycleRevision: number;
    status: PromptProfileStatus;
    contentHash: string;
    createdAt: string;
    updatedAt: string;
    reviewedBy?: string;
    reviewedAt?: string;
    activatedBy?: string;
    activatedAt?: string;
    deprecatedBy?: string;
    deprecatedAt?: string;
}

Contract members

MemberKindSignatureDescription
activatedAtpropertyactivatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
activatedBypropertyactivatedBy?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
agentIdspropertyagentIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
approvalExpiresAtpropertyapprovalExpiresAt?: 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.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
dependencySnapshotHashpropertydependencySnapshotHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
deprecatedAtpropertydeprecatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
deprecatedBypropertydeprecatedBy?: 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.
layerspropertylayers: PromptProfileLayer[]Public property; its type, readonly modifier and optionality are shown in the signature.
lifecycleRevisionpropertylifecycleRevision: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxInlineBytespropertymaxInlineBytes?: numberPublic 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.
policyRevisionpropertypolicyRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reviewedAtpropertyreviewedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reviewedBypropertyreviewedBy?: stringPublic 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.
runIdpropertyrunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope?: "domain" | "session" | "run" | "agent" | "user" | "tenant" | "owner" | "global"Public property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "draft" | "active" | "in_review" | "deprecated"Public 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.
updatedAtpropertyupdatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
variableNamespropertyvariableNames?: string[]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.

PromptProfileArtifactPort

Prompt Profile Artifact Port interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfileArtifactPort } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfileArtifactPort {
    store(input: {
        profile: Pick<PromptProfile, 'id' | 'version' | 'revision' | 'contentHash'>;
        bytes: Uint8Array;
        contentHash: string;
        mediaType: 'application/json';
        metadata: Record<string, unknown>;
    }): Promise<{
        artifactRef: string;
        contentHash: string;
        sizeBytes: number;
    }>;
}

Contract members

MemberKindSignatureDescription
storemethodstore(input: { profile: Pick<PromptProfile, "id" | "version" | "revision" | "contentHash">; bytes: Uint8Array; contentHash: string; mediaType: "application/json"; metadata: Record<string, unknown>; }): Promise<{ artifactRef: string; contentHash: string; sizeBytes: number; }>Public method; parameters and return type are shown in the signature.

PromptProfileInput

Prompt Profile Input interface with 19 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfileInput } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfileInput {
    id: string;
    version: string;
    name: string;
    description?: string;
    layers: PromptProfileLayer[];
    variableNames?: string[];
    scope?: 'global' | 'tenant' | 'owner' | 'user' | 'agent' | 'domain' | 'session' | 'run';
    tenantId?: string;
    ownerId?: string;
    userId?: string;
    sessionId?: string;
    runId?: string;
    agentIds?: string[];
    domainIds?: string[];
    policyRevision?: string;
    dependencySnapshotHash?: string;
    approvalExpiresAt?: string;
    maxInlineBytes?: number;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
agentIdspropertyagentIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
approvalExpiresAtpropertyapprovalExpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
dependencySnapshotHashpropertydependencySnapshotHash?: 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.
layerspropertylayers: PromptProfileLayer[]Public property; its type, readonly modifier and optionality are shown in the signature.
maxInlineBytespropertymaxInlineBytes?: numberPublic 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.
policyRevisionpropertypolicyRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope?: "domain" | "session" | "run" | "agent" | "user" | "tenant" | "owner" | "global"Public property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId?: 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.
userIdpropertyuserId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
variableNamespropertyvariableNames?: string[]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.

PromptProfileLayer

Prompt Profile Layer interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfileLayer } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfileLayer {
    id: string;
    source: PromptProfileSource;
    content: string;
    priority?: number;
    trustLevel?: 'trusted' | 'reviewed' | 'untrusted';
    provenance?: Record<string, unknown>;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
contentpropertycontent: 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.
prioritypropertypriority?: numberPublic 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.
sourcepropertysource: "skill" | "domain" | "mcp" | "system" | "user" | "developer"Public 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.

PromptProfilePrincipal

Prompt Profile Principal interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfilePrincipal } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfilePrincipal {
    principalId: string;
    tenantId?: string;
    userId?: string;
    agentId?: string;
    domainId?: string;
    sessionId?: string;
    runId?: 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.
runIdpropertyrunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId?: 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.
userIdpropertyuserId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

PromptProfileRef

Prompt Profile Ref interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfileRef } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfileRef {
    id: string;
    version?: string;
    revision?: number;
}

Contract members

MemberKindSignatureDescription
idpropertyid: stringPublic 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.
versionpropertyversion?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

PromptProfileRegistryOptions

Prompt Profile Registry Options interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfileRegistryOptions } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfileRegistryOptions {
    now?: () => string;
    artifacts?: PromptProfileArtifactPort;
    trace?: PromptProfileTraceSink;
}

Contract members

MemberKindSignatureDescription
artifactspropertyartifacts?: PromptProfileArtifactPortPublic property; its type, readonly modifier and optionality are shown in the signature.
nowmethodnow?(): stringPublic method; parameters and return type are shown in the signature.
tracepropertytrace?: PromptProfileTraceSinkPublic property; its type, readonly modifier and optionality are shown in the signature.

PromptProfileResolution

Prompt Profile Resolution interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfileResolution } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfileResolution {
    profileRef: Required<PromptProfileRef>;
    profileHash: string;
    messages: PromptMessage[];
    sizeBytes: number;
    cacheHit: boolean;
    artifactRef?: string;
}

Contract members

MemberKindSignatureDescription
artifactRefpropertyartifactRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
cacheHitpropertycacheHit: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
messagespropertymessages: PromptMessage[]Public property; its type, readonly modifier and optionality are shown in the signature.
profileHashpropertyprofileHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRefpropertyprofileRef: Required<PromptProfileRef>Public property; its type, readonly modifier and optionality are shown in the signature.
sizeBytespropertysizeBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

PromptProfileTraceSink

Prompt Profile Trace Sink interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { PromptProfileTraceSink } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export interface PromptProfileTraceSink {
    record(event: {
        type: 'prompt.profile.resolved' | 'prompt.profile.cache_hit' | 'prompt.profile.externalized';
        profileId: string;
        version: string;
        revision: number;
        contentHash: string;
        principalScopeHash: string;
        sizeBytes: number;
        timestamp: string;
    }): Promise<void> | void;
}

Contract members

MemberKindSignatureDescription
recordmethodrecord(event: { type: "prompt.profile.resolved" | "prompt.profile.cache_hit" | "prompt.profile.externalized"; profileId: string; version: string; revision: number; contentHash: string; principalScopeHash: string; sizeBytes: number; timestamp: string; }): Promise<void> | voidPublic method; parameters and return type are shown in the signature.

PromptProfileSource

Public type alias for Prompt Profile Source; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { PromptProfileSource } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export type PromptProfileSource = (typeof PROMPT_PROFILE_SOURCES)[number];

PromptProfileStatus

Public type alias for Prompt Profile Status; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { PromptProfileStatus } from '@codesoul-co/hypha-inference';
  • Source module: prompt-profile

Declaration

text
export type PromptProfileStatus = (typeof PROMPT_PROFILE_STATUSES)[number];