Skip to content

@codesoul-co/hypha-memory / context-gateway

Using this module

Use the Context gateway module for using the public contracts and operations for this capability boundary. It exports 1 class, 4 interfaces, 1 type.

Import from the package entrypoint

ts
import {
  DefaultMemoryContextGateway,
} from '@codesoul-co/hypha-memory';

import type {
  ContextGatewayRequest,
  ContextGatewayResult,
  DefaultMemoryContextGatewayOptions,
  MemoryContextGateway,
  ContextGatewayConsumer,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 5 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

SymbolKindSignatureDescription
DefaultMemoryContextGatewayclassnew DefaultMemoryContextGateway(options: DefaultMemoryContextGatewayOptions): DefaultMemoryContextGatewayCanonical Context entry point shared by Chat, Workflow, and Harness consumers.
ContextGatewayRequestinterfaceinterface ContextGatewayRequest extends ResolvedContextBuildInputContext Gateway Request interface with 20 public fields or methods.
ContextGatewayResultinterfaceinterface ContextGatewayResultContext Gateway Result interface with 4 public fields or methods.
DefaultMemoryContextGatewayOptionsinterfaceinterface DefaultMemoryContextGatewayOptionsDefault Memory Context Gateway Options interface with 5 public fields or methods.
MemoryContextGatewayinterfaceinterface MemoryContextGatewayMemory Context Gateway interface with 1 public fields or methods.
ContextGatewayConsumertypetype ContextGatewayConsumer = 'chat' | 'workflow' | 'harness'Public type alias for Context Gateway Consumer; the declaration contains its complete type expression.

DefaultMemoryContextGateway

Canonical Context entry point shared by Chat, Workflow, and Harness consumers.

  • Kind: class
  • Import: import { DefaultMemoryContextGateway } from '@codesoul-co/hypha-memory';
  • Source module: context-gateway

Declaration

text
export declare class DefaultMemoryContextGateway implements MemoryContextGateway {
    constructor(options: DefaultMemoryContextGatewayOptions);
    build(request: ContextGatewayRequest, signal?: AbortSignal): Promise<ContextGatewayResult>;
}

Public members

MemberKindSignatureDescription
buildmethodbuild(request: ContextGatewayRequest, signal?: AbortSignal): Promise<ContextGatewayResult>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: DefaultMemoryContextGatewayOptions): DefaultMemoryContextGatewayCreates an instance of this class.

ContextGatewayRequest

Context Gateway Request interface with 20 public fields or methods.

  • Kind: interface
  • Import: import type { ContextGatewayRequest } from '@codesoul-co/hypha-memory';
  • Source module: context-gateway

Declaration

text
export interface ContextGatewayRequest extends ResolvedContextBuildInput {
    consumer: ContextGatewayConsumer;
}

Contract members

MemberKindSignatureDescription
consumerpropertyconsumer: ContextGatewayConsumerPublic property; its type, readonly modifier and optionality are shown in the signature.
explicitSourceRefspropertyexplicitSourceRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
messageCursorpropertymessageCursor?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
modelContextWindowTokenspropertymodelContextWindowTokens: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
previousContextHashpropertypreviousContextHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalpropertyprincipal: MemoryPrincipalPublic property; its type, readonly modifier and optionality are shown in the signature.
profilepropertyprofile: ContextProfileSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRefpropertyprofileRef: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.
querypropertyquery?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reservedInstructionTokenspropertyreservedInstructionTokens: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
reservedOutputTokenspropertyreservedOutputTokens: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
reservedSystemTokenspropertyreservedSystemTokens: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runtimeStateRefpropertyruntimeStateRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: ManagedMemoryScopePublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
stepIdpropertystepId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tokenizerRefpropertytokenizerRef?: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.

ContextGatewayResult

Context Gateway Result interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ContextGatewayResult } from '@codesoul-co/hypha-memory';
  • Source module: context-gateway

Declaration

text
export interface ContextGatewayResult {
    envelope: ContextEnvelope;
    explanation: ContextBuildExplanation;
    sourceItemCount: number;
    consumer: ContextGatewayConsumer;
}

Contract members

MemberKindSignatureDescription
consumerpropertyconsumer: ContextGatewayConsumerPublic property; its type, readonly modifier and optionality are shown in the signature.
envelopepropertyenvelope: ContextEnvelopePublic property; its type, readonly modifier and optionality are shown in the signature.
explanationpropertyexplanation: ContextBuildExplanationPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceItemCountpropertysourceItemCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

DefaultMemoryContextGatewayOptions

Default Memory Context Gateway Options interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { DefaultMemoryContextGatewayOptions } from '@codesoul-co/hypha-memory';
  • Source module: context-gateway

Declaration

text
export interface DefaultMemoryContextGatewayOptions {
    resolver: ContextSourceResolverRegistry;
    builder: MemoryContextBuilder;
    injection: ContextInjectionGateway;
    activityHook?: MemoryActivityHarnessHook;
    eventContext?: (request: ContextGatewayRequest) => MemoryActivityRequest['eventContext'];
}

Contract members

MemberKindSignatureDescription
activityHookpropertyactivityHook?: MemoryActivityHarnessHookPublic property; its type, readonly modifier and optionality are shown in the signature.
builderpropertybuilder: MemoryContextBuilderPublic property; its type, readonly modifier and optionality are shown in the signature.
eventContextmethodeventContext?(request: ContextGatewayRequest): MemoryActivityRequest["eventContext"]Public method; parameters and return type are shown in the signature.
injectionpropertyinjection: ContextInjectionGatewayPublic property; its type, readonly modifier and optionality are shown in the signature.
resolverpropertyresolver: ContextSourceResolverRegistryPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryContextGateway

Memory Context Gateway interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryContextGateway } from '@codesoul-co/hypha-memory';
  • Source module: context-gateway

Declaration

text
export interface MemoryContextGateway {
    build(request: ContextGatewayRequest, signal?: AbortSignal): Promise<ContextGatewayResult>;
}

Contract members

MemberKindSignatureDescription
buildmethodbuild(request: ContextGatewayRequest, signal?: AbortSignal): Promise<ContextGatewayResult>Public method; parameters and return type are shown in the signature.

ContextGatewayConsumer

Public type alias for Context Gateway Consumer; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ContextGatewayConsumer } from '@codesoul-co/hypha-memory';
  • Source module: context-gateway

Declaration

text
export type ContextGatewayConsumer = 'chat' | 'workflow' | 'harness';