Skip to main content

Interface: IEntitlementHook

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:252

The product's billing. The library reserves before a run exists (reserve), or for a run written pending (reserveOnce), meters every minute, settles at the end, releases an unbilled run. settle and release are idempotent per reservation: the manager retries them until they resolve, and a repeated call after a success changes nothing.

checkRun, recover and finalize are an optional lifecycle extension for hosts opting into persisted funding.

Extended by​

Methods​

checkRun()?​

optional checkRun(runId, phase): Promise<DispatchAllowance>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:290

Checks original funding and current authority without selecting a new source.

Parameters​

runId​

string

phase​

MeetingFundingPhase

Returns​

Promise<DispatchAllowance>


finalize()?​

optional finalize(reference, decision): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:294

Optional authoritative finalization; billing policy is distinct from measured duration.

Parameters​

reference​

string

decision​
unbilled​

boolean

Returns​

Promise<void>


forget()?​

optional forget(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:254

Optional whole-run eviction for in-memory hosts after terminal cleanup and the retention grace. Durable stores omit it to retain their records. Call only after producers have stopped; forgetting removes fences too.

Parameters​

runId​

string

Returns​

Promise<void>


meter()​

meter(reservationId, seconds): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:274

The seconds the run has used so far, every minute: a running total, not an increment.

Parameters​

reservationId​

string

seconds​

number

Returns​

Promise<void>


recordSupplierUsage()?​

optional recordSupplierUsage(reservationId, usage): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:288

Optional. Records what the run's supplier measured (SupplierUsage), apart from the seconds the owner is billed: the cost the run incurred, settled whatever the owner's bill, an unbilled end included. The manager calls it for every report that carries totals, before its terminal and fence checks, and for the totals a provider's usage answers at reconciliation, so it may be called again with the same or older totals: keep the largest of each. A rejection holds back no run (the report that carried the totals is applied, and a run whose worker is gone still ends): the manager keeps the totals in its stores' supplierUsageInbox, when it has one, and calls again with them at the next reconcile. Absent, nothing is recorded, and meter, settle and release behave as they do without it.

Parameters​

reservationId​

string

usage​

SupplierUsage

Returns​

Promise<void>


recover()?​

optional recover(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:292

Resumes a durable terminal settlement intent; never derives a new source from current plans.

Parameters​

runId​

string

Returns​

Promise<void>


release()​

release(reservationId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:278

Frees a reservation nothing is billed against: a run that ends unbilled, or a send refused after its reservation.

Parameters​

reservationId​

string

Returns​

Promise<void>


reserve()​

reserve(input): Promise<ReserveResult>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:256

Reserves at most maxSeconds for a run about to be made; the answer's maxSeconds is what it covers, and the run's limit is cut to it. A refusal sends no bot.

Parameters​

input​
maxSeconds​

number

ownerRef​

string

platform​

MeetingPlatform

runId​

string

Returns​

Promise<ReserveResult>


reserveOnce()?​

optional reserveOnce(input): Promise<ReserveResult>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:262

Optional; MeetingManager.sendBotPrepared requires it. Reserves at most maxSeconds for a run already written pending, idempotently by its run id: it must return the same committed reservation for a run id even after the caller loses its response, so a creation an interruption cut short and finished later holds one reservation.

Parameters​

input​
maxSeconds​

number

ownerRef​

string

platform​

MeetingPlatform

runId​

string

Returns​

Promise<ReserveResult>


revalidate()​

revalidate(reservationId): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:264

A scheduled run, at dispatch: still paid, still has the hours. Not asked when the hook has revalidateAllowance.

Parameters​

reservationId​

string

Returns​

Promise<boolean>


revalidateAllowance()?​

optional revalidateAllowance(reservationId): Promise<DispatchAllowance>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:272

Optional. The grant at dispatch, asked before a worker is sent for a run that holds a reservation: a run sent now, a scheduled one, and one whose dispatch is tried again after its bot was found not running. The manager cuts the run's limits.totalMs to the answer's maxSeconds and writes it on the run before the provider sees the run; a refusal, or a grant under the manager's minReservationSeconds, ends the run allowance before any dispatch. When present, revalidate is not asked.

Parameters​

reservationId​

string

Returns​

Promise<DispatchAllowance>


settle()​

settle(reservationId, billedSeconds): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:276

Settles the run at the seconds it is billed.

Parameters​

reservationId​

string

billedSeconds​

number

Returns​

Promise<void>