@codesoul-co/hypha-core / contracts/runtime-messages
- Package index:
@codesoul-co/hypha-core - Source:
packages/core/src/contracts/runtime-messages.ts - Exports: 10
Using this module
Use the Runtime messages module for declaring and runtime-validating contracts. It exports 3 constants, 4 interfaces, 3 types.
Import from the package entrypoint
import {
RUNTIME_INBOX_STATUSES,
RUNTIME_MESSAGE_TYPES,
RUNTIME_OUTBOX_STATES,
} from '@codesoul-co/hypha-core';
import type {
RuntimeMessageEnvelope,
RuntimeMessageEnvelopeInput,
RuntimeMessageInboxRecord,
RuntimeMessageOutboxRecord,
RuntimeMessageInboxStatus,
RuntimeMessageOutboxState,
RuntimeMessageType,
} from '@codesoul-co/hypha-core';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 3 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
RUNTIME_INBOX_STATUSES | constant | const RUNTIME_INBOX_STATUSES: readonly ["processing", "applied", "ignored", "failed"] | RUNTIME INBOX STATUSES constant exported by the contracts/runtime-messages module. |
RUNTIME_MESSAGE_TYPES | constant | const RUNTIME_MESSAGE_TYPES: readonly ["runtime.command.start", "runtime.command.resume", "runtime.command.cancel", "runtime.signal", "runtime.timer.fire", "runtime.activity.requested", "runtime.activity.completed", "runtime.activity.failed", "runtime.agent.message", "runtime.child.completed", "runtime.projection.rebuild", "runtime.recovery.requested", "runtime.custom"] | RUNTIME MESSAGE TYPES constant exported by the contracts/runtime-messages module. |
RUNTIME_OUTBOX_STATES | constant | const RUNTIME_OUTBOX_STATES: readonly ["pending", "publishing", "published", "failed", "dead_letter"] | RUNTIME OUTBOX STATES constant exported by the contracts/runtime-messages module. |
RuntimeMessageEnvelope | interface | interface RuntimeMessageEnvelope | Runtime Message Envelope interface with 28 public fields or methods. |
RuntimeMessageEnvelopeInput | interface | interface RuntimeMessageEnvelopeInput extends Omit<RuntimeMessageEnvelope<TPayload>, 'payloadHash' | 'sequence'> | Runtime Message Envelope Input interface with 28 public fields or methods. |
RuntimeMessageInboxRecord | interface | interface RuntimeMessageInboxRecord | Runtime Message Inbox Record interface with 12 public fields or methods. |
RuntimeMessageOutboxRecord | interface | interface RuntimeMessageOutboxRecord | Runtime Message Outbox Record interface with 14 public fields or methods. |
RuntimeMessageInboxStatus | type | type RuntimeMessageInboxStatus = (typeof RUNTIME_INBOX_STATUSES)[number] | Public type alias for Runtime Message Inbox Status; the declaration contains its complete type expression. |
RuntimeMessageOutboxState | type | type RuntimeMessageOutboxState = (typeof RUNTIME_OUTBOX_STATES)[number] | Public type alias for Runtime Message Outbox State; the declaration contains its complete type expression. |
RuntimeMessageType | type | type RuntimeMessageType = (typeof RUNTIME_MESSAGE_TYPES)[number] | Public type alias for Runtime Message Type; the declaration contains its complete type expression. |
RUNTIME_INBOX_STATUSES
RUNTIME INBOX STATUSES constant exported by the contracts/runtime-messages module.
- Kind: constant
- Import:
import { RUNTIME_INBOX_STATUSES } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export declare const RUNTIME_INBOX_STATUSES: readonly ["processing", "applied", "ignored", "failed"];RUNTIME_MESSAGE_TYPES
RUNTIME MESSAGE TYPES constant exported by the contracts/runtime-messages module.
- Kind: constant
- Import:
import { RUNTIME_MESSAGE_TYPES } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export declare const RUNTIME_MESSAGE_TYPES: readonly ["runtime.command.start", "runtime.command.resume", "runtime.command.cancel", "runtime.signal", "runtime.timer.fire", "runtime.activity.requested", "runtime.activity.completed", "runtime.activity.failed", "runtime.agent.message", "runtime.child.completed", "runtime.projection.rebuild", "runtime.recovery.requested", "runtime.custom"];RUNTIME_OUTBOX_STATES
RUNTIME OUTBOX STATES constant exported by the contracts/runtime-messages module.
- Kind: constant
- Import:
import { RUNTIME_OUTBOX_STATES } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export declare const RUNTIME_OUTBOX_STATES: readonly ["pending", "publishing", "published", "failed", "dead_letter"];RuntimeMessageEnvelope
Runtime Message Envelope interface with 28 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeMessageEnvelope } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export interface RuntimeMessageEnvelope<TPayload = unknown> {
messageId: string;
messageType: RuntimeMessageType;
schemaVersion: string;
topic: string;
partitionKey: string;
orderingKey?: string;
sequence?: number;
tenantId?: string;
workspaceId?: string;
userId?: string;
sessionId?: string;
runId?: string;
stepId?: string;
activityId?: string;
agentId?: string;
correlationId?: string;
causationId?: string;
traceId?: string;
principal?: RuntimePrincipal;
payload: TPayload;
payloadHash: string;
priority?: number;
availableAt?: string;
expiresAt?: string;
publishedAt: string;
producerId: string;
producerRevision?: string;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
activityId | property | activityId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
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. |
messageId | property | messageId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageType | property | messageType: "runtime.activity.requested" | "runtime.activity.completed" | "runtime.activity.failed" | "runtime.command.start" | "runtime.command.resume" | "runtime.command.cancel" | "runtime.signal" | "runtime.timer.fire" | "runtime.agent.message" | "runtime.child.completed" | "runtime.projection.rebuild" | "runtime.recovery.requested" | "runtime.custom" | 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. |
orderingKey | property | orderingKey?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
partitionKey | property | partitionKey: string | 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. |
payloadHash | property | payloadHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal?: RuntimePrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
priority | property | priority?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
producerId | property | producerId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
producerRevision | property | producerRevision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
publishedAt | property | publishedAt: 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. |
schemaVersion | property | schemaVersion: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
sequence | property | sequence?: number | 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. |
topic | property | topic: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
traceId | property | traceId?: 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. |
RuntimeMessageEnvelopeInput
Runtime Message Envelope Input interface with 28 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeMessageEnvelopeInput } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export interface RuntimeMessageEnvelopeInput<TPayload = unknown> extends Omit<RuntimeMessageEnvelope<TPayload>, 'payloadHash' | 'sequence'> {
payloadHash?: string;
sequence?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
activityId | property | activityId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
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. |
messageId | property | messageId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageType | property | messageType: "runtime.activity.requested" | "runtime.activity.completed" | "runtime.activity.failed" | "runtime.command.start" | "runtime.command.resume" | "runtime.command.cancel" | "runtime.signal" | "runtime.timer.fire" | "runtime.agent.message" | "runtime.child.completed" | "runtime.projection.rebuild" | "runtime.recovery.requested" | "runtime.custom" | 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. |
orderingKey | property | orderingKey?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
partitionKey | property | partitionKey: string | 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. |
payloadHash | property | payloadHash?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal?: RuntimePrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
priority | property | priority?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
producerId | property | producerId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
producerRevision | property | producerRevision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
publishedAt | property | publishedAt: 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. |
schemaVersion | property | schemaVersion: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
sequence | property | sequence?: number | 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. |
topic | property | topic: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
traceId | property | traceId?: 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. |
RuntimeMessageInboxRecord
Runtime Message Inbox Record interface with 12 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeMessageInboxRecord } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export interface RuntimeMessageInboxRecord {
consumerId: string;
messageId: string;
payloadHash: string;
status: RuntimeMessageInboxStatus;
appliedEventIds?: string[];
firstReceivedAt: string;
lastReceivedAt: string;
attempts: number;
expiresAt?: string;
processingOwner?: string;
processingExpiresAt?: string;
lastError?: NormalizedRuntimeError;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
appliedEventIds | property | appliedEventIds?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
attempts | property | attempts: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
consumerId | property | consumerId: 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. |
firstReceivedAt | property | firstReceivedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
lastError | property | lastError?: NormalizedRuntimeError | Public property; its type, readonly modifier and optionality are shown in the signature. |
lastReceivedAt | property | lastReceivedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageId | property | messageId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
payloadHash | property | payloadHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
processingExpiresAt | property | processingExpiresAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
processingOwner | property | processingOwner?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
status | property | status: "failed" | "processing" | "applied" | "ignored" | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeMessageOutboxRecord
Runtime Message Outbox Record interface with 14 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeMessageOutboxRecord } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export interface RuntimeMessageOutboxRecord {
id: string;
eventId?: string;
messageId: string;
topic: string;
partitionKey: string;
envelope: RuntimeMessageEnvelope;
state: RuntimeMessageOutboxState;
attempts: number;
availableAt: string;
leaseOwner?: string;
leaseExpiresAt?: string;
lastError?: NormalizedRuntimeError;
createdAt: string;
updatedAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
attempts | property | attempts: 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. |
createdAt | property | createdAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
envelope | property | envelope: RuntimeMessageEnvelope<unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
eventId | property | eventId?: 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. |
lastError | property | lastError?: NormalizedRuntimeError | Public property; its type, readonly modifier and optionality are shown in the signature. |
leaseExpiresAt | property | leaseExpiresAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
leaseOwner | property | leaseOwner?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
messageId | property | messageId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
partitionKey | property | partitionKey: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
state | property | state: "failed" | "pending" | "publishing" | "published" | "dead_letter" | Public property; its type, readonly modifier and optionality are shown in the signature. |
topic | property | topic: 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. |
RuntimeMessageInboxStatus
Public type alias for Runtime Message Inbox Status; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeMessageInboxStatus } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export type RuntimeMessageInboxStatus = (typeof RUNTIME_INBOX_STATUSES)[number];RuntimeMessageOutboxState
Public type alias for Runtime Message Outbox State; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeMessageOutboxState } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export type RuntimeMessageOutboxState = (typeof RUNTIME_OUTBOX_STATES)[number];RuntimeMessageType
Public type alias for Runtime Message Type; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeMessageType } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-messages
Declaration
export type RuntimeMessageType = (typeof RUNTIME_MESSAGE_TYPES)[number];