Graphorin API reference v0.4.0
Graphorin API reference / @graphorin/memory / / ConsolidatorMemoryStoreExt
Interface: ConsolidatorMemoryStoreExt
Defined in: packages/memory/src/internal/storage-adapter.ts:399
Optional consolidator-state surface every storage adapter exposes for Phase 10c. Mirrors the consolidator_state, consolidator_runs, and consolidator_failed_batches tables shipped in Phase 05's migration 009. Adapters that do not implement the surface degrade gracefully — the consolidator runs in stateless mode (no DLQ, no cursor persistence) and emits a one-shot WARN.
Stable
Methods
acquireLock()
acquireLock(
scope,
runId,
now,
maxAgeMs): Promise<boolean>;Defined in: packages/memory/src/internal/storage-adapter.ts:409
Atomically claim the per-scope lock. Returns true when the row was either unlocked, owned by runId, or stale (the held timestamp is older than maxAgeMs); false otherwise. The now argument allows the lock manager to inject a deterministic clock during tests.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
runId | string |
now | number |
maxAgeMs | number |
Returns
Promise<boolean>
claimReadyBatches()
claimReadyBatches(
scope,
now,
limit?): Promise<readonly DlqBatchRow[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:437
Claim every DLQ row whose nextRetryAt is at or before now, up to limit. Returns the rows in failed-at order so the oldest backlog drains first.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
now | number |
limit? | number |
Returns
Promise<readonly DlqBatchRow[]>
enqueueFailedBatch()
enqueueFailedBatch(input): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:431
Parameters
| Parameter | Type |
|---|---|
input | DlqBatchInput |
Returns
Promise<void>
getState()
getState(scope): Promise<
| ConsolidatorStateRow
| null>;Defined in: packages/memory/src/internal/storage-adapter.ts:400
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
Returns
Promise< | ConsolidatorStateRow | null>
listFailedBatches()
listFailedBatches(scope, limit?): Promise<readonly DlqBatchRow[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:460
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
limit? | number |
Returns
Promise<readonly DlqBatchRow[]>
listRecentRuns()
listRecentRuns(scope, limit?): Promise<readonly {
factsCreated: number;
factsUpdated: number;
finishedAt: number | null;
id: string;
llmCostUsd: number | null;
llmTokensUsed: number;
phase: "light" | "standard" | "deep";
startedAt: number;
status: string;
}[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:414
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
limit? | number |
Returns
Promise<readonly { factsCreated: number; factsUpdated: number; finishedAt: number | null; id: string; llmCostUsd: number | null; llmTokensUsed: number; phase: "light" | "standard" | "deep"; startedAt: number; status: string; }[]>
markBatchExhausted()
markBatchExhausted(
id,
errorMessage,
retryCount?): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:459
Mark the row exhausted (retryCount exceeded the configured cap). The row stays in the DLQ for operator inspection. Implementations MUST clear nextRetryAt so the row is no longer eligible for claimReadyBatches. The optional retryCount argument is recorded against the row so the persisted count reflects the final attempt that triggered the exhaustion.
Parameters
| Parameter | Type |
|---|---|
id | string |
errorMessage | string |
retryCount? | number |
Returns
Promise<void>
markBatchSucceeded()
markBatchSucceeded(id): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:443
Mark the row succeeded — removes it from the DLQ.
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<void>
recordRunFinish()
recordRunFinish(finish): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:413
Parameters
| Parameter | Type |
|---|---|
finish | ConsolidatorRunFinish |
Returns
Promise<void>
recordRunStart()
recordRunStart(input): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:412
Parameters
| Parameter | Type |
|---|---|
input | ConsolidatorRunInput |
Returns
Promise<void>
releaseLock()
releaseLock(scope, runId): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:410
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
runId | string |
Returns
Promise<void>
rescheduleBatch()
rescheduleBatch(
id,
retryCount,
nextRetryAt): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:449
Schedule the next retry attempt. The caller computes nextRetryAt so the backoff schedule is centralized in the consolidator.
Parameters
| Parameter | Type |
|---|---|
id | string |
retryCount | number |
nextRetryAt | number |
Returns
Promise<void>
upsertState()
upsertState(scope, patch): Promise<ConsolidatorStateRow>;Defined in: packages/memory/src/internal/storage-adapter.ts:401
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
patch | ConsolidatorStatePatch |
Returns
Promise<ConsolidatorStateRow>