@codesoul-co/hypha-core / modules/runtime/runtime-activity-redispatch-service
- Package index:
@codesoul-co/hypha-core - Source:
packages/core/src/modules/runtime/runtime-activity-redispatch-service.ts - Exports: 9
Using this module
Use the Runtime activity redispatch service module for executing runtime behavior at this boundary. It exports 1 class, 1 function, 6 interfaces, 1 type.
Import from the package entrypoint
import {
RuntimeActivityRedispatchService,
runtimeActivityRedispatchIdentity,
} from '@codesoul-co/hypha-core';
import type {
RuntimeActivityRedispatchAttempt,
RuntimeActivityRedispatchCommand,
RuntimeActivityRedispatchPort,
RuntimeActivityRedispatchResult,
RuntimeActivityRedispatchServiceOptions,
RuntimeActivityRevisionValidator,
RuntimeActivityRedispatchReconciliation,
} 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 module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
- The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
RuntimeActivityRedispatchService | class | new RuntimeActivityRedispatchService(options: RuntimeActivityRedispatchServiceOptions): RuntimeActivityRedispatchService | Revalidates approved HumanTask evidence, records redispatch intent, invokes an Owner-provided idempotent Activity dispatcher, and persists acceptance. An intent without a receipt is reconciled before any retry is dispatched. |
runtimeActivityRedispatchIdentity | function | runtimeActivityRedispatchIdentity(command: Pick<RuntimeActivityRedispatchCommand, "scope" | "taskId" | "expectedTaskRevision">): string | Runtime Activity Redispatch Identity function with 1 public call signature; parameters and return types are listed below. |
RuntimeActivityRedispatchAttempt | interface | interface RuntimeActivityRedispatchAttempt | Runtime Activity Redispatch Attempt interface with 9 public fields or methods. |
RuntimeActivityRedispatchCommand | interface | interface RuntimeActivityRedispatchCommand extends RuntimeActivityDescriptorReference | Runtime Activity Redispatch Command interface with 12 public fields or methods. |
RuntimeActivityRedispatchPort | interface | interface RuntimeActivityRedispatchPort | Runtime Activity Redispatch Port interface with 2 public fields or methods. |
RuntimeActivityRedispatchResult | interface | interface RuntimeActivityRedispatchResult | Runtime Activity Redispatch Result interface with 8 public fields or methods. |
RuntimeActivityRedispatchServiceOptions | interface | interface RuntimeActivityRedispatchServiceOptions | Runtime Activity Redispatch Service Options interface with 12 public fields or methods. |
RuntimeActivityRevisionValidator | interface | interface RuntimeActivityRevisionValidator | Runtime Activity Revision Validator interface with 1 public fields or methods. |
RuntimeActivityRedispatchReconciliation | type | type RuntimeActivityRedispatchReconciliation = { status: 'accepted'; commandId: string; } | { status: 'safe_to_dispatch'; } | { status: 'unknown'; reason: string; } | Public type alias for Runtime Activity Redispatch Reconciliation; the declaration contains its complete type expression. |
RuntimeActivityRedispatchService
Revalidates approved HumanTask evidence, records redispatch intent, invokes an Owner-provided idempotent Activity dispatcher, and persists acceptance. An intent without a receipt is reconciled before any retry is dispatched.
- Kind: class
- Import:
import { RuntimeActivityRedispatchService } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export declare class RuntimeActivityRedispatchService {
constructor(options: RuntimeActivityRedispatchServiceOptions);
redispatch(command: RuntimeActivityRedispatchCommand): Promise<RuntimeActivityRedispatchResult>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (options: RuntimeActivityRedispatchServiceOptions): RuntimeActivityRedispatchService | Creates an instance of this class. |
redispatch | method | redispatch(command: RuntimeActivityRedispatchCommand): Promise<RuntimeActivityRedispatchResult> | Public method; parameters and return type are shown in the signature. |
runtimeActivityRedispatchIdentity
Runtime Activity Redispatch Identity function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { runtimeActivityRedispatchIdentity } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export declare function runtimeActivityRedispatchIdentity(command: Pick<RuntimeActivityRedispatchCommand, 'scope' | 'taskId' | 'expectedTaskRevision'>): string;Call signature
runtimeActivityRedispatchIdentity(command: Pick<RuntimeActivityRedispatchCommand, "scope" | "taskId" | "expectedTaskRevision">): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
command | Pick<RuntimeActivityRedispatchCommand, "scope" | "taskId" | "expectedTaskRevision"> | 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.
RuntimeActivityRedispatchAttempt
Runtime Activity Redispatch Attempt interface with 9 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityRedispatchAttempt } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export interface RuntimeActivityRedispatchAttempt {
scope: Readonly<RuntimeScope>;
task: Readonly<RuntimeHumanTask>;
descriptor: Readonly<RuntimeActivityDescriptor>;
redispatchCommandId: string;
redispatchIdempotencyKey: string;
approvalEventId: string;
requestEventId: string;
fencingToken: number;
signal: AbortSignal;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
approvalEventId | property | approvalEventId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
descriptor | property | descriptor: Readonly<RuntimeActivityDescriptor> | Public property; its type, readonly modifier and optionality are shown in the signature. |
fencingToken | property | fencingToken: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
redispatchCommandId | property | redispatchCommandId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
redispatchIdempotencyKey | property | redispatchIdempotencyKey: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
requestEventId | property | requestEventId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: Readonly<RuntimeScope> | Public property; its type, readonly modifier and optionality are shown in the signature. |
signal | property | signal: AbortSignal | Public property; its type, readonly modifier and optionality are shown in the signature. |
task | property | task: Readonly<RuntimeHumanTask> | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeActivityRedispatchCommand
Runtime Activity Redispatch Command interface with 12 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityRedispatchCommand } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export interface RuntimeActivityRedispatchCommand extends RuntimeActivityDescriptorReference {
commandId: string;
scope: RuntimeScope;
ownerId: string;
leaseTtlMs: number;
taskId: string;
expectedTaskRevision: number;
expectedSubjectHash: string;
requestedAt: string;
idempotencyKey?: string;
signal?: AbortSignal;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
activityDescriptorHash | property | activityDescriptorHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
activityDescriptorRef | property | activityDescriptorRef: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
commandId | property | commandId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expectedSubjectHash | property | expectedSubjectHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expectedTaskRevision | property | expectedTaskRevision: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
idempotencyKey | property | idempotencyKey?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
leaseTtlMs | property | leaseTtlMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
ownerId | property | ownerId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
requestedAt | property | requestedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RuntimeScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
signal | property | signal?: AbortSignal | Public property; its type, readonly modifier and optionality are shown in the signature. |
taskId | property | taskId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeActivityRedispatchPort
Runtime Activity Redispatch Port interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityRedispatchPort } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export interface RuntimeActivityRedispatchPort {
dispatch(input: RuntimeActivityRedispatchAttempt): Promise<{
commandId: string;
reused: boolean;
}>;
/**
* Resolves the crash window between an accepted external dispatch and its
* durable Runtime receipt. `safe_to_dispatch` is an authoritative absence
* result; uncertainty must be returned as `unknown`.
*/
reconcile(input: RuntimeActivityRedispatchAttempt): Promise<RuntimeActivityRedispatchReconciliation>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
dispatch | method | dispatch(input: RuntimeActivityRedispatchAttempt): Promise<{ commandId: string; reused: boolean; }> | Public method; parameters and return type are shown in the signature. |
reconcile | method | reconcile(input: RuntimeActivityRedispatchAttempt): Promise<RuntimeActivityRedispatchReconciliation> | Resolves the crash window between an accepted external dispatch and its durable Runtime receipt. safe_to_dispatch is an authoritative absence result; uncertainty must be returned as unknown. |
RuntimeActivityRedispatchResult
Runtime Activity Redispatch Result interface with 8 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityRedispatchResult } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export interface RuntimeActivityRedispatchResult {
commandId: string;
requestEventId: string;
receiptEventId: string;
activityCommandId: string;
eventReused: boolean;
receiptReused: boolean;
commandReused: boolean;
reconciled: boolean;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
activityCommandId | property | activityCommandId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
commandId | property | commandId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
commandReused | property | commandReused: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
eventReused | property | eventReused: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
receiptEventId | property | receiptEventId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
receiptReused | property | receiptReused: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
reconciled | property | reconciled: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
requestEventId | property | requestEventId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeActivityRedispatchServiceOptions
Runtime Activity Redispatch Service Options interface with 12 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityRedispatchServiceOptions } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export interface RuntimeActivityRedispatchServiceOptions {
events: EventRuntime;
runLeases: RunLeaseStore;
descriptors: RuntimeActivityDescriptorStore;
revisions: RuntimeActivityRevisionValidator;
dispatcher: RuntimeActivityRedispatchPort;
renewalIntervalMs?: number;
wait?: (delayMs: number, signal: AbortSignal) => Promise<void>;
onLeaseRenewalFailure?: (error: unknown, commandId: string) => void;
operationalTelemetry?: RuntimeOperationalTelemetry;
monotonicNow?: () => number;
nextId?: (namespace: string) => string;
now?: () => string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
descriptors | property | descriptors: RuntimeActivityDescriptorStore | Public property; its type, readonly modifier and optionality are shown in the signature. |
dispatcher | property | dispatcher: RuntimeActivityRedispatchPort | Public property; its type, readonly modifier and optionality are shown in the signature. |
events | property | events: EventRuntime | Public property; its type, readonly modifier and optionality are shown in the signature. |
monotonicNow | method | monotonicNow?(): number | Public method; parameters and return type are shown in the signature. |
nextId | method | nextId?(namespace: string): string | Public method; parameters and return type are shown in the signature. |
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
onLeaseRenewalFailure | method | onLeaseRenewalFailure?(error: unknown, commandId: string): void | Public method; parameters and return type are shown in the signature. |
operationalTelemetry | property | operationalTelemetry?: RuntimeOperationalTelemetry | Public property; its type, readonly modifier and optionality are shown in the signature. |
renewalIntervalMs | property | renewalIntervalMs?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
revisions | property | revisions: RuntimeActivityRevisionValidator | Public property; its type, readonly modifier and optionality are shown in the signature. |
runLeases | property | runLeases: RunLeaseStore | Public property; its type, readonly modifier and optionality are shown in the signature. |
wait | method | wait?(delayMs: number, signal: AbortSignal): Promise<void> | Public method; parameters and return type are shown in the signature. |
RuntimeActivityRevisionValidator
Runtime Activity Revision Validator interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityRevisionValidator } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export interface RuntimeActivityRevisionValidator {
validate(input: {
task: Readonly<RuntimeHumanTask>;
descriptor: Readonly<RuntimeActivityDescriptor>;
}): Promise<void>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
validate | method | validate(input: { task: Readonly<RuntimeHumanTask>; descriptor: Readonly<RuntimeActivityDescriptor>; }): Promise<void> | Public method; parameters and return type are shown in the signature. |
RuntimeActivityRedispatchReconciliation
Public type alias for Runtime Activity Redispatch Reconciliation; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeActivityRedispatchReconciliation } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/runtime-activity-redispatch-service
Declaration
export type RuntimeActivityRedispatchReconciliation = {
status: 'accepted';
commandId: string;
} | {
status: 'safe_to_dispatch';
} | {
status: 'unknown';
reason: string;
};