Skip to content

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

Using this module

Use the Context artifacts module for using the public contracts and operations for this capability boundary. It exports 2 classes, 2 functions, 6 interfaces, 1 type.

Import from the package entrypoint

ts
import {
  InMemoryContextArtifactStore,
  ProviderBackedContextArtifactStore,
  contextArtifactContentHash,
  validateContextArtifactReference,
} from '@codesoul-co/hypha-memory';

import type {
  ContextArtifactReadExpectation,
  ContextArtifactRecord,
  ContextArtifactRef,
  ContextArtifactStore,
  ContextArtifactWriteRequest,
  ProviderBackedContextArtifactStoreOptions,
  InMemoryContextArtifactBacking,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 7 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 2 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 2 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
InMemoryContextArtifactStoreclassnew InMemoryContextArtifactStore(records?: InMemoryContextArtifactBacking): InMemoryContextArtifactStoreIn Memory Context Artifact Store class with 5 public constructor or member entries; its exact declarations are listed below.
ProviderBackedContextArtifactStoreclassnew ProviderBackedContextArtifactStore(options: ProviderBackedContextArtifactStoreOptions): ProviderBackedContextArtifactStoreProvider Backed Context Artifact Store class with 5 public constructor or member entries; its exact declarations are listed below.
contextArtifactContentHashfunctioncontextArtifactContentHash(content: string): stringContext Artifact Content Hash function with 1 public call signature; parameters and return types are listed below.
validateContextArtifactReferencefunctionvalidateContextArtifactReference(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): voidValidate Context Artifact Reference function with 1 public call signature; parameters and return types are listed below.
ContextArtifactReadExpectationinterfaceinterface ContextArtifactReadExpectationContext Artifact Read Expectation interface with 2 public fields or methods.
ContextArtifactRecordinterfaceinterface ContextArtifactRecordContext Artifact Record interface with 2 public fields or methods.
ContextArtifactRefinterfaceinterface ContextArtifactRefContext Artifact Ref interface with 10 public fields or methods.
ContextArtifactStoreinterfaceinterface ContextArtifactStoreContext Artifact Store interface with 4 public fields or methods.
ContextArtifactWriteRequestinterfaceinterface ContextArtifactWriteRequestContext Artifact Write Request interface with 6 public fields or methods.
ProviderBackedContextArtifactStoreOptionsinterfaceinterface ProviderBackedContextArtifactStoreOptionsProvider Backed Context Artifact Store Options interface with 2 public fields or methods.
InMemoryContextArtifactBackingtypetype InMemoryContextArtifactBacking = Map<string, ContextArtifactRecord>Public type alias for In Memory Context Artifact Backing; the declaration contains its complete type expression.

InMemoryContextArtifactStore

In Memory Context Artifact Store class with 5 public constructor or member entries; its exact declarations are listed below.

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

Declaration

text
export declare class InMemoryContextArtifactStore implements ContextArtifactStore {
    readonly durability: "ephemeral";
    constructor(records?: InMemoryContextArtifactBacking);
    put(request: ContextArtifactWriteRequest): Promise<ContextArtifactRef>;
    read(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): Promise<string>;
    delete(reference: ContextArtifactRef): Promise<void>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(records?: InMemoryContextArtifactBacking): InMemoryContextArtifactStoreCreates an instance of this class.
deletemethoddelete(reference: ContextArtifactRef): Promise<void>Public method; parameters and return type are shown in the signature.
durabilitypropertyreadonly durability: "ephemeral"Public property; its type, readonly modifier and optionality are shown in the signature.
putmethodput(request: ContextArtifactWriteRequest): Promise<ContextArtifactRef>Public method; parameters and return type are shown in the signature.
readmethodread(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): Promise<string>Public method; parameters and return type are shown in the signature.

ProviderBackedContextArtifactStore

Provider Backed Context Artifact Store class with 5 public constructor or member entries; its exact declarations are listed below.

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

Declaration

text
export declare class ProviderBackedContextArtifactStore implements ContextArtifactStore {
    readonly durability: 'ephemeral' | 'durable';
    constructor(options: ProviderBackedContextArtifactStoreOptions);
    put(request: ContextArtifactWriteRequest): Promise<ContextArtifactRef>;
    read(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): Promise<string>;
    delete(reference: ContextArtifactRef): Promise<void>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(options: ProviderBackedContextArtifactStoreOptions): ProviderBackedContextArtifactStoreCreates an instance of this class.
deletemethoddelete(reference: ContextArtifactRef): Promise<void>Public method; parameters and return type are shown in the signature.
durabilitypropertyreadonly durability: "ephemeral" | "durable"Public property; its type, readonly modifier and optionality are shown in the signature.
putmethodput(request: ContextArtifactWriteRequest): Promise<ContextArtifactRef>Public method; parameters and return type are shown in the signature.
readmethodread(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): Promise<string>Public method; parameters and return type are shown in the signature.

contextArtifactContentHash

Context Artifact Content Hash function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { contextArtifactContentHash } from '@codesoul-co/hypha-memory';
  • Source module: context-artifacts

Declaration

text
export declare function contextArtifactContentHash(content: string): string;

Call signature

text
contextArtifactContentHash(content: string): string

Parameters

ParameterTypeRequiredDescription
contentstringYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: string
  • Description: The return contract is defined by the type shown above.

validateContextArtifactReference

Validate Context Artifact Reference function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateContextArtifactReference } from '@codesoul-co/hypha-memory';
  • Source module: context-artifacts

Declaration

text
export declare function validateContextArtifactReference(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): void;

Call signature

text
validateContextArtifactReference(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): void

Parameters

ParameterTypeRequiredDescription
referenceContextArtifactRefYesRequired parameter; accepted values are defined by the type column.
expectedContextArtifactReadExpectationYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: void
  • Description: Returns no value.

ContextArtifactReadExpectation

Context Artifact Read Expectation interface with 2 public fields or methods.

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

Declaration

text
export interface ContextArtifactReadExpectation {
    scopeHash: string;
    profileRevision: string;
}

Contract members

MemberKindSignatureDescription
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ContextArtifactRecord

Context Artifact Record interface with 2 public fields or methods.

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

Declaration

text
export interface ContextArtifactRecord {
    reference: ContextArtifactRef;
    content: string;
}

Contract members

MemberKindSignatureDescription
contentpropertycontent: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
referencepropertyreference: ContextArtifactRefPublic property; its type, readonly modifier and optionality are shown in the signature.

ContextArtifactRef

Context Artifact Ref interface with 10 public fields or methods.

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

Declaration

text
export interface ContextArtifactRef {
    id: string;
    path: string;
    contentHash: string;
    sizeBytes: number;
    contentType: 'text/plain; charset=utf-8';
    scopeHash: string;
    profileRevision: string;
    sourceItemId: string;
    createdAt: string;
    expiresAt?: string;
}

Contract members

MemberKindSignatureDescription
contentHashpropertycontentHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
contentTypepropertycontentType: "text/plain; charset=utf-8"Public property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
pathpropertypath: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sizeBytespropertysizeBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceItemIdpropertysourceItemId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ContextArtifactStore

Context Artifact Store interface with 4 public fields or methods.

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

Declaration

text
export interface ContextArtifactStore {
    readonly durability: 'ephemeral' | 'durable';
    put(request: ContextArtifactWriteRequest): Promise<ContextArtifactRef>;
    read(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): Promise<string>;
    delete(reference: ContextArtifactRef): Promise<void>;
}

Contract members

MemberKindSignatureDescription
deletemethoddelete(reference: ContextArtifactRef): Promise<void>Public method; parameters and return type are shown in the signature.
durabilitypropertyreadonly durability: "ephemeral" | "durable"Public property; its type, readonly modifier and optionality are shown in the signature.
putmethodput(request: ContextArtifactWriteRequest): Promise<ContextArtifactRef>Public method; parameters and return type are shown in the signature.
readmethodread(reference: ContextArtifactRef, expected: ContextArtifactReadExpectation): Promise<string>Public method; parameters and return type are shown in the signature.

ContextArtifactWriteRequest

Context Artifact Write Request interface with 6 public fields or methods.

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

Declaration

text
export interface ContextArtifactWriteRequest {
    content: string;
    scopeHash: string;
    profileRevision: string;
    sourceItemId: string;
    createdAt: string;
    expiresAt?: string;
}

Contract members

MemberKindSignatureDescription
contentpropertycontent: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceItemIdpropertysourceItemId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ProviderBackedContextArtifactStoreOptions

Provider Backed Context Artifact Store Options interface with 2 public fields or methods.

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

Declaration

text
export interface ProviderBackedContextArtifactStoreOptions {
    provider: ArtifactStoreProvider;
    durability?: 'ephemeral' | 'durable';
}

Contract members

MemberKindSignatureDescription
durabilitypropertydurability?: "ephemeral" | "durable"Public property; its type, readonly modifier and optionality are shown in the signature.
providerpropertyprovider: ArtifactStoreProviderPublic property; its type, readonly modifier and optionality are shown in the signature.

InMemoryContextArtifactBacking

Public type alias for In Memory Context Artifact Backing; the declaration contains its complete type expression.

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

Declaration

text
export type InMemoryContextArtifactBacking = Map<string, ContextArtifactRecord>;