@codesoul-co/hypha-memory / context-contracts
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/context-contracts.ts - Exports: 29
Using this module
Use the Context contracts module for declaring and runtime-validating contracts. It exports 28 interfaces, 1 type.
Import from the package entrypoint
import type {
ContextBudgetPlan,
ContextBuildExplanation,
ContextBuildInput,
ContextBuildRequest,
ContextBundle,
ContextCompactionPolicySpec,
ContextConflict,
ContextEnvelope,
} from '@codesoul-co/hypha-memory';
// The complete export list is documented below.Usage patterns
- Use the 29 type/interface exports as static contracts in application code, adapters, or tests. Import them with
import type; they do not exist at runtime.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
ContextBudgetPlan | interface | interface ContextBudgetPlan | Context Budget Plan interface with 6 public fields or methods. |
ContextBuildExplanation | interface | interface ContextBuildExplanation | Context Build Explanation interface with 6 public fields or methods. |
ContextBuildInput | interface | interface ContextBuildInput extends ContextBuildRequest | Context Build Input interface with 20 public fields or methods. |
ContextBuildRequest | interface | interface ContextBuildRequest | Context Build Request interface with 17 public fields or methods. |
ContextBundle | interface | interface ContextBundle | Context Bundle interface with 16 public fields or methods. |
ContextCompactionPolicySpec | interface | interface ContextCompactionPolicySpec | Context Compaction Policy Spec interface with 6 public fields or methods. |
ContextConflict | interface | interface ContextConflict | Context Conflict interface with 3 public fields or methods. |
ContextEnvelope | interface | interface ContextEnvelope | Context Envelope interface with 17 public fields or methods. |
ContextInjectionGateway | interface | interface ContextInjectionGateway | Context Injection Gateway interface with 1 public fields or methods. |
ContextItem | interface | interface ContextItem | Context Item interface with 14 public fields or methods. |
ContextItemPolicyDecision | interface | interface ContextItemPolicyDecision | Context Item Policy Decision interface with 2 public fields or methods. |
ContextItemPolicyEvaluator | interface | interface ContextItemPolicyEvaluator | Context Item Policy Evaluator interface with 1 public fields or methods. |
ContextItemPolicyInput | interface | interface ContextItemPolicyInput | Context Item Policy Input interface with 5 public fields or methods. |
ContextProfileSpec | interface | interface ContextProfileSpec | Context Profile Spec interface with 23 public fields or methods. |
ContextProvenanceLabel | interface | interface ContextProvenanceLabel | Context Provenance Label interface with 7 public fields or methods. |
ContextRankingPolicySpec | interface | interface ContextRankingPolicySpec | Context Ranking Policy Spec interface with 8 public fields or methods. |
ContextRejectedItem | interface | interface ContextRejectedItem | Context Rejected Item interface with 2 public fields or methods. |
ContextSourceBudget | interface | interface ContextSourceBudget | Context Source Budget interface with 6 public fields or methods. |
ContextSourceResolutionInput | interface | interface ContextSourceResolutionInput extends ResolvedContextBuildInput | Context Source Resolution Input interface with 20 public fields or methods. |
ContextSourceResolver | interface | interface ContextSourceResolver | Context Source Resolver interface with 3 public fields or methods. |
ContextSourceResolverRegistry | interface | interface ContextSourceResolverRegistry | Context Source Resolver Registry interface with 1 public fields or methods. |
ContextSourceSpec | interface | interface ContextSourceSpec | Context Source Spec interface with 9 public fields or methods. |
ContextTruncationPolicySpec | interface | interface ContextTruncationPolicySpec | Context Truncation Policy Spec interface with 5 public fields or methods. |
ContextTruncationRecord | interface | interface ContextTruncationRecord | Context Truncation Record interface with 5 public fields or methods. |
MemoryContextBuilder | interface | interface MemoryContextBuilder | Memory Context Builder interface with 2 public fields or methods. |
PromptSegment | interface | interface PromptSegment | Prompt Segment interface with 8 public fields or methods. |
ResolvedContextBuildInput | interface | interface ResolvedContextBuildInput extends ContextBuildRequest | Resolved Context Build Input interface with 19 public fields or methods. |
TokenEstimator | interface | interface TokenEstimator | Token Estimator interface with 2 public fields or methods. |
ContextSourceType | type | type ContextSourceType = 'system' | 'workflow_state' | 'messages' | 'working_memory' | 'long_term_memory' | 'tool_observation' | 'artifact' | 'human_review' | 'custom' | Public type alias for Context Source Type; the declaration contains its complete type expression. |
ContextBudgetPlan
Context Budget Plan interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { ContextBudgetPlan } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextBudgetPlan {
totalAvailableTokens: number;
fixedTokens: number;
dynamicTokens: number;
sourceBudgets: ContextSourceBudget[];
tokenizerRef: MemoryContractSpecRef;
safetyMarginTokens: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
dynamicTokens | property | dynamicTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
fixedTokens | property | fixedTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
safetyMarginTokens | property | safetyMarginTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceBudgets | property | sourceBudgets: ContextSourceBudget[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
tokenizerRef | property | tokenizerRef: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
totalAvailableTokens | property | totalAvailableTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextBuildExplanation
Context Build Explanation interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { ContextBuildExplanation } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextBuildExplanation {
contextHash: string;
selectedItemIds: string[];
omittedItemIds: string[];
rejectedItems: ContextRejectedItem[];
ranking: Array<{
itemId: string;
score: number;
reasons: string[];
}>;
budgetPlan: ContextBudgetPlan;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
budgetPlan | property | budgetPlan: ContextBudgetPlan | Public property; its type, readonly modifier and optionality are shown in the signature. |
contextHash | property | contextHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
omittedItemIds | property | omittedItemIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
ranking | property | ranking: { itemId: string; score: number; reasons: string[]; }[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
rejectedItems | property | rejectedItems: ContextRejectedItem[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
selectedItemIds | property | selectedItemIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextBuildInput
Context Build Input interface with 20 public fields or methods.
- Kind: interface
- Import:
import type { ContextBuildInput } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextBuildInput extends ContextBuildRequest {
profile: ContextProfileSpec;
sourceItems: ContextItem[];
tokenizerRef?: MemoryContractSpecRef;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
explicitSourceRefs | property | explicitSourceRefs?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageCursor | property | messageCursor?: 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. |
modelContextWindowTokens | property | modelContextWindowTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
previousContextHash | property | previousContextHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal: MemoryPrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
profile | property | profile: ContextProfileSpec | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRef | property | profileRef: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
query | property | query?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedInstructionTokens | property | reservedInstructionTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedOutputTokens | property | reservedOutputTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedSystemTokens | property | reservedSystemTokens: 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. |
runtimeStateRef | property | runtimeStateRef?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: ManagedMemoryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceItems | property | sourceItems: ContextItem[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
stateId | property | stateId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stepId | property | stepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tokenizerRef | property | tokenizerRef?: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextBuildRequest
Context Build Request interface with 17 public fields or methods.
- Kind: interface
- Import:
import type { ContextBuildRequest } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextBuildRequest {
operationId: string;
principal: MemoryPrincipal;
scope: ManagedMemoryScope;
runId: string;
stepId?: string;
stateId?: string;
profileRef: MemoryContractSpecRef;
modelContextWindowTokens: number;
reservedSystemTokens: number;
reservedInstructionTokens: number;
reservedOutputTokens: number;
runtimeStateRef?: string;
messageCursor?: string;
explicitSourceRefs?: string[];
query?: string;
previousContextHash?: string;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
explicitSourceRefs | property | explicitSourceRefs?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageCursor | property | messageCursor?: 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. |
modelContextWindowTokens | property | modelContextWindowTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
previousContextHash | property | previousContextHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal: MemoryPrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRef | property | profileRef: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
query | property | query?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedInstructionTokens | property | reservedInstructionTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedOutputTokens | property | reservedOutputTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedSystemTokens | property | reservedSystemTokens: 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. |
runtimeStateRef | property | runtimeStateRef?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: ManagedMemoryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
stateId | property | stateId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stepId | property | stepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextBundle
Context Bundle interface with 16 public fields or methods.
- Kind: interface
- Import:
import type { ContextBundle } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextBundle {
id: string;
runId: string;
stepId?: string;
profileRef: MemoryContractSpecRef;
profileRevision: string;
items: ContextItem[];
totalTokens: number;
totalCharacters: number;
omittedItemIds: string[];
rejectedItems: ContextRejectedItem[];
conflicts: ContextConflict[];
sourceHashes: Record<string, string>;
contextHash: string;
createdAt: string;
metadata?: Record<string, unknown>;
artifactRefs?: ContextArtifactRef[];
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactRefs | property | artifactRefs?: ContextArtifactRef[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
conflicts | property | conflicts: ContextConflict[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
contextHash | property | contextHash: 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. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
items | property | items: ContextItem[] | 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. |
omittedItemIds | property | omittedItemIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRef | property | profileRef: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRevision | property | profileRevision: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
rejectedItems | property | rejectedItems: ContextRejectedItem[] | 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. |
sourceHashes | property | sourceHashes: Record<string, string> | Public property; its type, readonly modifier and optionality are shown in the signature. |
stepId | property | stepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
totalCharacters | property | totalCharacters: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
totalTokens | property | totalTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextCompactionPolicySpec
Context Compaction Policy Spec interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { ContextCompactionPolicySpec } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextCompactionPolicySpec {
enabled: boolean;
triggerRatio: number;
summaryProviderRef?: MemoryContractSpecRef;
preserveLastMessages?: number;
persistSummaryAsMemory?: boolean;
summaryMemoryType?: import('./contracts').ManagedMemoryType;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
enabled | property | enabled: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
persistSummaryAsMemory | property | persistSummaryAsMemory?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
preserveLastMessages | property | preserveLastMessages?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
summaryMemoryType | property | summaryMemoryType?: import("/Users/erwin/Downloads/codespace/Hypha/packages/memory/dist/contracts").ManagedMemoryType | Public property; its type, readonly modifier and optionality are shown in the signature. |
summaryProviderRef | property | summaryProviderRef?: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
triggerRatio | property | triggerRatio: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextConflict
Context Conflict interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { ContextConflict } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextConflict {
conflictGroupId: string;
itemIds: string[];
resolution?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
conflictGroupId | property | conflictGroupId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
itemIds | property | itemIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
resolution | property | resolution?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextEnvelope
Context Envelope interface with 17 public fields or methods.
- Kind: interface
- Import:
import type { ContextEnvelope } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextEnvelope {
id: string;
runId: string;
stepId?: string;
contextHash: string;
profileRevision: string;
budgetPlan: ContextBudgetPlan;
systemSegments: PromptSegment[];
instructionSegments: PromptSegment[];
dataSegments: PromptSegment[];
includedSourceRefs: string[];
omittedSourceRefs: string[];
truncationRecords: ContextTruncationRecord[];
provenanceIndex: Record<string, ContextProvenanceLabel>;
conflicts: ContextConflict[];
totalTokens: number;
createdAt: string;
artifactRefs?: ContextArtifactRef[];
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactRefs | property | artifactRefs?: ContextArtifactRef[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
budgetPlan | property | budgetPlan: ContextBudgetPlan | Public property; its type, readonly modifier and optionality are shown in the signature. |
conflicts | property | conflicts: ContextConflict[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
contextHash | property | contextHash: 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. |
dataSegments | property | dataSegments: PromptSegment[] | 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. |
includedSourceRefs | property | includedSourceRefs: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
instructionSegments | property | instructionSegments: PromptSegment[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
omittedSourceRefs | property | omittedSourceRefs: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRevision | property | profileRevision: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
provenanceIndex | property | provenanceIndex: Record<string, ContextProvenanceLabel> | 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. |
stepId | property | stepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
systemSegments | property | systemSegments: PromptSegment[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
totalTokens | property | totalTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
truncationRecords | property | truncationRecords: ContextTruncationRecord[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextInjectionGateway
Context Injection Gateway interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { ContextInjectionGateway } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextInjectionGateway {
buildEnvelope(bundle: ContextBundle, profile: ContextProfileSpec): Promise<ContextEnvelope>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
buildEnvelope | method | buildEnvelope(bundle: ContextBundle, profile: ContextProfileSpec): Promise<ContextEnvelope> | Public method; parameters and return type are shown in the signature. |
ContextItem
Context Item interface with 14 public fields or methods.
- Kind: interface
- Import:
import type { ContextItem } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextItem {
id: string;
sourceType: ContextSourceType;
sourceId?: string;
content: unknown;
text: string;
tokenEstimate: number;
priority: number;
score?: number;
required?: boolean;
untrusted?: boolean;
provenance?: MemoryProvenance | Record<string, unknown>;
conflictGroupId?: string;
metadata?: Record<string, unknown>;
artifactRef?: ContextArtifactRef;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactRef | property | artifactRef?: ContextArtifactRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
conflictGroupId | property | conflictGroupId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
content | property | content: unknown | 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> | MemoryProvenance | 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. |
score | property | score?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceId | property | sourceId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceType | property | sourceType: ContextSourceType | Public property; its type, readonly modifier and optionality are shown in the signature. |
text | property | text: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tokenEstimate | property | tokenEstimate: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
untrusted | property | untrusted?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextItemPolicyDecision
Context Item Policy Decision interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { ContextItemPolicyDecision } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextItemPolicyDecision {
allowed: boolean;
reason?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
allowed | property | allowed: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
reason | property | reason?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextItemPolicyEvaluator
Context Item Policy Evaluator interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { ContextItemPolicyEvaluator } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextItemPolicyEvaluator {
evaluate(input: ContextItemPolicyInput): Promise<ContextItemPolicyDecision>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
evaluate | method | evaluate(input: ContextItemPolicyInput): Promise<ContextItemPolicyDecision> | Public method; parameters and return type are shown in the signature. |
ContextItemPolicyInput
Context Item Policy Input interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { ContextItemPolicyInput } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextItemPolicyInput {
operationId: string;
principal: MemoryPrincipal;
scope: ManagedMemoryScope;
profileRef: MemoryContractSpecRef;
item: ContextItem;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
item | property | item: ContextItem | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal: MemoryPrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRef | property | profileRef: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: ManagedMemoryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextProfileSpec
Context Profile Spec interface with 23 public fields or methods.
- Kind: interface
- Import:
import type { ContextProfileSpec } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextProfileSpec {
id: string;
version: string;
revision?: string;
name?: string;
description?: string;
sources: ContextSourceSpec[];
maxItems?: number;
maxCharacters?: number;
maxSerializedBytes?: number;
maxTokens: number;
reservedOutputTokens?: number;
reservedSystemTokens?: number;
deduplication: 'none' | 'id' | 'hash' | 'semantic';
semanticDedupThreshold?: number;
ranking: ContextRankingPolicySpec;
truncation: ContextTruncationPolicySpec;
conflictPolicy?: 'include_marked' | 'prefer_latest' | 'prefer_verified';
includeProvenance: boolean;
includeScores?: boolean;
instructionBoundary: 'strict' | 'tagged' | 'quoted';
untrustedContentPolicy: 'escape' | 'tag' | 'reject';
compactionPolicy?: ContextCompactionPolicySpec;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
compactionPolicy | property | compactionPolicy?: ContextCompactionPolicySpec | Public property; its type, readonly modifier and optionality are shown in the signature. |
conflictPolicy | property | conflictPolicy?: "include_marked" | "prefer_latest" | "prefer_verified" | Public property; its type, readonly modifier and optionality are shown in the signature. |
deduplication | property | deduplication: "none" | "id" | "semantic" | "hash" | 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. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
includeProvenance | property | includeProvenance: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
includeScores | property | includeScores?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
instructionBoundary | property | instructionBoundary: "strict" | "tagged" | "quoted" | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxCharacters | property | maxCharacters?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxItems | property | maxItems?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxSerializedBytes | property | maxSerializedBytes?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxTokens | property | maxTokens: 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. |
ranking | property | ranking: ContextRankingPolicySpec | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedOutputTokens | property | reservedOutputTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedSystemTokens | property | reservedSystemTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
revision | property | revision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
semanticDedupThreshold | property | semanticDedupThreshold?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
sources | property | sources: ContextSourceSpec[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
truncation | property | truncation: ContextTruncationPolicySpec | Public property; its type, readonly modifier and optionality are shown in the signature. |
untrustedContentPolicy | property | untrustedContentPolicy: "reject" | "escape" | "tag" | 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. |
ContextProvenanceLabel
Context Provenance Label interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { ContextProvenanceLabel } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextProvenanceLabel {
sourceType: ContextSourceType;
sourceId: string;
memoryId?: string;
memoryVersionId?: string;
authority?: 'unverified' | 'user_asserted' | 'system_observed' | 'verified' | 'authoritative';
observedAt?: string;
citationLabel: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
authority | property | authority?: "verified" | "unverified" | "user_asserted" | "system_observed" | "authoritative" | Public property; its type, readonly modifier and optionality are shown in the signature. |
citationLabel | property | citationLabel: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
memoryId | property | memoryId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
memoryVersionId | property | memoryVersionId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
observedAt | property | observedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceId | property | sourceId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceType | property | sourceType: ContextSourceType | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextRankingPolicySpec
Context Ranking Policy Spec interface with 8 public fields or methods.
- Kind: interface
- Import:
import type { ContextRankingPolicySpec } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextRankingPolicySpec {
method: 'priority' | 'score_fusion' | 'reranker' | 'custom';
recencyWeight?: number;
relevanceWeight?: number;
importanceWeight?: number;
confidenceWeight?: number;
provenanceWeight?: number;
sourceWeights?: Record<string, number>;
rerankerProviderRef?: MemoryContractSpecRef;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
confidenceWeight | property | confidenceWeight?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
importanceWeight | property | importanceWeight?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
method | property | method: "custom" | "priority" | "score_fusion" | "reranker" | Public property; its type, readonly modifier and optionality are shown in the signature. |
provenanceWeight | property | provenanceWeight?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
recencyWeight | property | recencyWeight?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
relevanceWeight | property | relevanceWeight?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
rerankerProviderRef | property | rerankerProviderRef?: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceWeights | property | sourceWeights?: Record<string, number> | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextRejectedItem
Context Rejected Item interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { ContextRejectedItem } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextRejectedItem {
itemId: string;
reason: 'scope_denied' | 'policy_denied' | 'invalid_status' | 'duplicate' | 'budget_exceeded' | 'untrusted_rejected' | 'invalid_input';
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
itemId | property | itemId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reason | property | reason: "policy_denied" | "duplicate" | "scope_denied" | "invalid_status" | "budget_exceeded" | "untrusted_rejected" | "invalid_input" | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextSourceBudget
Context Source Budget interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { ContextSourceBudget } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextSourceBudget {
sourceId: string;
minTokens?: number;
targetTokens?: number;
maxTokens: number;
required: boolean;
overflowPolicy: 'drop' | 'truncate' | 'summarize' | 'spill_to_artifact' | 'fail';
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
maxTokens | property | maxTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
minTokens | property | minTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
overflowPolicy | property | overflowPolicy: "fail" | "summarize" | "drop" | "truncate" | "spill_to_artifact" | 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. |
sourceId | property | sourceId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
targetTokens | property | targetTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextSourceResolutionInput
Context Source Resolution Input interface with 20 public fields or methods.
- Kind: interface
- Import:
import type { ContextSourceResolutionInput } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextSourceResolutionInput extends ResolvedContextBuildInput {
source: ContextSourceSpec;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
explicitSourceRefs | property | explicitSourceRefs?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageCursor | property | messageCursor?: 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. |
modelContextWindowTokens | property | modelContextWindowTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
previousContextHash | property | previousContextHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal: MemoryPrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
profile | property | profile: ContextProfileSpec | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRef | property | profileRef: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
query | property | query?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedInstructionTokens | property | reservedInstructionTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedOutputTokens | property | reservedOutputTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedSystemTokens | property | reservedSystemTokens: 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. |
runtimeStateRef | property | runtimeStateRef?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: ManagedMemoryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
source | property | source: ContextSourceSpec | Public property; its type, readonly modifier and optionality are shown in the signature. |
stateId | property | stateId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stepId | property | stepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tokenizerRef | property | tokenizerRef?: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextSourceResolver
Context Source Resolver interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { ContextSourceResolver } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextSourceResolver {
readonly id: string;
supports(source: ContextSourceSpec): boolean;
resolve(request: ContextSourceResolutionInput): Promise<ContextItem[]>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
id | property | readonly id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
resolve | method | resolve(request: ContextSourceResolutionInput): Promise<ContextItem[]> | Public method; parameters and return type are shown in the signature. |
supports | method | supports(source: ContextSourceSpec): boolean | Public method; parameters and return type are shown in the signature. |
ContextSourceResolverRegistry
Context Source Resolver Registry interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { ContextSourceResolverRegistry } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextSourceResolverRegistry {
resolve(request: ResolvedContextBuildInput): Promise<ContextItem[]>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
resolve | method | resolve(request: ResolvedContextBuildInput): Promise<ContextItem[]> | Public method; parameters and return type are shown in the signature. |
ContextSourceSpec
Context Source Spec interface with 9 public fields or methods.
- Kind: interface
- Import:
import type { ContextSourceSpec } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextSourceSpec {
id: string;
type: ContextSourceType;
ref?: MemoryContractSpecRef;
required?: boolean;
priority: number;
maxItems?: number;
maxTokens?: number;
overflowPolicy?: ContextSourceBudget['overflowPolicy'];
filters?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
filters | property | filters?: Record<string, unknown> | 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. |
maxItems | property | maxItems?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxTokens | property | maxTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
overflowPolicy | property | overflowPolicy?: "fail" | "summarize" | "drop" | "truncate" | "spill_to_artifact" | 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. |
ref | property | ref?: MemoryContractSpecRef | 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: ContextSourceType | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextTruncationPolicySpec
Context Truncation Policy Spec interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { ContextTruncationPolicySpec } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextTruncationPolicySpec {
method: 'drop_lowest' | 'truncate_items' | 'summarize' | 'hybrid';
preserveRequiredSources: boolean;
preserveLatestMessages?: number;
minItemTokens?: number;
truncationMarker?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
method | property | method: "hybrid" | "summarize" | "drop_lowest" | "truncate_items" | Public property; its type, readonly modifier and optionality are shown in the signature. |
minItemTokens | property | minItemTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
preserveLatestMessages | property | preserveLatestMessages?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
preserveRequiredSources | property | preserveRequiredSources: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
truncationMarker | property | truncationMarker?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextTruncationRecord
Context Truncation Record interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { ContextTruncationRecord } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ContextTruncationRecord {
itemId: string;
originalTokens: number;
retainedTokens: number;
method: 'drop' | 'truncate' | 'summarize' | 'spill_to_artifact';
reason: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
itemId | property | itemId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
method | property | method: "summarize" | "drop" | "truncate" | "spill_to_artifact" | Public property; its type, readonly modifier and optionality are shown in the signature. |
originalTokens | property | originalTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reason | property | reason: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
retainedTokens | property | retainedTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
MemoryContextBuilder
Memory Context Builder interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { MemoryContextBuilder } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface MemoryContextBuilder {
build(request: ContextBuildInput): Promise<ContextBundle>;
explain(contextHash: string): Promise<ContextBuildExplanation | null>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
build | method | build(request: ContextBuildInput): Promise<ContextBundle> | Public method; parameters and return type are shown in the signature. |
explain | method | explain(contextHash: string): Promise<ContextBuildExplanation | null> | Public method; parameters and return type are shown in the signature. |
PromptSegment
Prompt Segment interface with 8 public fields or methods.
- Kind: interface
- Import:
import type { PromptSegment } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface PromptSegment {
id: string;
role: 'system' | 'developer' | 'user' | 'assistant' | 'tool' | 'data';
text: string;
tokenCount: number;
trustLevel: 'trusted_instruction' | 'trusted_data' | 'untrusted_data';
sourceRefs: string[];
required?: boolean;
artifactRefs?: ContextArtifactRef[];
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactRefs | property | artifactRefs?: ContextArtifactRef[] | 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. |
required | property | required?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
role | property | role: "system" | "tool" | "user" | "assistant" | "developer" | "data" | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceRefs | property | sourceRefs: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
text | property | text: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tokenCount | property | tokenCount: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
trustLevel | property | trustLevel: "trusted_instruction" | "trusted_data" | "untrusted_data" | Public property; its type, readonly modifier and optionality are shown in the signature. |
ResolvedContextBuildInput
Resolved Context Build Input interface with 19 public fields or methods.
- Kind: interface
- Import:
import type { ResolvedContextBuildInput } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface ResolvedContextBuildInput extends ContextBuildRequest {
profile: ContextProfileSpec;
tokenizerRef?: MemoryContractSpecRef;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
explicitSourceRefs | property | explicitSourceRefs?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageCursor | property | messageCursor?: 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. |
modelContextWindowTokens | property | modelContextWindowTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
previousContextHash | property | previousContextHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal: MemoryPrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
profile | property | profile: ContextProfileSpec | Public property; its type, readonly modifier and optionality are shown in the signature. |
profileRef | property | profileRef: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
query | property | query?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedInstructionTokens | property | reservedInstructionTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedOutputTokens | property | reservedOutputTokens: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
reservedSystemTokens | property | reservedSystemTokens: 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. |
runtimeStateRef | property | runtimeStateRef?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: ManagedMemoryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
stateId | property | stateId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stepId | property | stepId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tokenizerRef | property | tokenizerRef?: MemoryContractSpecRef | Public property; its type, readonly modifier and optionality are shown in the signature. |
TokenEstimator
Token Estimator interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { TokenEstimator } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export interface TokenEstimator {
readonly id: string;
estimate(text: string): number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
estimate | method | estimate(text: string): number | Public method; parameters and return type are shown in the signature. |
id | property | readonly id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextSourceType
Public type alias for Context Source Type; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { ContextSourceType } from '@codesoul-co/hypha-memory'; - Source module:
context-contracts
Declaration
export type ContextSourceType = 'system' | 'workflow_state' | 'messages' | 'working_memory' | 'long_term_memory' | 'tool_observation' | 'artifact' | 'human_review' | 'custom';