Skip to content

@codesoul-co/hypha-core / contracts/runtime-coordination ​

Using this module ​

Use the Runtime coordination module for declaring and runtime-validating contracts. It exports 3 constants, 28 interfaces, 3 types.

Import from the package entrypoint ​

ts
import {
  RUNTIME_RESOURCE_CLAIM_MODES,
  RUNTIME_RESOURCE_TYPES,
  STATE_EXECUTION_CLAIM_STATUSES,
} from '@codesoul-co/hypha-core';

import type {
  FencedRunLease,
  ResourceAcquireRequest,
  ResourceClaimAssertionRequest,
  ResourceListRequest,
  ResourceReleaseRequest,
  ResourceRenewRequest,
  RunLease,
  RunLeaseAcquireRequest,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns ​

  • Use the 31 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 ​

SymbolKindSignatureDescription
RUNTIME_RESOURCE_CLAIM_MODESconstantconst RUNTIME_RESOURCE_CLAIM_MODES: readonly ["shared", "exclusive"]RUNTIME RESOURCE CLAIM MODES constant exported by the contracts/runtime-coordination module.
RUNTIME_RESOURCE_TYPESconstantconst RUNTIME_RESOURCE_TYPES: readonly ["workspace", "artifact", "tool_scope", "memory_scope", "external_account", "custom"]RUNTIME RESOURCE TYPES constant exported by the contracts/runtime-coordination module.
STATE_EXECUTION_CLAIM_STATUSESconstantconst STATE_EXECUTION_CLAIM_STATUSES: readonly ["claimed", "completed", "released", "expired"]STATE EXECUTION CLAIM STATUSES constant exported by the contracts/runtime-coordination module.
FencedRunLeaseinterfaceinterface FencedRunLease extends RunLeaseFenced Run Lease interface with 11 public fields or methods.
ResourceAcquireRequestinterfaceinterface ResourceAcquireRequestResource Acquire Request interface with 6 public fields or methods.
ResourceClaimAssertionRequestinterfaceinterface ResourceClaimAssertionRequest extends ResourceListRequestResource Claim Assertion Request interface with 7 public fields or methods.
ResourceListRequestinterfaceinterface ResourceListRequestResource List Request interface with 4 public fields or methods.
ResourceReleaseRequestinterfaceinterface ResourceReleaseRequestResource Release Request interface with 3 public fields or methods.
ResourceRenewRequestinterfaceinterface ResourceRenewRequestResource Renew Request interface with 4 public fields or methods.
RunLeaseinterfaceinterface RunLeaseRun Lease interface with 9 public fields or methods.
RunLeaseAcquireRequestinterfaceinterface RunLeaseAcquireRequest extends RunLeaseScopeRun Lease Acquire Request interface with 9 public fields or methods.
RunLeaseAssertionRequestinterfaceinterface RunLeaseAssertionRequestRun Lease Assertion Request interface with 3 public fields or methods.
RunLeaseAuthorizationinterfaceinterface RunLeaseAuthorizationRun Lease Authorization interface with 2 public fields or methods.
RunLeaseGuardinterfaceinterface RunLeaseGuardRun Lease Guard interface with 3 public fields or methods.
RunLeaseHeartbeatRequestinterfaceinterface RunLeaseHeartbeatRequestRun Lease Heartbeat Request interface with 4 public fields or methods.
RunLeasePreemptRequestinterfaceinterface RunLeasePreemptRequest extends RunLeaseAcquireRequestRun Lease Preempt Request interface with 10 public fields or methods.
RunLeaseReleaseRequestinterfaceinterface RunLeaseReleaseRequestRun Lease Release Request interface with 3 public fields or methods.
RunLeaseScopeinterfaceinterface RunLeaseScopeRun Lease Scope interface with 4 public fields or methods.
RunLeaseStoreinterfaceinterface RunLeaseStoreRun Lease Store interface with 6 public fields or methods.
RuntimeResourceClaiminterfaceinterface RuntimeResourceClaimRuntime Resource Claim interface with 14 public fields or methods.
RuntimeResourceCoordinatorinterfaceinterface RuntimeResourceCoordinatorRuntime Resource Coordinator interface with 5 public fields or methods.
RuntimeResourceRequestinterfaceinterface RuntimeResourceRequestRuntime Resource Request interface with 5 public fields or methods.
StateExecutionClaiminterfaceinterface StateExecutionClaim extends StateExecutionClaimScopeState Execution Claim interface with 15 public fields or methods.
StateExecutionClaimAcquireRequestinterfaceinterface StateExecutionClaimAcquireRequest extends StateExecutionClaimScopeState Execution Claim Acquire Request interface with 12 public fields or methods.
StateExecutionClaimAssertionRequestinterfaceinterface StateExecutionClaimAssertionRequestState Execution Claim Assertion Request interface with 3 public fields or methods.
StateExecutionClaimCompleteRequestinterfaceinterface StateExecutionClaimCompleteRequestState Execution Claim Complete Request interface with 4 public fields or methods.
StateExecutionClaimGuardinterfaceinterface StateExecutionClaimGuardState Execution Claim Guard interface with 3 public fields or methods.
StateExecutionClaimReleaseRequestinterfaceinterface StateExecutionClaimReleaseRequestState Execution Claim Release Request interface with 4 public fields or methods.
StateExecutionClaimRenewRequestinterfaceinterface StateExecutionClaimRenewRequestState Execution Claim Renew Request interface with 5 public fields or methods.
StateExecutionClaimScopeinterfaceinterface StateExecutionClaimScopeState Execution Claim Scope interface with 5 public fields or methods.
StateExecutionClaimStoreinterfaceinterface StateExecutionClaimStoreState Execution Claim Store interface with 6 public fields or methods.
RuntimeResourceClaimModetypetype RuntimeResourceClaimMode = (typeof RUNTIME_RESOURCE_CLAIM_MODES)[number]Public type alias for Runtime Resource Claim Mode; the declaration contains its complete type expression.
RuntimeResourceTypetypetype RuntimeResourceType = (typeof RUNTIME_RESOURCE_TYPES)[number]Public type alias for Runtime Resource Type; the declaration contains its complete type expression.
StateExecutionClaimStatustypetype StateExecutionClaimStatus = (typeof STATE_EXECUTION_CLAIM_STATUSES)[number]Public type alias for State Execution Claim Status; the declaration contains its complete type expression.

RUNTIME_RESOURCE_CLAIM_MODES ​

RUNTIME RESOURCE CLAIM MODES constant exported by the contracts/runtime-coordination module.

Declaration ​

text
export declare const RUNTIME_RESOURCE_CLAIM_MODES: readonly ["shared", "exclusive"];

RUNTIME_RESOURCE_TYPES ​

RUNTIME RESOURCE TYPES constant exported by the contracts/runtime-coordination module.

Declaration ​

text
export declare const RUNTIME_RESOURCE_TYPES: readonly ["workspace", "artifact", "tool_scope", "memory_scope", "external_account", "custom"];

STATE_EXECUTION_CLAIM_STATUSES ​

STATE EXECUTION CLAIM STATUSES constant exported by the contracts/runtime-coordination module.

Declaration ​

text
export declare const STATE_EXECUTION_CLAIM_STATUSES: readonly ["claimed", "completed", "released", "expired"];

FencedRunLease ​

Fenced Run Lease interface with 11 public fields or methods.

Declaration ​

text
export interface FencedRunLease extends RunLease {
    fencingToken: number;
    partitionKey: string;
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: 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.
fencingTokenpropertyfencingToken: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
heartbeatAtpropertyheartbeatAt: 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.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
partitionKeypropertypartitionKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: 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.

ResourceAcquireRequest ​

Resource Acquire Request interface with 6 public fields or methods.

Declaration ​

text
export interface ResourceAcquireRequest {
    runLease: RunLeaseAuthorization;
    stateId?: string;
    resources: RuntimeResourceRequest[];
    ttlMs: number;
    acquiredAt: string;
    idempotencyKey: string;
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: 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.
resourcespropertyresources: RuntimeResourceRequest[]Public property; its type, readonly modifier and optionality are shown in the signature.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ttlMspropertyttlMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

ResourceClaimAssertionRequest ​

Resource Claim Assertion Request interface with 7 public fields or methods.

Declaration ​

text
export interface ResourceClaimAssertionRequest extends ResourceListRequest {
    claimId: string;
    ownerId: string;
    fencingToken: number;
}

Contract members ​

MemberKindSignatureDescription
checkedAtpropertycheckedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
claimIdpropertyclaimId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
fencingTokenpropertyfencingToken: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceKeypropertyresourceKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceTypepropertyresourceType: "artifact" | "workspace" | "custom" | "tool_scope" | "memory_scope" | "external_account"Public 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.

ResourceListRequest ​

Resource List Request interface with 4 public fields or methods.

Declaration ​

text
export interface ResourceListRequest {
    tenantId?: string;
    resourceType: RuntimeResourceType;
    resourceKey: string;
    checkedAt: string;
}

Contract members ​

MemberKindSignatureDescription
checkedAtpropertycheckedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceKeypropertyresourceKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceTypepropertyresourceType: "artifact" | "workspace" | "custom" | "tool_scope" | "memory_scope" | "external_account"Public 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.

ResourceReleaseRequest ​

Resource Release Request interface with 3 public fields or methods.

Declaration ​

text
export interface ResourceReleaseRequest {
    runLease: RunLeaseAuthorization;
    claimIds: string[];
    releasedAt: string;
}

Contract members ​

MemberKindSignatureDescription
claimIdspropertyclaimIds: string[]Public 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.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic property; its type, readonly modifier and optionality are shown in the signature.

ResourceRenewRequest ​

Resource Renew Request interface with 4 public fields or methods.

Declaration ​

text
export interface ResourceRenewRequest {
    runLease: RunLeaseAuthorization;
    claimIds: string[];
    ttlMs: number;
    renewedAt: string;
}

Contract members ​

MemberKindSignatureDescription
claimIdspropertyclaimIds: string[]Public 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.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic property; its type, readonly modifier and optionality are shown in the signature.
ttlMspropertyttlMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

RunLease ​

Run Lease interface with 9 public fields or methods.

Declaration ​

text
export interface RunLease {
    id: string;
    tenantId?: string;
    userId: string;
    runId: string;
    ownerId: string;
    acquiredAt: string;
    expiresAt: string;
    heartbeatAt: string;
    revision: number;
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: 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.
heartbeatAtpropertyheartbeatAt: 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.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: 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.

RunLeaseAcquireRequest ​

Run Lease Acquire Request interface with 9 public fields or methods.

Declaration ​

text
export interface RunLeaseAcquireRequest extends RunLeaseScope {
    requestedLeaseId: string;
    ownerId: string;
    ttlMs: number;
    acquiredAt: string;
    idempotencyKey: string;
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: 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.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
partitionKeypropertypartitionKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestedLeaseIdpropertyrequestedLeaseId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: 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.
ttlMspropertyttlMs: numberPublic 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.

RunLeaseAssertionRequest ​

Run Lease Assertion Request interface with 3 public fields or methods.

Declaration ​

text
export interface RunLeaseAssertionRequest {
    scope: RunLeaseScope;
    guard: RunLeaseGuard;
    checkedAt: string;
}

Contract members ​

MemberKindSignatureDescription
checkedAtpropertycheckedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
guardpropertyguard: RunLeaseGuardPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: RunLeaseScopePublic property; its type, readonly modifier and optionality are shown in the signature.

RunLeaseAuthorization ​

Run Lease Authorization interface with 2 public fields or methods.

Declaration ​

text
export interface RunLeaseAuthorization {
    scope: RunLeaseScope;
    guard: RunLeaseGuard;
}

Contract members ​

MemberKindSignatureDescription
guardpropertyguard: RunLeaseGuardPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: RunLeaseScopePublic property; its type, readonly modifier and optionality are shown in the signature.

RunLeaseGuard ​

Run Lease Guard interface with 3 public fields or methods.

Declaration ​

text
export interface RunLeaseGuard {
    leaseId: string;
    ownerId: string;
    fencingToken: number;
}

Contract members ​

MemberKindSignatureDescription
fencingTokenpropertyfencingToken: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseIdpropertyleaseId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RunLeaseHeartbeatRequest ​

Run Lease Heartbeat Request interface with 4 public fields or methods.

Declaration ​

text
export interface RunLeaseHeartbeatRequest {
    scope: RunLeaseScope;
    guard: RunLeaseGuard;
    ttlMs: number;
    heartbeatAt: string;
}

Contract members ​

MemberKindSignatureDescription
guardpropertyguard: RunLeaseGuardPublic property; its type, readonly modifier and optionality are shown in the signature.
heartbeatAtpropertyheartbeatAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: RunLeaseScopePublic property; its type, readonly modifier and optionality are shown in the signature.
ttlMspropertyttlMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

RunLeasePreemptRequest ​

Run Lease Preempt Request interface with 10 public fields or methods.

Declaration ​

text
export interface RunLeasePreemptRequest extends RunLeaseAcquireRequest {
    reason: 'cancellation';
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: 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.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
partitionKeypropertypartitionKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: "cancellation"Public property; its type, readonly modifier and optionality are shown in the signature.
requestedLeaseIdpropertyrequestedLeaseId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: 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.
ttlMspropertyttlMs: numberPublic 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.

RunLeaseReleaseRequest ​

Run Lease Release Request interface with 3 public fields or methods.

Declaration ​

text
export interface RunLeaseReleaseRequest {
    scope: RunLeaseScope;
    guard: RunLeaseGuard;
    releasedAt: string;
}

Contract members ​

MemberKindSignatureDescription
guardpropertyguard: RunLeaseGuardPublic 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.
scopepropertyscope: RunLeaseScopePublic property; its type, readonly modifier and optionality are shown in the signature.

RunLeaseScope ​

Run Lease Scope interface with 4 public fields or methods.

Declaration ​

text
export interface RunLeaseScope {
    tenantId?: string;
    userId: string;
    runId: string;
    partitionKey: string;
}

Contract members ​

MemberKindSignatureDescription
partitionKeypropertypartitionKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: 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.

RunLeaseStore ​

Run Lease Store interface with 6 public fields or methods.

Declaration ​

text
export interface RunLeaseStore {
    acquire(request: RunLeaseAcquireRequest): Promise<FencedRunLease | null>;
    preempt(request: RunLeasePreemptRequest): Promise<FencedRunLease>;
    heartbeat(request: RunLeaseHeartbeatRequest): Promise<FencedRunLease>;
    release(request: RunLeaseReleaseRequest): Promise<void>;
    get(scope: RunLeaseScope, checkedAt?: string): Promise<FencedRunLease | null>;
    assertCurrent(request: RunLeaseAssertionRequest): Promise<FencedRunLease>;
}

Contract members ​

MemberKindSignatureDescription
acquiremethodacquire(request: RunLeaseAcquireRequest): Promise<FencedRunLease | null>Public method; parameters and return type are shown in the signature.
assertCurrentmethodassertCurrent(request: RunLeaseAssertionRequest): Promise<FencedRunLease>Public method; parameters and return type are shown in the signature.
getmethodget(scope: RunLeaseScope, checkedAt?: string): Promise<FencedRunLease | null>Public method; parameters and return type are shown in the signature.
heartbeatmethodheartbeat(request: RunLeaseHeartbeatRequest): Promise<FencedRunLease>Public method; parameters and return type are shown in the signature.
preemptmethodpreempt(request: RunLeasePreemptRequest): Promise<FencedRunLease>Public method; parameters and return type are shown in the signature.
releasemethodrelease(request: RunLeaseReleaseRequest): Promise<void>Public method; parameters and return type are shown in the signature.

RuntimeResourceClaim ​

Runtime Resource Claim interface with 14 public fields or methods.

Declaration ​

text
export interface RuntimeResourceClaim {
    id: string;
    tenantId?: string;
    userId: string;
    resourceType: RuntimeResourceType;
    resourceKey: string;
    mode: RuntimeResourceClaimMode;
    runId: string;
    stateId?: string;
    ownerId: string;
    fencingToken: number;
    runFencingToken: number;
    acquiredAt: string;
    expiresAt: string;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: 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.
fencingTokenpropertyfencingToken: numberPublic 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.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode: "shared" | "exclusive"Public property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceKeypropertyresourceKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceTypepropertyresourceType: "artifact" | "workspace" | "custom" | "tool_scope" | "memory_scope" | "external_account"Public property; its type, readonly modifier and optionality are shown in the signature.
runFencingTokenpropertyrunFencingToken: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId?: 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.

RuntimeResourceCoordinator ​

Runtime Resource Coordinator interface with 5 public fields or methods.

Declaration ​

text
export interface RuntimeResourceCoordinator {
    acquire(request: ResourceAcquireRequest): Promise<RuntimeResourceClaim[]>;
    renew(request: ResourceRenewRequest): Promise<RuntimeResourceClaim[]>;
    release(request: ResourceReleaseRequest): Promise<void>;
    list(request: ResourceListRequest): Promise<RuntimeResourceClaim[]>;
    assertCurrent(request: ResourceClaimAssertionRequest): Promise<RuntimeResourceClaim>;
}

Contract members ​

MemberKindSignatureDescription
acquiremethodacquire(request: ResourceAcquireRequest): Promise<RuntimeResourceClaim[]>Public method; parameters and return type are shown in the signature.
assertCurrentmethodassertCurrent(request: ResourceClaimAssertionRequest): Promise<RuntimeResourceClaim>Public method; parameters and return type are shown in the signature.
listmethodlist(request: ResourceListRequest): Promise<RuntimeResourceClaim[]>Public method; parameters and return type are shown in the signature.
releasemethodrelease(request: ResourceReleaseRequest): Promise<void>Public method; parameters and return type are shown in the signature.
renewmethodrenew(request: ResourceRenewRequest): Promise<RuntimeResourceClaim[]>Public method; parameters and return type are shown in the signature.

RuntimeResourceRequest ​

Runtime Resource Request interface with 5 public fields or methods.

Declaration ​

text
export interface RuntimeResourceRequest {
    requestedClaimId: string;
    resourceType: RuntimeResourceType;
    resourceKey: string;
    mode: RuntimeResourceClaimMode;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode: "shared" | "exclusive"Public property; its type, readonly modifier and optionality are shown in the signature.
requestedClaimIdpropertyrequestedClaimId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceKeypropertyresourceKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceTypepropertyresourceType: "artifact" | "workspace" | "custom" | "tool_scope" | "memory_scope" | "external_account"Public property; its type, readonly modifier and optionality are shown in the signature.

StateExecutionClaim ​

State Execution Claim interface with 15 public fields or methods.

Declaration ​

text
export interface StateExecutionClaim extends StateExecutionClaimScope {
    claimId: string;
    processRevision: string;
    expectedRunRevision: number;
    fencingToken: number;
    ownerId: string;
    status: StateExecutionClaimStatus;
    acquiredAt: string;
    expiresAt: string;
    completedAt?: string;
    releasedAt?: string;
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
claimIdpropertyclaimId: 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.
expectedRunRevisionpropertyexpectedRunRevision: 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.
fencingTokenpropertyfencingToken: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
processRevisionpropertyprocessRevision: stringPublic 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.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
stateAttemptpropertystateAttempt: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "completed" | "expired" | "claimed" | "released"Public 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.

StateExecutionClaimAcquireRequest ​

State Execution Claim Acquire Request interface with 12 public fields or methods.

Declaration ​

text
export interface StateExecutionClaimAcquireRequest extends StateExecutionClaimScope {
    requestedClaimId: string;
    processRevision: string;
    expectedRunRevision: number;
    runLease: RunLeaseAuthorization;
    ttlMs: number;
    acquiredAt: string;
    idempotencyKey: string;
}

Contract members ​

MemberKindSignatureDescription
acquiredAtpropertyacquiredAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedRunRevisionpropertyexpectedRunRevision: numberPublic 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.
processRevisionpropertyprocessRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestedClaimIdpropertyrequestedClaimId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic property; its type, readonly modifier and optionality are shown in the signature.
stateAttemptpropertystateAttempt: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId: 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.
ttlMspropertyttlMs: numberPublic 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.

StateExecutionClaimAssertionRequest ​

State Execution Claim Assertion Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { StateExecutionClaimAssertionRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-coordination

Declaration ​

text
export interface StateExecutionClaimAssertionRequest {
    scope: StateExecutionClaimScope;
    guard: StateExecutionClaimGuard;
    checkedAt: string;
}

Contract members ​

MemberKindSignatureDescription
checkedAtpropertycheckedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
guardpropertyguard: StateExecutionClaimGuardPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: StateExecutionClaimScopePublic property; its type, readonly modifier and optionality are shown in the signature.

StateExecutionClaimCompleteRequest ​

State Execution Claim Complete Request interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { StateExecutionClaimCompleteRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-coordination

Declaration ​

text
export interface StateExecutionClaimCompleteRequest {
    scope: StateExecutionClaimScope;
    guard: StateExecutionClaimGuard;
    runLease: RunLeaseAuthorization;
    completedAt: string;
}

Contract members ​

MemberKindSignatureDescription
completedAtpropertycompletedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
guardpropertyguard: StateExecutionClaimGuardPublic property; its type, readonly modifier and optionality are shown in the signature.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: StateExecutionClaimScopePublic property; its type, readonly modifier and optionality are shown in the signature.

StateExecutionClaimGuard ​

State Execution Claim Guard interface with 3 public fields or methods.

Declaration ​

text
export interface StateExecutionClaimGuard {
    claimId: string;
    ownerId: string;
    fencingToken: number;
}

Contract members ​

MemberKindSignatureDescription
claimIdpropertyclaimId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
fencingTokenpropertyfencingToken: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

StateExecutionClaimReleaseRequest ​

State Execution Claim Release Request interface with 4 public fields or methods.

Declaration ​

text
export interface StateExecutionClaimReleaseRequest {
    scope: StateExecutionClaimScope;
    guard: StateExecutionClaimGuard;
    runLease: RunLeaseAuthorization;
    releasedAt: string;
}

Contract members ​

MemberKindSignatureDescription
guardpropertyguard: StateExecutionClaimGuardPublic 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.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: StateExecutionClaimScopePublic property; its type, readonly modifier and optionality are shown in the signature.

StateExecutionClaimRenewRequest ​

State Execution Claim Renew Request interface with 5 public fields or methods.

Declaration ​

text
export interface StateExecutionClaimRenewRequest {
    scope: StateExecutionClaimScope;
    guard: StateExecutionClaimGuard;
    runLease: RunLeaseAuthorization;
    ttlMs: number;
    renewedAt: string;
}

Contract members ​

MemberKindSignatureDescription
guardpropertyguard: StateExecutionClaimGuardPublic 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.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: StateExecutionClaimScopePublic property; its type, readonly modifier and optionality are shown in the signature.
ttlMspropertyttlMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

StateExecutionClaimScope ​

State Execution Claim Scope interface with 5 public fields or methods.

Declaration ​

text
export interface StateExecutionClaimScope {
    tenantId?: string;
    userId: string;
    runId: string;
    stateId: string;
    stateAttempt: number;
}

Contract members ​

MemberKindSignatureDescription
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
stateAttemptpropertystateAttempt: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
stateIdpropertystateId: 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.

StateExecutionClaimStore ​

State Execution Claim Store interface with 6 public fields or methods.

Declaration ​

text
export interface StateExecutionClaimStore {
    acquire(request: StateExecutionClaimAcquireRequest): Promise<StateExecutionClaim | null>;
    renew(request: StateExecutionClaimRenewRequest): Promise<StateExecutionClaim>;
    complete(request: StateExecutionClaimCompleteRequest): Promise<StateExecutionClaim>;
    release(request: StateExecutionClaimReleaseRequest): Promise<StateExecutionClaim>;
    get(scope: StateExecutionClaimScope, checkedAt?: string): Promise<StateExecutionClaim | null>;
    assertCurrent(request: StateExecutionClaimAssertionRequest): Promise<StateExecutionClaim>;
}

Contract members ​

MemberKindSignatureDescription
acquiremethodacquire(request: StateExecutionClaimAcquireRequest): Promise<StateExecutionClaim | null>Public method; parameters and return type are shown in the signature.
assertCurrentmethodassertCurrent(request: StateExecutionClaimAssertionRequest): Promise<StateExecutionClaim>Public method; parameters and return type are shown in the signature.
completemethodcomplete(request: StateExecutionClaimCompleteRequest): Promise<StateExecutionClaim>Public method; parameters and return type are shown in the signature.
getmethodget(scope: StateExecutionClaimScope, checkedAt?: string): Promise<StateExecutionClaim | null>Public method; parameters and return type are shown in the signature.
releasemethodrelease(request: StateExecutionClaimReleaseRequest): Promise<StateExecutionClaim>Public method; parameters and return type are shown in the signature.
renewmethodrenew(request: StateExecutionClaimRenewRequest): Promise<StateExecutionClaim>Public method; parameters and return type are shown in the signature.

RuntimeResourceClaimMode ​

Public type alias for Runtime Resource Claim Mode; the declaration contains its complete type expression.

Declaration ​

text
export type RuntimeResourceClaimMode = (typeof RUNTIME_RESOURCE_CLAIM_MODES)[number];

RuntimeResourceType ​

Public type alias for Runtime Resource Type; the declaration contains its complete type expression.

Declaration ​

text
export type RuntimeResourceType = (typeof RUNTIME_RESOURCE_TYPES)[number];

StateExecutionClaimStatus ​

Public type alias for State Execution Claim Status; the declaration contains its complete type expression.

Declaration ​

text
export type StateExecutionClaimStatus = (typeof STATE_EXECUTION_CLAIM_STATUSES)[number];