@codesoul-co/hypha-core / contracts/runtime-capacity
- Package index:
@codesoul-co/hypha-core - Source:
packages/core/src/contracts/runtime-capacity.ts - Exports: 14
Using this module
Use the Runtime capacity module for declaring and runtime-validating contracts. It exports 1 constant, 12 interfaces, 1 type.
Import from the package entrypoint
import {
RUNTIME_CAPACITY_KINDS,
} from '@codesoul-co/hypha-core';
import type {
RuntimeCapacityAcquireRequest,
RuntimeCapacityAssertionRequest,
RuntimeCapacityLease,
RuntimeCapacityLeaseGuard,
RuntimeCapacityLimit,
RuntimeCapacityPolicy,
RuntimeCapacityReleaseRequest,
RuntimeCapacityRenewRequest,
} from '@codesoul-co/hypha-core';
// The complete export list is documented below.Usage patterns
- Use the 13 type/interface exports as static contracts in application code, adapters, or tests. Import them with
import type; they do not exist at runtime. - The 1 constant/enum export provides stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
RUNTIME_CAPACITY_KINDS | constant | const RUNTIME_CAPACITY_KINDS: readonly ["model", "tool", "execution"] | RUNTIME CAPACITY KINDS constant exported by the contracts/runtime-capacity module. |
RuntimeCapacityAcquireRequest | interface | interface RuntimeCapacityAcquireRequest extends RuntimeCapacityScope | Runtime Capacity Acquire Request interface with 10 public fields or methods. |
RuntimeCapacityAssertionRequest | interface | interface RuntimeCapacityAssertionRequest | Runtime Capacity Assertion Request interface with 4 public fields or methods. |
RuntimeCapacityLease | interface | interface RuntimeCapacityLease extends RuntimeCapacityScope | Runtime Capacity Lease interface with 12 public fields or methods. |
RuntimeCapacityLeaseGuard | interface | interface RuntimeCapacityLeaseGuard | Runtime Capacity Lease Guard interface with 3 public fields or methods. |
RuntimeCapacityLimit | interface | interface RuntimeCapacityLimit | Runtime Capacity Limit interface with 2 public fields or methods. |
RuntimeCapacityPolicy | interface | interface RuntimeCapacityPolicy | Runtime Capacity Policy interface with 3 public fields or methods. |
RuntimeCapacityReleaseRequest | interface | interface RuntimeCapacityReleaseRequest | Runtime Capacity Release Request interface with 4 public fields or methods. |
RuntimeCapacityRenewRequest | interface | interface RuntimeCapacityRenewRequest | Runtime Capacity Renew Request interface with 5 public fields or methods. |
RuntimeCapacityScope | interface | interface RuntimeCapacityScope | Runtime Capacity Scope interface with 3 public fields or methods. |
RuntimeCapacitySemaphore | interface | interface RuntimeCapacitySemaphore | Runtime Capacity Semaphore interface with 5 public fields or methods. |
RuntimeCapacityUsage | interface | interface RuntimeCapacityUsage | Runtime Capacity Usage interface with 7 public fields or methods. |
RuntimeCapacityUsageRequest | interface | interface RuntimeCapacityUsageRequest | Runtime Capacity Usage Request interface with 4 public fields or methods. |
RuntimeCapacityKind | type | type RuntimeCapacityKind = (typeof RUNTIME_CAPACITY_KINDS)[number] | Public type alias for Runtime Capacity Kind; the declaration contains its complete type expression. |
RUNTIME_CAPACITY_KINDS
RUNTIME CAPACITY KINDS constant exported by the contracts/runtime-capacity module.
- Kind: constant
- Import:
import { RUNTIME_CAPACITY_KINDS } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export declare const RUNTIME_CAPACITY_KINDS: readonly ["model", "tool", "execution"];RuntimeCapacityAcquireRequest
Runtime Capacity Acquire Request interface with 10 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityAcquireRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityAcquireRequest extends RuntimeCapacityScope {
kind: RuntimeCapacityKind;
operationId: string;
requestedLeaseId: string;
ownerId: string;
acquiredAt: string;
ttlMs: number;
idempotencyKey: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
acquiredAt | property | acquiredAt: string | 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. |
kind | property | kind: "tool" | "model" | "execution" | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | 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. |
requestedLeaseId | property | requestedLeaseId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
runId | property | runId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
ttlMs | property | ttlMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
userId | property | userId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityAssertionRequest
Runtime Capacity Assertion Request interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityAssertionRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityAssertionRequest {
scope: RuntimeCapacityScope;
kind: RuntimeCapacityKind;
guard: RuntimeCapacityLeaseGuard;
checkedAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
checkedAt | property | checkedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
guard | property | guard: RuntimeCapacityLeaseGuard | Public property; its type, readonly modifier and optionality are shown in the signature. |
kind | property | kind: "tool" | "model" | "execution" | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RuntimeCapacityScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityLease
Runtime Capacity Lease interface with 12 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityLease } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityLease extends RuntimeCapacityScope {
id: string;
kind: RuntimeCapacityKind;
operationId: string;
ownerId: string;
fencingToken: number;
policyRevision: string;
acquiredAt: string;
heartbeatAt: string;
expiresAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
acquiredAt | property | acquiredAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expiresAt | property | expiresAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
fencingToken | property | fencingToken: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
heartbeatAt | property | heartbeatAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
kind | property | kind: "tool" | "model" | "execution" | Public property; its type, readonly modifier and optionality are shown in the signature. |
operationId | property | operationId: string | 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. |
policyRevision | property | policyRevision: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
runId | property | runId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
userId | property | userId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityLeaseGuard
Runtime Capacity Lease Guard interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityLeaseGuard } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityLeaseGuard {
leaseId: string;
ownerId: string;
fencingToken: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
fencingToken | property | fencingToken: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
leaseId | property | leaseId: string | 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. |
RuntimeCapacityLimit
Runtime Capacity Limit interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityLimit } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityLimit {
global: number;
perUser: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
global | property | global: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
perUser | property | perUser: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityPolicy
Runtime Capacity Policy interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityPolicy } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityPolicy {
version: '1.0.0';
revision: string;
limits: Record<RuntimeCapacityKind, RuntimeCapacityLimit>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
limits | property | limits: Record<"tool" | "model" | "execution", RuntimeCapacityLimit> | Public property; its type, readonly modifier and optionality are shown in the signature. |
revision | property | revision: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
version | property | version: "1.0.0" | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityReleaseRequest
Runtime Capacity Release Request interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityReleaseRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityReleaseRequest {
scope: RuntimeCapacityScope;
kind: RuntimeCapacityKind;
guard: RuntimeCapacityLeaseGuard;
releasedAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
guard | property | guard: RuntimeCapacityLeaseGuard | Public property; its type, readonly modifier and optionality are shown in the signature. |
kind | property | kind: "tool" | "model" | "execution" | Public property; its type, readonly modifier and optionality are shown in the signature. |
releasedAt | property | releasedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RuntimeCapacityScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityRenewRequest
Runtime Capacity Renew Request interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityRenewRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityRenewRequest {
scope: RuntimeCapacityScope;
kind: RuntimeCapacityKind;
guard: RuntimeCapacityLeaseGuard;
renewedAt: string;
ttlMs: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
guard | property | guard: RuntimeCapacityLeaseGuard | Public property; its type, readonly modifier and optionality are shown in the signature. |
kind | property | kind: "tool" | "model" | "execution" | Public property; its type, readonly modifier and optionality are shown in the signature. |
renewedAt | property | renewedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RuntimeCapacityScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
ttlMs | property | ttlMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityScope
Runtime Capacity Scope interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityScope } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityScope {
tenantId?: string;
userId: string;
runId: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
runId | property | runId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
userId | property | userId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacitySemaphore
Runtime Capacity Semaphore interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacitySemaphore } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacitySemaphore {
acquire(request: RuntimeCapacityAcquireRequest): Promise<RuntimeCapacityLease | null>;
renew(request: RuntimeCapacityRenewRequest): Promise<RuntimeCapacityLease>;
release(request: RuntimeCapacityReleaseRequest): Promise<void>;
assertCurrent(request: RuntimeCapacityAssertionRequest): Promise<RuntimeCapacityLease>;
usage(request: RuntimeCapacityUsageRequest): Promise<RuntimeCapacityUsage>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
acquire | method | acquire(request: RuntimeCapacityAcquireRequest): Promise<RuntimeCapacityLease | null> | Public method; parameters and return type are shown in the signature. |
assertCurrent | method | assertCurrent(request: RuntimeCapacityAssertionRequest): Promise<RuntimeCapacityLease> | Public method; parameters and return type are shown in the signature. |
release | method | release(request: RuntimeCapacityReleaseRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
renew | method | renew(request: RuntimeCapacityRenewRequest): Promise<RuntimeCapacityLease> | Public method; parameters and return type are shown in the signature. |
usage | method | usage(request: RuntimeCapacityUsageRequest): Promise<RuntimeCapacityUsage> | Public method; parameters and return type are shown in the signature. |
RuntimeCapacityUsage
Runtime Capacity Usage interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityUsage } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityUsage {
kind: RuntimeCapacityKind;
policyRevision: string;
globalActive: number;
userActive: number;
globalLimit: number;
userLimit: number;
checkedAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
checkedAt | property | checkedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
globalActive | property | globalActive: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
globalLimit | property | globalLimit: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
kind | property | kind: "tool" | "model" | "execution" | Public property; its type, readonly modifier and optionality are shown in the signature. |
policyRevision | property | policyRevision: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
userActive | property | userActive: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
userLimit | property | userLimit: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityUsageRequest
Runtime Capacity Usage Request interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCapacityUsageRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export interface RuntimeCapacityUsageRequest {
tenantId?: string;
userId: string;
kind: RuntimeCapacityKind;
checkedAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
checkedAt | property | checkedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
kind | property | kind: "tool" | "model" | "execution" | Public property; its type, readonly modifier and optionality are shown in the signature. |
tenantId | property | tenantId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
userId | property | userId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCapacityKind
Public type alias for Runtime Capacity Kind; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeCapacityKind } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-capacity
Declaration
export type RuntimeCapacityKind = (typeof RUNTIME_CAPACITY_KINDS)[number];