@codesoul-co/hypha-memory / memory-events
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/memory-events.ts - Exports: 6
Using this module
Use the Memory events module for creating, recording, or reading Event contracts. It exports 2 functions, 3 interfaces, 1 type.
Import from the package entrypoint
ts
import {
memoryEventIdempotencyKey,
sanitizeMemoryEventPayload,
} from '@codesoul-co/hypha-memory';
import type {
MemoryEventContext,
MemoryEventPayloadBase,
MemoryEventPublisher,
MemoryEventType,
} from '@codesoul-co/hypha-memory';Usage patterns
- Use the 4 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 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
memoryEventIdempotencyKey | function | memoryEventIdempotencyKey(type: MemoryEventType, payload: MemoryEventPayloadBase): string | Memory Event Idempotency Key function with 1 public call signature; parameters and return types are listed below. |
sanitizeMemoryEventPayload | function | sanitizeMemoryEventPayload(payload: MemoryEventPayloadBase): MemoryEventPayloadBase | Sanitize Memory Event Payload function with 1 public call signature; parameters and return types are listed below. |
MemoryEventContext | interface | interface MemoryEventContext | Memory Event Context interface with 7 public fields or methods. |
MemoryEventPayloadBase | interface | interface MemoryEventPayloadBase | Memory Event Payload Base interface with 12 public fields or methods. |
MemoryEventPublisher | interface | interface MemoryEventPublisher | Memory Event Publisher interface with 1 public fields or methods. |
MemoryEventType | type | type MemoryEventType = Extract<FrameworkEventType, | Public type alias for Memory Event Type; the declaration contains its complete type expression. |
memoryEventIdempotencyKey
Memory Event Idempotency Key function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { memoryEventIdempotencyKey } from '@codesoul-co/hypha-memory'; - Source module:
memory-events
Declaration
text
export declare function memoryEventIdempotencyKey(type: MemoryEventType, payload: MemoryEventPayloadBase): string;Call signature
text
memoryEventIdempotencyKey(type: MemoryEventType, payload: MemoryEventPayloadBase): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | MemoryEventType | Yes | Required parameter; accepted values are defined by the type column. |
payload | MemoryEventPayloadBase | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
string - Description: The return contract is defined by the type shown above.
sanitizeMemoryEventPayload
Sanitize Memory Event Payload function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { sanitizeMemoryEventPayload } from '@codesoul-co/hypha-memory'; - Source module:
memory-events
Declaration
text
export declare function sanitizeMemoryEventPayload(payload: MemoryEventPayloadBase): MemoryEventPayloadBase;Call signature
text
sanitizeMemoryEventPayload(payload: MemoryEventPayloadBase): MemoryEventPayloadBaseParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
payload | MemoryEventPayloadBase | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
MemoryEventPayloadBase - Description: The return contract is defined by the type shown above.
MemoryEventContext
Memory Event Context interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { MemoryEventContext } from '@codesoul-co/hypha-memory'; - Source module:
memory-events
Declaration
text
export interface MemoryEventContext {
userId: string;
tenantId?: string;
runId: string;
sessionId?: string;
workspaceId?: string;
stepId?: string;
agentId?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
agentId | property | agentId?: string | 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. |
sessionId | property | sessionId?: 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. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
userId | property | userId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
workspaceId | property | workspaceId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
MemoryEventPayloadBase
Memory Event Payload Base interface with 12 public fields or methods.
- Kind: interface
- Import:
import type { MemoryEventPayloadBase } from '@codesoul-co/hypha-memory'; - Source module:
memory-events
Declaration
text
export interface MemoryEventPayloadBase {
operationId: string;
profileId?: string;
profileRevision?: string;
providerId?: string;
scopeHash: string;
memoryId?: string;
memoryVersionId?: string;
itemCount?: number;
latencyMs?: number;
status?: string;
error?: NormalizedMemoryError;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
error | property | error?: NormalizedMemoryError | Public property; its type, readonly modifier and optionality are shown in the signature. |
itemCount | property | itemCount?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
latencyMs | property | latencyMs?: number | 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. |
metadata | property | metadata?: Record<string, unknown> | 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. |
profileId | property | profileId?: 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. |
providerId | property | providerId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scopeHash | property | scopeHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
status | property | status?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
MemoryEventPublisher
Memory Event Publisher interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { MemoryEventPublisher } from '@codesoul-co/hypha-memory'; - Source module:
memory-events
Declaration
text
export interface MemoryEventPublisher {
publish(type: MemoryEventType, payload: MemoryEventPayloadBase, context: MemoryEventContext): Promise<string>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
publish | method | publish(type: MemoryEventType, payload: MemoryEventPayloadBase, context: MemoryEventContext): Promise<string> | Public method; parameters and return type are shown in the signature. |
MemoryEventType
Public type alias for Memory Event Type; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { MemoryEventType } from '@codesoul-co/hypha-memory'; - Source module:
memory-events
Declaration
text
export type MemoryEventType = Extract<FrameworkEventType, `memory.${string}` | `context.${string}`>;