@codesoul-co/hypha-memory / context-compaction
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/context-compaction.ts - Exports: 3
Using this module
Use the Context compaction module for using the public contracts and operations for this capability boundary. It exports 1 class, 2 interfaces.
Import from the package entrypoint
ts
import {
DeterministicExtractiveContextCompactor,
} from '@codesoul-co/hypha-memory';
import type {
ContextCompactionRequest,
ContextCompactor,
} from '@codesoul-co/hypha-memory';Usage patterns
- Use the 2 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.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
DeterministicExtractiveContextCompactor | class | new DeterministicExtractiveContextCompactor(): DeterministicExtractiveContextCompactor | Deterministic Extractive Context Compactor class with 3 public constructor or member entries; its exact declarations are listed below. |
ContextCompactionRequest | interface | interface ContextCompactionRequest | Context Compaction Request interface with 4 public fields or methods. |
ContextCompactor | interface | interface ContextCompactor | Context Compactor interface with 2 public fields or methods. |
DeterministicExtractiveContextCompactor
Deterministic Extractive Context Compactor class with 3 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { DeterministicExtractiveContextCompactor } from '@codesoul-co/hypha-memory'; - Source module:
context-compaction
Declaration
text
export declare class DeterministicExtractiveContextCompactor implements ContextCompactor {
readonly id = "context.compactor.extractive-v1";
compact(request: ContextCompactionRequest): Promise<ContextItem | null>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
compact | method | compact(request: ContextCompactionRequest): Promise<ContextItem | null> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (): DeterministicExtractiveContextCompactor | Creates an instance of this class. |
id | property | readonly id: "context.compactor.extractive-v1" | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextCompactionRequest
Context Compaction Request interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { ContextCompactionRequest } from '@codesoul-co/hypha-memory'; - Source module:
context-compaction
Declaration
text
export interface ContextCompactionRequest {
items: ContextItem[];
maxTokens: number;
tokenizer: TokenEstimator;
sourceId?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
items | property | items: ContextItem[] | 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. |
sourceId | property | sourceId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tokenizer | property | tokenizer: TokenEstimator | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextCompactor
Context Compactor interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { ContextCompactor } from '@codesoul-co/hypha-memory'; - Source module:
context-compaction
Declaration
text
export interface ContextCompactor {
readonly id: string;
compact(request: ContextCompactionRequest): Promise<ContextItem | null>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
compact | method | compact(request: ContextCompactionRequest): Promise<ContextItem | null> | 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. |
