Interface: IRunRepository
Defined in: internal/run-store/types.ts:188
Persistence seam of the runs: what a host implements over its database; the RunStore adds the 404 and the status helpers.
Methods
anonymizeByUser()
anonymizeByUser(
args):Promise<number>
Defined in: internal/run-store/types.ts:290
anonymizeByUser -- keeps a user's runs as skeletons
About
GDPR pseudonymisation: the words go, the record stays.
userId becomes the pseudonym; messages, request.system, request.outputSchema, skills, pending and answer are
emptied; a RUNNING or PAUSED run becomes CANCELLED; id, status, steps and dates stay. Returns how many.
Who needs it
RunStore.anonymizeByUser, for the gateway's anonymizeUserData.
Parameters
args
pseudonym
string
tenantId
string
userId
string
Returns
Promise<number>
delete()
delete(
args):Promise<number>
Defined in: internal/run-store/types.ts:271
delete -- hard-deletes the runs of threads
About
The listed ids, or every run of the tenant for
"all".
Narrowed to one user when userId is given. Returns how many went.
Who needs it
RunStore.delete, for the gateway's delete and deleteUserData.
Parameters
args
tenantId
string
threadIds
userId?
string
Returns
Promise<number>
listByStatus()
listByStatus(
args):Promise<IRun[]>
Defined in: internal/run-store/types.ts:233
listByStatus -- the tenant's runs in one status
About
Narrowed to one user when
userIdis given; any order.
Every run of the tenant whose status matches.
Who needs it
RunStore.listPaused and listRunning.
Parameters
args
status
tenantId
string
userId?
string
Returns
Promise<IRun[]>
load()
load(
args):Promise<IRun|null>
Defined in: internal/run-store/types.ts:216
load -- the run of a tenant by id
About
Null when missing or of another tenant.
The run as stored, whole.
Who needs it
RunStore.load.
Parameters
args
runId
string
tenantId
string
Returns
Promise<IRun | null>
save()
save(
args):Promise<void>
Defined in: internal/run-store/types.ts:202
save -- creates or replaces the run
About
Whole, by
idwithin the tenant.
The run as the gateway holds it: request, messages, status, pending calls, answer.
Who needs it
RunStore.save and setStatus.
Parameters
args
run
Returns
Promise<void>
transition()
transition(
args):Promise<IRun|null>
Defined in: internal/run-store/types.ts:252
transition -- moves a run from one status to another atomically
About
Compare-and-set (D69): two callers racing for the same run, exactly one gets it.
Returns the updated run, or null when the run is missing or not in from; pending is cleared when to is not PAUSED.
One database operation with the condition in the filter, never a load followed by a save.
Who needs it
RunStore.transition, for every status change that must be taken once: a resume, a cancel, an expiry.
Parameters
args
from
runId
string
tenantId
string
to
Returns
Promise<IRun | null>