@codesoul-co/hypha-harness / message-bus
- Package index:
@codesoul-co/hypha-harness - Source:
packages/harness/src/message-bus.ts - Exports: 12
Using this module
Use the Message bus module for using the public contracts and operations for this capability boundary. It exports 1 class, 9 interfaces, 2 types.
Import from the package entrypoint
import {
InMemoryMessageBus,
} from '@codesoul-co/hypha-harness';
import type {
InMemoryMessageBusOptions,
MessageAckInput,
MessageAddress,
MessageBus,
MessageFailInput,
MessageListFilter,
PublishMessageInput,
PullMessageFilter,
} from '@codesoul-co/hypha-harness';
// The complete export list is documented below.Usage patterns
- Use the 11 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 |
|---|---|---|---|
InMemoryMessageBus | class | new InMemoryMessageBus(options?: InMemoryMessageBusOptions): InMemoryMessageBus | In Memory Message Bus class with 6 public constructor or member entries; its exact declarations are listed below. |
InMemoryMessageBusOptions | interface | interface InMemoryMessageBusOptions | In Memory Message Bus Options interface with 6 public fields or methods. |
MessageAckInput | interface | interface MessageAckInput | Message Ack Input interface with 7 public fields or methods. |
MessageAddress | interface | interface MessageAddress | Message Address interface with 2 public fields or methods. |
MessageBus | interface | interface MessageBus | Message Bus interface with 5 public fields or methods. |
MessageFailInput | interface | interface MessageFailInput extends MessageAckInput | Message Fail Input interface with 11 public fields or methods. |
MessageListFilter | interface | interface MessageListFilter | Message List Filter interface with 5 public fields or methods. |
PublishMessageInput | interface | interface PublishMessageInput | Publish Message Input interface with 16 public fields or methods. |
PullMessageFilter | interface | interface PullMessageFilter | Pull Message Filter interface with 6 public fields or methods. |
RuntimeMessage | interface | interface RuntimeMessage | Runtime Message interface with 20 public fields or methods. |
MessageAddressKind | type | type MessageAddressKind = 'runtime' | 'session' | 'workflow' | 'agent' | 'tool' | 'human' | Public type alias for Message Address Kind; the declaration contains its complete type expression. |
MessageStatus | type | type MessageStatus = 'queued' | 'delivered' | 'acknowledged' | 'failed' | 'dead_lettered' | Public type alias for Message Status; the declaration contains its complete type expression. |
InMemoryMessageBus
In Memory Message Bus class with 6 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { InMemoryMessageBus } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export declare class InMemoryMessageBus implements MessageBus {
constructor(options?: InMemoryMessageBusOptions);
publish<TPayload = unknown>(input: PublishMessageInput<TPayload>): Promise<RuntimeMessage<TPayload>>;
pull<TPayload = unknown>(filter: PullMessageFilter): Promise<RuntimeMessage<TPayload> | null>;
acknowledge(input: MessageAckInput): Promise<RuntimeMessage | null>;
fail(input: MessageFailInput): Promise<RuntimeMessage | null>;
list(filter?: MessageListFilter): Promise<RuntimeMessage[]>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
acknowledge | method | acknowledge(input: MessageAckInput): Promise<RuntimeMessage | null> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options?: InMemoryMessageBusOptions): InMemoryMessageBus | Creates an instance of this class. |
fail | method | fail(input: MessageFailInput): Promise<RuntimeMessage | null> | Public method; parameters and return type are shown in the signature. |
list | method | list(filter?: MessageListFilter): Promise<RuntimeMessage[]> | Public method; parameters and return type are shown in the signature. |
publish | method | publish<TPayload = unknown>(input: PublishMessageInput<TPayload>): Promise<RuntimeMessage<TPayload>> | Public method; parameters and return type are shown in the signature. |
pull | method | pull<TPayload = unknown>(filter: PullMessageFilter): Promise<RuntimeMessage<TPayload> | null> | Public method; parameters and return type are shown in the signature. |
InMemoryMessageBusOptions
In Memory Message Bus Options interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { InMemoryMessageBusOptions } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface InMemoryMessageBusOptions {
trace?: TraceRecorder;
now?: () => string;
maxDeliveryAttempts?: number;
initialRetryDelayMs?: number;
maxRetryDelayMs?: number;
retryMultiplier?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
initialRetryDelayMs | property | initialRetryDelayMs?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxDeliveryAttempts | property | maxDeliveryAttempts?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxRetryDelayMs | property | maxRetryDelayMs?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
retryMultiplier | property | retryMultiplier?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
trace | property | trace?: TraceRecorder | Public property; its type, readonly modifier and optionality are shown in the signature. |
MessageAckInput
Message Ack Input interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { MessageAckInput } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface MessageAckInput {
id: string;
userId: string;
sessionId: string;
runId?: string;
handledBy?: MessageAddress;
timestamp?: string;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
handledBy | property | handledBy?: MessageAddress | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: 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. |
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. |
timestamp | property | timestamp?: 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. |
MessageAddress
Message Address interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { MessageAddress } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface MessageAddress {
kind: MessageAddressKind;
id: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
kind | property | kind: MessageAddressKind | Public property; its type, readonly modifier and optionality are shown in the signature. |
MessageBus
Message Bus interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { MessageBus } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface MessageBus {
publish<TPayload = unknown>(input: PublishMessageInput<TPayload>): Promise<RuntimeMessage<TPayload>>;
pull<TPayload = unknown>(filter: PullMessageFilter): Promise<RuntimeMessage<TPayload> | null>;
acknowledge(input: MessageAckInput): Promise<RuntimeMessage | null>;
fail(input: MessageFailInput): Promise<RuntimeMessage | null>;
list(filter?: MessageListFilter): Promise<RuntimeMessage[]>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
acknowledge | method | acknowledge(input: MessageAckInput): Promise<RuntimeMessage | null> | Public method; parameters and return type are shown in the signature. |
fail | method | fail(input: MessageFailInput): Promise<RuntimeMessage | null> | Public method; parameters and return type are shown in the signature. |
list | method | list(filter?: MessageListFilter): Promise<RuntimeMessage[]> | Public method; parameters and return type are shown in the signature. |
publish | method | publish<TPayload = unknown>(input: PublishMessageInput<TPayload>): Promise<RuntimeMessage<TPayload>> | Public method; parameters and return type are shown in the signature. |
pull | method | pull<TPayload = unknown>(filter: PullMessageFilter): Promise<RuntimeMessage<TPayload> | null> | Public method; parameters and return type are shown in the signature. |
MessageFailInput
Message Fail Input interface with 11 public fields or methods.
- Kind: interface
- Import:
import type { MessageFailInput } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface MessageFailInput extends MessageAckInput {
reason?: string;
deadLetter?: boolean;
retry?: boolean;
retryAfterMs?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
deadLetter | property | deadLetter?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
handledBy | property | handledBy?: MessageAddress | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: 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. |
reason | property | reason?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
retry | property | retry?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
retryAfterMs | property | retryAfterMs?: number | 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. |
timestamp | property | timestamp?: 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. |
MessageListFilter
Message List Filter interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { MessageListFilter } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface MessageListFilter {
userId?: string;
sessionId?: string;
runId?: string;
to?: MessageAddress;
status?: MessageStatus;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
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. |
status | property | status?: MessageStatus | Public property; its type, readonly modifier and optionality are shown in the signature. |
to | property | to?: MessageAddress | 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. |
PublishMessageInput
Publish Message Input interface with 16 public fields or methods.
- Kind: interface
- Import:
import type { PublishMessageInput } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface PublishMessageInput<TPayload = unknown> {
id: string;
type: string;
userId: string;
sessionId: string;
runId: string;
from: MessageAddress;
to: MessageAddress;
payload: TPayload;
stepId?: string;
agentId?: string;
fsmState?: string;
correlationId?: string;
causationId?: string;
availableAt?: string;
expiresAt?: string;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
agentId | property | agentId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
availableAt | property | availableAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
causationId | property | causationId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
correlationId | property | correlationId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expiresAt | property | expiresAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
from | property | from: MessageAddress | Public property; its type, readonly modifier and optionality are shown in the signature. |
fsmState | property | fsmState?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: 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. |
payload | property | payload: TPayload | 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. |
to | property | to: MessageAddress | Public property; its type, readonly modifier and optionality are shown in the signature. |
type | property | type: 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. |
PullMessageFilter
Pull Message Filter interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { PullMessageFilter } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface PullMessageFilter {
userId: string;
sessionId: string;
to: MessageAddress;
runId?: string;
fsmState?: string;
now?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
fsmState | property | fsmState?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
now | property | now?: 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. |
to | property | to: MessageAddress | 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. |
RuntimeMessage
Runtime Message interface with 20 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeMessage } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export interface RuntimeMessage<TPayload = unknown> {
id: string;
type: string;
userId: string;
sessionId: string;
runId: string;
from: MessageAddress;
to: MessageAddress;
payload: TPayload;
status: MessageStatus;
createdAt: string;
updatedAt: string;
stepId?: string;
agentId?: string;
fsmState?: string;
correlationId?: string;
causationId?: string;
availableAt?: string;
expiresAt?: string;
attemptCount: number;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
agentId | property | agentId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
attemptCount | property | attemptCount: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
availableAt | property | availableAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
causationId | property | causationId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
correlationId | property | correlationId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
createdAt | property | createdAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expiresAt | property | expiresAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
from | property | from: MessageAddress | Public property; its type, readonly modifier and optionality are shown in the signature. |
fsmState | property | fsmState?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: 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. |
payload | property | payload: TPayload | 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. |
status | property | status: MessageStatus | 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. |
to | property | to: MessageAddress | Public property; its type, readonly modifier and optionality are shown in the signature. |
type | property | type: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
updatedAt | property | updatedAt: 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. |
MessageAddressKind
Public type alias for Message Address Kind; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { MessageAddressKind } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export type MessageAddressKind = 'runtime' | 'session' | 'workflow' | 'agent' | 'tool' | 'human';MessageStatus
Public type alias for Message Status; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { MessageStatus } from '@codesoul-co/hypha-harness'; - Source module:
message-bus
Declaration
export type MessageStatus = 'queued' | 'delivered' | 'acknowledged' | 'failed' | 'dead_lettered';