@codesoul-co/hypha-inference / prompt-profile
- Package index:
@codesoul-co/hypha-inference - Source:
packages/inference/src/prompt-profile.ts - Exports: 15
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
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
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
| Symbol | Kind | Signature | Description |
|---|---|---|---|
PromptProfileRegistry | class | new PromptProfileRegistry(options?: PromptProfileRegistryOptions): 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. |
PROMPT_PROFILE_SOURCES | constant | const PROMPT_PROFILE_SOURCES: readonly ["system", "developer", "domain", "skill", "mcp", "user"] | PROMPT PROFILE SOURCES constant exported by the prompt-profile module. |
PROMPT_PROFILE_STATUSES | constant | const PROMPT_PROFILE_STATUSES: readonly ["draft", "in_review", "active", "deprecated"] | PROMPT PROFILE STATUSES constant exported by the prompt-profile module. |
promptProfileInputSchema | constant | const 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. |
PromptProfile | interface | interface PromptProfile extends PromptProfileInput | Prompt Profile interface with 31 public fields or methods. |
PromptProfileArtifactPort | interface | interface PromptProfileArtifactPort | Prompt Profile Artifact Port interface with 1 public fields or methods. |
PromptProfileInput | interface | interface PromptProfileInput | Prompt Profile Input interface with 19 public fields or methods. |
PromptProfileLayer | interface | interface PromptProfileLayer | Prompt Profile Layer interface with 7 public fields or methods. |
PromptProfilePrincipal | interface | interface PromptProfilePrincipal | Prompt Profile Principal interface with 7 public fields or methods. |
PromptProfileRef | interface | interface PromptProfileRef | Prompt Profile Ref interface with 3 public fields or methods. |
PromptProfileRegistryOptions | interface | interface PromptProfileRegistryOptions | Prompt Profile Registry Options interface with 3 public fields or methods. |
PromptProfileResolution | interface | interface PromptProfileResolution | Prompt Profile Resolution interface with 6 public fields or methods. |
PromptProfileTraceSink | interface | interface PromptProfileTraceSink | Prompt Profile Trace Sink interface with 1 public fields or methods. |
PromptProfileSource | type | type PromptProfileSource = (typeof PROMPT_PROFILE_SOURCES)[number] | Public type alias for Prompt Profile Source; the declaration contains its complete type expression. |
PromptProfileStatus | type | type 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
activate | method | activate(ref: Required<PromptProfileRef>, input: { expectedLifecycleRevision: number; activatedBy: string; }): PromptProfile | Public method; parameters and return type are shown in the signature. |
clear | method | clear(): void | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options?: PromptProfileRegistryOptions): PromptProfileRegistry | Creates an instance of this class. |
create | method | create(input: PromptProfileInput): PromptProfile | Public method; parameters and return type are shown in the signature. |
deprecate | method | deprecate(ref: Required<PromptProfileRef>, input: { expectedLifecycleRevision: number; deprecatedBy: string; }): PromptProfile | Public method; parameters and return type are shown in the signature. |
get | method | get(ref: PromptProfileRef): PromptProfile | null | Public method; parameters and return type are shown in the signature. |
list | method | list(id?: string, version?: string): PromptProfile[] | Public method; parameters and return type are shown in the signature. |
resolve | method | resolve(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. |
restore | method | restore(input: PromptProfile): PromptProfile | Public method; parameters and return type are shown in the signature. |
submitForReview | method | submitForReview(ref: Required<PromptProfileRef>, input: { expectedLifecycleRevision: number; reviewedBy: string; }): PromptProfile | Public 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
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
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
// 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
activatedAt | property | activatedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
activatedBy | property | activatedBy?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
agentIds | property | agentIds?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
approvalExpiresAt | property | approvalExpiresAt?: 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. |
createdAt | property | createdAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
dependencySnapshotHash | property | dependencySnapshotHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
deprecatedAt | property | deprecatedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
deprecatedBy | property | deprecatedBy?: 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. |
layers | property | layers: PromptProfileLayer[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
lifecycleRevision | property | lifecycleRevision: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxInlineBytes | property | maxInlineBytes?: number | 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. |
policyRevision | property | policyRevision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reviewedAt | property | reviewedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reviewedBy | property | reviewedBy?: string | 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. |
runId | property | runId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope?: "domain" | "session" | "run" | "agent" | "user" | "tenant" | "owner" | "global" | Public property; its type, readonly modifier and optionality are shown in the signature. |
sessionId | property | sessionId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
status | property | status: "draft" | "active" | "in_review" | "deprecated" | 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. |
updatedAt | property | updatedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
userId | property | userId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
variableNames | property | variableNames?: string[] | 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. |
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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
store | method | 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; }> | 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
agentIds | property | agentIds?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
approvalExpiresAt | property | approvalExpiresAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
dependencySnapshotHash | property | dependencySnapshotHash?: 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. |
layers | property | layers: PromptProfileLayer[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxInlineBytes | property | maxInlineBytes?: number | 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. |
policyRevision | property | policyRevision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
runId | property | runId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope?: "domain" | "session" | "run" | "agent" | "user" | "tenant" | "owner" | "global" | Public property; its type, readonly modifier and optionality are shown in the signature. |
sessionId | property | sessionId?: 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. |
userId | property | userId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
variableNames | property | variableNames?: string[] | 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. |
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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
content | property | content: 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. |
priority | property | priority?: number | 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. |
source | property | source: "skill" | "domain" | "mcp" | "system" | "user" | "developer" | 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. |
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
export interface PromptProfilePrincipal {
principalId: string;
tenantId?: string;
userId?: string;
agentId?: string;
domainId?: string;
sessionId?: string;
runId?: 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. |
runId | property | runId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
sessionId | property | sessionId?: 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. |
userId | property | userId?: string | Public 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
export interface PromptProfileRef {
id: string;
version?: string;
revision?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
id | property | id: string | 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. |
version | property | version?: string | Public 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
export interface PromptProfileRegistryOptions {
now?: () => string;
artifacts?: PromptProfileArtifactPort;
trace?: PromptProfileTraceSink;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifacts | property | artifacts?: PromptProfileArtifactPort | Public property; its type, readonly modifier and optionality are shown in the signature. |
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
trace | property | trace?: PromptProfileTraceSink | Public 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
export interface PromptProfileResolution {
profileRef: Required<PromptProfileRef>;
profileHash: string;
messages: PromptMessage[];
sizeBytes: number;
cacheHit: boolean;
artifactRef?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactRef | property | artifactRef?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
cacheHit | property | cacheHit: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
messages | property | messages: PromptMessage[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileHash | property | profileHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRef | property | profileRef: Required<PromptProfileRef> | Public property; its type, readonly modifier and optionality are shown in the signature. |
sizeBytes | property | sizeBytes: number | Public 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
record | method | 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 | Public 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
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
export type PromptProfileStatus = (typeof PROMPT_PROFILE_STATUSES)[number];