@codesoul-co/hypha-memory / context-builder
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/context-builder.ts - Exports: 4
Using this module
Use the Context builder module for using the public contracts and operations for this capability boundary. It exports 4 classes.
Import from the package entrypoint
ts
import {
CalibratedCharacterTokenEstimator,
DefaultContextInjectionGateway,
DefaultMemoryContextBuilder,
MetadataContextItemPolicyEvaluator,
} from '@codesoul-co/hypha-memory';Usage patterns
- The module exposes 4 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
CalibratedCharacterTokenEstimator | class | new CalibratedCharacterTokenEstimator(charactersPerToken?: number): CalibratedCharacterTokenEstimator | Calibrated Character Token Estimator class with 3 public constructor or member entries; its exact declarations are listed below. |
DefaultContextInjectionGateway | class | new DefaultContextInjectionGateway(now?: () => string, artifactStore?: ContextArtifactStore | undefined): DefaultContextInjectionGateway | Default Context Injection Gateway class with 2 public constructor or member entries; its exact declarations are listed below. |
DefaultMemoryContextBuilder | class | new DefaultMemoryContextBuilder(tokenizer?: TokenEstimator, now?: () => string, compactor?: ContextCompactor, policy?: ContextItemPolicyEvaluator, artifactStore?: ContextArtifactStore | undefined): DefaultMemoryContextBuilder | Default Memory Context Builder class with 3 public constructor or member entries; its exact declarations are listed below. |
MetadataContextItemPolicyEvaluator | class | new MetadataContextItemPolicyEvaluator(): MetadataContextItemPolicyEvaluator | Metadata Context Item Policy Evaluator class with 2 public constructor or member entries; its exact declarations are listed below. |
CalibratedCharacterTokenEstimator
Calibrated Character Token Estimator class with 3 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { CalibratedCharacterTokenEstimator } from '@codesoul-co/hypha-memory'; - Source module:
context-builder
Declaration
text
export declare class CalibratedCharacterTokenEstimator implements TokenEstimator {
readonly id = "tokenizer.calibrated-character-v1";
constructor(charactersPerToken?: number);
estimate(text: string): number;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (charactersPerToken?: number): CalibratedCharacterTokenEstimator | Creates an instance of this class. |
estimate | method | estimate(text: string): number | Public method; parameters and return type are shown in the signature. |
id | property | readonly id: "tokenizer.calibrated-character-v1" | Public property; its type, readonly modifier and optionality are shown in the signature. |
DefaultContextInjectionGateway
Default Context Injection Gateway class with 2 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { DefaultContextInjectionGateway } from '@codesoul-co/hypha-memory'; - Source module:
context-builder
Declaration
text
export declare class DefaultContextInjectionGateway implements ContextInjectionGateway {
constructor(now?: () => string, artifactStore?: ContextArtifactStore | undefined);
buildEnvelope(bundle: ContextBundle, profile: ContextProfileSpec): Promise<ContextEnvelope>;
}Public 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. |
constructor | constructor | (now?: () => string, artifactStore?: ContextArtifactStore | undefined): DefaultContextInjectionGateway | Creates an instance of this class. |
DefaultMemoryContextBuilder
Default Memory Context Builder class with 3 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { DefaultMemoryContextBuilder } from '@codesoul-co/hypha-memory'; - Source module:
context-builder
Declaration
text
export declare class DefaultMemoryContextBuilder implements MemoryContextBuilder {
constructor(tokenizer?: TokenEstimator, now?: () => string, compactor?: ContextCompactor, policy?: ContextItemPolicyEvaluator, artifactStore?: ContextArtifactStore | undefined);
build(request: ContextBuildInput): Promise<ContextBundle>;
explain(contextHash: string): Promise<ContextBuildExplanation | null>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
build | method | build(request: ContextBuildInput): Promise<ContextBundle> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (tokenizer?: TokenEstimator, now?: () => string, compactor?: ContextCompactor, policy?: ContextItemPolicyEvaluator, artifactStore?: ContextArtifactStore | undefined): DefaultMemoryContextBuilder | Creates an instance of this class. |
explain | method | explain(contextHash: string): Promise<ContextBuildExplanation | null> | Public method; parameters and return type are shown in the signature. |
MetadataContextItemPolicyEvaluator
Metadata Context Item Policy Evaluator class with 2 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { MetadataContextItemPolicyEvaluator } from '@codesoul-co/hypha-memory'; - Source module:
context-builder
Declaration
text
export declare class MetadataContextItemPolicyEvaluator implements ContextItemPolicyEvaluator {
evaluate(input: ContextItemPolicyInput): Promise<{
allowed: boolean;
reason?: string;
}>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (): MetadataContextItemPolicyEvaluator | Creates an instance of this class. |
evaluate | method | evaluate(input: ContextItemPolicyInput): Promise<{ allowed: boolean; reason?: string; }> | Public method; parameters and return type are shown in the signature. |
