Skip to content

@codesoul-co/hypha-core / contracts/session-queue

Using this module

Use the Session queue module for declaring and runtime-validating contracts. It exports 5 constants, 20 interfaces, 2 types.

Import from the package entrypoint

ts
import {
  DEFAULT_SESSION_COMMAND_MAX_ATTEMPTS,
  SESSION_COMMAND_MAX_ATTEMPTS_LIMIT,
  SESSION_COMMAND_RUN_CANCELLED_CODE,
  SESSION_COMMAND_STATUSES,
  SESSION_COMMAND_TYPES,
} from '@codesoul-co/hypha-core';

import type {
  CancelSessionCommandsRequest,
  CancelSessionCommandsResult,
  ClaimSessionCommandRequest,
  CloseDeadLetterSessionCommandRequest,
  CompleteSessionCommandRequest,
  EnqueueSessionCommandRequest,
  FailSessionCommandRequest,
  ListSessionCommandsRequest,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns

  • Use the 22 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The 5 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Public exports

SymbolKindSignatureDescription
DEFAULT_SESSION_COMMAND_MAX_ATTEMPTSconstantconst DEFAULT_SESSION_COMMAND_MAX_ATTEMPTS: 5DEFAULT SESSION COMMAND MAX ATTEMPTS constant exported by the contracts/session-queue module.
SESSION_COMMAND_MAX_ATTEMPTS_LIMITconstantconst SESSION_COMMAND_MAX_ATTEMPTS_LIMIT: 100SESSION COMMAND MAX ATTEMPTS LIMIT constant exported by the contracts/session-queue module.
SESSION_COMMAND_RUN_CANCELLED_CODEconstantconst SESSION_COMMAND_RUN_CANCELLED_CODE: "RUNTIME_RUN_CANCELLED"SESSION COMMAND RUN CANCELLED CODE constant exported by the contracts/session-queue module.
SESSION_COMMAND_STATUSESconstantconst SESSION_COMMAND_STATUSES: readonly ["queued", "claimed", "applied", "reused", "rejected", "expired", "failed", "dead_letter", "dead_letter_resolved"]SESSION COMMAND STATUSES constant exported by the contracts/session-queue module.
SESSION_COMMAND_TYPESconstantconst SESSION_COMMAND_TYPES: readonly ["start_run", "user_input", "resume", "signal", "cancel", "transition", "continue_react", "close_session"]SESSION COMMAND TYPES constant exported by the contracts/session-queue module.
CancelSessionCommandsRequestinterfaceinterface CancelSessionCommandsRequestCancel Session Commands Request interface with 6 public fields or methods.
CancelSessionCommandsResultinterfaceinterface CancelSessionCommandsResultCancel Session Commands Result interface with 4 public fields or methods.
ClaimSessionCommandRequestinterfaceinterface ClaimSessionCommandRequestClaim Session Command Request interface with 4 public fields or methods.
CloseDeadLetterSessionCommandRequestinterfaceinterface CloseDeadLetterSessionCommandRequestClose Dead Letter Session Command Request interface with 6 public fields or methods.
CompleteSessionCommandRequestinterfaceinterface CompleteSessionCommandRequestComplete Session Command Request interface with 7 public fields or methods.
EnqueueSessionCommandRequestinterfaceinterface EnqueueSessionCommandRequestEnqueue Session Command Request interface with 15 public fields or methods.
FailSessionCommandRequestinterfaceinterface FailSessionCommandRequestFail Session Command Request interface with 7 public fields or methods.
ListSessionCommandsRequestinterfaceinterface ListSessionCommandsRequestList Session Commands Request interface with 4 public fields or methods.
ListStuckSessionCommandsRequestinterfaceinterface ListStuckSessionCommandsRequestList Stuck Session Commands Request interface with 4 public fields or methods.
RedriveDeadLetterSessionCommandRequestinterfaceinterface RedriveDeadLetterSessionCommandRequestRedrive Dead Letter Session Command Request interface with 12 public fields or methods.
ReleaseSessionCommandRequestinterfaceinterface ReleaseSessionCommandRequestRelease Session Command Request interface with 6 public fields or methods.
RenewSessionCommandRequestinterfaceinterface RenewSessionCommandRequestRenew Session Command Request interface with 6 public fields or methods.
SessionCommandClaiminterfaceinterface SessionCommandClaimSession Command Claim interface with 5 public fields or methods.
SessionCommandDeadLetterResolutioninterfaceinterface SessionCommandDeadLetterResolutionSession Command Dead Letter Resolution interface with 6 public fields or methods.
SessionCommandLeaseRecoveryinterfaceinterface SessionCommandLeaseRecoverySession Command Lease Recovery interface with 6 public fields or methods.
SessionCommandRecordinterfaceinterface SessionCommandRecordSession Command Record interface with 29 public fields or methods.
SessionCommandRedriveinterfaceinterface SessionCommandRedriveSession Command Redrive interface with 5 public fields or methods.
SessionQueueHealthSnapshotinterfaceinterface SessionQueueHealthSnapshot extends Record<string, unknown>Session Queue Health Snapshot interface with 12 public fields or methods.
SessionQueueScopeinterfaceinterface SessionQueueScopeSession Queue Scope interface with 3 public fields or methods.
StuckSessionCommandinterfaceinterface StuckSessionCommandStuck Session Command interface with 3 public fields or methods.
SessionCommandStatustypetype SessionCommandStatus = (typeof SESSION_COMMAND_STATUSES)[number]Public type alias for Session Command Status; the declaration contains its complete type expression.
SessionCommandTypetypetype SessionCommandType = (typeof SESSION_COMMAND_TYPES)[number]Public type alias for Session Command Type; the declaration contains its complete type expression.

DEFAULT_SESSION_COMMAND_MAX_ATTEMPTS

DEFAULT SESSION COMMAND MAX ATTEMPTS constant exported by the contracts/session-queue module.

  • Kind: constant
  • Import: import { DEFAULT_SESSION_COMMAND_MAX_ATTEMPTS } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export declare const DEFAULT_SESSION_COMMAND_MAX_ATTEMPTS: 5;

SESSION_COMMAND_MAX_ATTEMPTS_LIMIT

SESSION COMMAND MAX ATTEMPTS LIMIT constant exported by the contracts/session-queue module.

  • Kind: constant
  • Import: import { SESSION_COMMAND_MAX_ATTEMPTS_LIMIT } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export declare const SESSION_COMMAND_MAX_ATTEMPTS_LIMIT: 100;

SESSION_COMMAND_RUN_CANCELLED_CODE

SESSION COMMAND RUN CANCELLED CODE constant exported by the contracts/session-queue module.

  • Kind: constant
  • Import: import { SESSION_COMMAND_RUN_CANCELLED_CODE } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export declare const SESSION_COMMAND_RUN_CANCELLED_CODE: "RUNTIME_RUN_CANCELLED";

SESSION_COMMAND_STATUSES

SESSION COMMAND STATUSES constant exported by the contracts/session-queue module.

  • Kind: constant
  • Import: import { SESSION_COMMAND_STATUSES } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export declare const SESSION_COMMAND_STATUSES: readonly ["queued", "claimed", "applied", "reused", "rejected", "expired", "failed", "dead_letter", "dead_letter_resolved"];

SESSION_COMMAND_TYPES

SESSION COMMAND TYPES constant exported by the contracts/session-queue module.

  • Kind: constant
  • Import: import { SESSION_COMMAND_TYPES } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export declare const SESSION_COMMAND_TYPES: readonly ["start_run", "user_input", "resume", "signal", "cancel", "transition", "continue_react", "close_session"];

CancelSessionCommandsRequest

Cancel Session Commands Request interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { CancelSessionCommandsRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface CancelSessionCommandsRequest {
    version: '1.0.0';
    scope: SessionQueueScope;
    targetRunId: string;
    cancellationCommandId: string;
    reason: string;
    cancelledAt: string;
}

Contract members

MemberKindSignatureDescription
cancellationCommandIdpropertycancellationCommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
cancelledAtpropertycancelledAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: SessionQueueScopePublic property; its type, readonly modifier and optionality are shown in the signature.
targetRunIdpropertytargetRunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: "1.0.0"Public property; its type, readonly modifier and optionality are shown in the signature.

CancelSessionCommandsResult

Cancel Session Commands Result interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { CancelSessionCommandsResult } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface CancelSessionCommandsResult {
    targetRunId: string;
    cancelledCommandIds: string[];
    alreadyCancelledCommandIds: string[];
    alreadyTerminalCommandIds: string[];
}

Contract members

MemberKindSignatureDescription
alreadyCancelledCommandIdspropertyalreadyCancelledCommandIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
alreadyTerminalCommandIdspropertyalreadyTerminalCommandIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
cancelledCommandIdspropertycancelledCommandIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
targetRunIdpropertytargetRunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ClaimSessionCommandRequest

Claim Session Command Request interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ClaimSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface ClaimSessionCommandRequest {
    workerId: string;
    now: string;
    leaseMs: number;
    scope?: SessionQueueScope;
}

Contract members

MemberKindSignatureDescription
leaseMspropertyleaseMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
nowpropertynow: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope?: SessionQueueScopePublic property; its type, readonly modifier and optionality are shown in the signature.
workerIdpropertyworkerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

CloseDeadLetterSessionCommandRequest

Close Dead Letter Session Command Request interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { CloseDeadLetterSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface CloseDeadLetterSessionCommandRequest {
    version: '1.0.0';
    scope: SessionQueueScope;
    commandId: string;
    operatorId: string;
    reason: string;
    closedAt: string;
}

Contract members

MemberKindSignatureDescription
closedAtpropertyclosedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
operatorIdpropertyoperatorId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: SessionQueueScopePublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: "1.0.0"Public property; its type, readonly modifier and optionality are shown in the signature.

CompleteSessionCommandRequest

Complete Session Command Request interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { CompleteSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface CompleteSessionCommandRequest {
    commandId: string;
    workerId: string;
    claimToken: string;
    leaseEpoch: number;
    completedAt: string;
    resultRunId?: string;
    resultEventIds?: string[];
}

Contract members

MemberKindSignatureDescription
claimTokenpropertyclaimToken: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
completedAtpropertycompletedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseEpochpropertyleaseEpoch: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
resultEventIdspropertyresultEventIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
resultRunIdpropertyresultRunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workerIdpropertyworkerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

EnqueueSessionCommandRequest

Enqueue Session Command Request interface with 15 public fields or methods.

  • Kind: interface
  • Import: import type { EnqueueSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface EnqueueSessionCommandRequest {
    id: string;
    commandType: SessionCommandType;
    idempotencyKey: string;
    tenantId?: string;
    userId: string;
    workspaceId?: string;
    sessionId: string;
    targetRunId?: string;
    priority?: number;
    maxAttempts?: number;
    payloadRef?: string;
    payloadHash: string;
    createdAt?: string;
    availableAt?: string;
    expiresAt?: string;
}

Contract members

MemberKindSignatureDescription
availableAtpropertyavailableAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandTypepropertycommandType: "user_input" | "cancel" | "signal" | "start_run" | "resume" | "transition" | "continue_react" | "close_session"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.
idempotencyKeypropertyidempotencyKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
maxAttemptspropertymaxAttempts?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
payloadHashpropertypayloadHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
payloadRefpropertypayloadRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
prioritypropertypriority?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
targetRunIdpropertytargetRunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceIdpropertyworkspaceId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

FailSessionCommandRequest

Fail Session Command Request interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { FailSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface FailSessionCommandRequest {
    commandId: string;
    workerId: string;
    claimToken: string;
    leaseEpoch: number;
    failedAt: string;
    rejectionCode: string;
    deadLetter?: boolean;
}

Contract members

MemberKindSignatureDescription
claimTokenpropertyclaimToken: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
deadLetterpropertydeadLetter?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
failedAtpropertyfailedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseEpochpropertyleaseEpoch: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
rejectionCodepropertyrejectionCode: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workerIdpropertyworkerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ListSessionCommandsRequest

List Session Commands Request interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ListSessionCommandsRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface ListSessionCommandsRequest {
    scope: SessionQueueScope;
    statuses?: SessionCommandStatus[];
    fromSequence?: number;
    limit?: number;
}

Contract members

MemberKindSignatureDescription
fromSequencepropertyfromSequence?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
limitpropertylimit?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: SessionQueueScopePublic property; its type, readonly modifier and optionality are shown in the signature.
statusespropertystatuses?: ("rejected" | "queued" | "failed" | "expired" | "applied" | "dead_letter" | "claimed" | "reused" | "dead_letter_resolved")[]Public property; its type, readonly modifier and optionality are shown in the signature.

ListStuckSessionCommandsRequest

List Stuck Session Commands Request interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ListStuckSessionCommandsRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface ListStuckSessionCommandsRequest {
    scope: SessionQueueScope;
    checkedAt: string;
    graceMs?: number;
    limit?: number;
}

Contract members

MemberKindSignatureDescription
checkedAtpropertycheckedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
graceMspropertygraceMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
limitpropertylimit?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: SessionQueueScopePublic property; its type, readonly modifier and optionality are shown in the signature.

RedriveDeadLetterSessionCommandRequest

Redrive Dead Letter Session Command Request interface with 12 public fields or methods.

  • Kind: interface
  • Import: import type { RedriveDeadLetterSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface RedriveDeadLetterSessionCommandRequest {
    version: '1.0.0';
    scope: SessionQueueScope;
    sourceCommandId: string;
    id: string;
    idempotencyKey: string;
    operatorId: string;
    reason: string;
    requestedAt?: string;
    availableAt?: string;
    expiresAt?: string;
    priority?: number;
    maxAttempts?: number;
}

Contract members

MemberKindSignatureDescription
availableAtpropertyavailableAt?: 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.
idempotencyKeypropertyidempotencyKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
maxAttemptspropertymaxAttempts?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
operatorIdpropertyoperatorId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
prioritypropertypriority?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestedAtpropertyrequestedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: SessionQueueScopePublic property; its type, readonly modifier and optionality are shown in the signature.
sourceCommandIdpropertysourceCommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: "1.0.0"Public property; its type, readonly modifier and optionality are shown in the signature.

ReleaseSessionCommandRequest

Release Session Command Request interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { ReleaseSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface ReleaseSessionCommandRequest {
    commandId: string;
    workerId: string;
    claimToken: string;
    leaseEpoch: number;
    releasedAt: string;
    availableAt?: string;
}

Contract members

MemberKindSignatureDescription
availableAtpropertyavailableAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
claimTokenpropertyclaimToken: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseEpochpropertyleaseEpoch: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
releasedAtpropertyreleasedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workerIdpropertyworkerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RenewSessionCommandRequest

Renew Session Command Request interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { RenewSessionCommandRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface RenewSessionCommandRequest {
    commandId: string;
    workerId: string;
    claimToken: string;
    leaseEpoch: number;
    renewedAt: string;
    leaseMs: number;
}

Contract members

MemberKindSignatureDescription
claimTokenpropertyclaimToken: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseEpochpropertyleaseEpoch: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseMspropertyleaseMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
renewedAtpropertyrenewedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workerIdpropertyworkerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

SessionCommandClaim

Session Command Claim interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { SessionCommandClaim } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface SessionCommandClaim {
    commandId: string;
    workerId: string;
    claimToken: string;
    leaseEpoch: number;
    leaseExpiresAt: string;
}

Contract members

MemberKindSignatureDescription
claimTokenpropertyclaimToken: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseEpochpropertyleaseEpoch: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseExpiresAtpropertyleaseExpiresAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workerIdpropertyworkerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

SessionCommandDeadLetterResolution

Session Command Dead Letter Resolution interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { SessionCommandDeadLetterResolution } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface SessionCommandDeadLetterResolution {
    version: '1.0.0';
    disposition: 'redriven' | 'closed';
    operatorId: string;
    reason: string;
    resolvedAt: string;
    redriveCommandId?: string;
}

Contract members

MemberKindSignatureDescription
dispositionpropertydisposition: "closed" | "redriven"Public property; its type, readonly modifier and optionality are shown in the signature.
operatorIdpropertyoperatorId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
redriveCommandIdpropertyredriveCommandId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resolvedAtpropertyresolvedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: "1.0.0"Public property; its type, readonly modifier and optionality are shown in the signature.

SessionCommandLeaseRecovery

Session Command Lease Recovery interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { SessionCommandLeaseRecovery } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface SessionCommandLeaseRecovery {
    version: '1.0.0';
    previousWorkerId: string;
    previousLeaseEpoch: number;
    leaseExpiredAt: string;
    recoveredAt: string;
    disposition: 'requeued' | 'dead_lettered';
}

Contract members

MemberKindSignatureDescription
dispositionpropertydisposition: "requeued" | "dead_lettered"Public property; its type, readonly modifier and optionality are shown in the signature.
leaseExpiredAtpropertyleaseExpiredAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
previousLeaseEpochpropertypreviousLeaseEpoch: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
previousWorkerIdpropertypreviousWorkerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
recoveredAtpropertyrecoveredAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: "1.0.0"Public property; its type, readonly modifier and optionality are shown in the signature.

SessionCommandRecord

Session Command Record interface with 29 public fields or methods.

  • Kind: interface
  • Import: import type { SessionCommandRecord } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface SessionCommandRecord {
    id: string;
    commandType: SessionCommandType;
    idempotencyKey: string;
    tenantId?: string;
    userId: string;
    workspaceId?: string;
    sessionId: string;
    targetRunId?: string;
    enqueueSequence: number;
    priority: number;
    attempts: number;
    maxAttempts: number;
    leaseEpoch: number;
    payloadRef?: string;
    payloadHash: string;
    status: SessionCommandStatus;
    claimedBy?: string;
    claimToken?: string;
    leaseExpiresAt?: string;
    resultRunId?: string;
    resultEventIds?: string[];
    rejectionCode?: string;
    createdAt: string;
    availableAt: string;
    expiresAt?: string;
    completedAt?: string;
    redrive?: SessionCommandRedrive;
    deadLetterResolution?: SessionCommandDeadLetterResolution;
    leaseRecoveries?: SessionCommandLeaseRecovery[];
}

Contract members

MemberKindSignatureDescription
attemptspropertyattempts: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
availableAtpropertyavailableAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
claimedBypropertyclaimedBy?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
claimTokenpropertyclaimToken?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandTypepropertycommandType: "user_input" | "cancel" | "signal" | "start_run" | "resume" | "transition" | "continue_react" | "close_session"Public property; its type, readonly modifier and optionality are shown in the signature.
completedAtpropertycompletedAt?: 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.
deadLetterResolutionpropertydeadLetterResolution?: SessionCommandDeadLetterResolutionPublic property; its type, readonly modifier and optionality are shown in the signature.
enqueueSequencepropertyenqueueSequence: numberPublic 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.
idempotencyKeypropertyidempotencyKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseEpochpropertyleaseEpoch: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseExpiresAtpropertyleaseExpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseRecoveriespropertyleaseRecoveries?: SessionCommandLeaseRecovery[]Public property; its type, readonly modifier and optionality are shown in the signature.
maxAttemptspropertymaxAttempts: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
payloadHashpropertypayloadHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
payloadRefpropertypayloadRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
prioritypropertypriority: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
redrivepropertyredrive?: SessionCommandRedrivePublic property; its type, readonly modifier and optionality are shown in the signature.
rejectionCodepropertyrejectionCode?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resultEventIdspropertyresultEventIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
resultRunIdpropertyresultRunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "rejected" | "queued" | "failed" | "expired" | "applied" | "dead_letter" | "claimed" | "reused" | "dead_letter_resolved"Public property; its type, readonly modifier and optionality are shown in the signature.
targetRunIdpropertytargetRunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceIdpropertyworkspaceId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

SessionCommandRedrive

Session Command Redrive interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { SessionCommandRedrive } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface SessionCommandRedrive {
    version: '1.0.0';
    sourceCommandId: string;
    operatorId: string;
    reason: string;
    requestedAt: string;
}

Contract members

MemberKindSignatureDescription
operatorIdpropertyoperatorId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestedAtpropertyrequestedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceCommandIdpropertysourceCommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: "1.0.0"Public property; its type, readonly modifier and optionality are shown in the signature.

SessionQueueHealthSnapshot

Session Queue Health Snapshot interface with 12 public fields or methods.

  • Kind: interface
  • Import: import type { SessionQueueHealthSnapshot } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface SessionQueueHealthSnapshot extends Record<string, unknown> {
    version: '1.0.0';
    totalCommands: number;
    pendingCommands: number;
    queuedCommands: number;
    claimedCommands: number;
    deadLetterCommands: number;
    resolvedDeadLetterCommands: number;
    retryingCommands: number;
    redeliveredCommands: number;
    recoveredExpiredLeases: number;
    leaseRecoveryCount: number;
    oldestPendingAgeMs?: number;
}

Contract members

MemberKindSignatureDescription
claimedCommandspropertyclaimedCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
deadLetterCommandspropertydeadLetterCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseRecoveryCountpropertyleaseRecoveryCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
oldestPendingAgeMspropertyoldestPendingAgeMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
pendingCommandspropertypendingCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
queuedCommandspropertyqueuedCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
recoveredExpiredLeasespropertyrecoveredExpiredLeases: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
redeliveredCommandspropertyredeliveredCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
resolvedDeadLetterCommandspropertyresolvedDeadLetterCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
retryingCommandspropertyretryingCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
totalCommandspropertytotalCommands: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: "1.0.0"Public property; its type, readonly modifier and optionality are shown in the signature.

SessionQueueScope

Session Queue Scope interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { SessionQueueScope } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface SessionQueueScope {
    tenantId?: string;
    userId: string;
    sessionId: string;
}

Contract members

MemberKindSignatureDescription
sessionIdpropertysessionId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

StuckSessionCommand

Stuck Session Command interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { StuckSessionCommand } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export interface StuckSessionCommand {
    command: SessionCommandRecord;
    detectedAt: string;
    overdueMs: number;
}

Contract members

MemberKindSignatureDescription
commandpropertycommand: SessionCommandRecordPublic property; its type, readonly modifier and optionality are shown in the signature.
detectedAtpropertydetectedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
overdueMspropertyoverdueMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

SessionCommandStatus

Public type alias for Session Command Status; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { SessionCommandStatus } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export type SessionCommandStatus = (typeof SESSION_COMMAND_STATUSES)[number];

SessionCommandType

Public type alias for Session Command Type; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { SessionCommandType } from '@codesoul-co/hypha-core';
  • Source module: contracts/session-queue

Declaration

text
export type SessionCommandType = (typeof SESSION_COMMAND_TYPES)[number];