Interface: IAIProfileStore
Defined in: internal/ai-profile-store/types.ts:44
Tenant-scoped store of AI Profiles.
Implemented by AIProfileStore; the type of IAIGatewayDeps.aiProfileStore, so a host may pass its own in overrides.
Methods
getProfile()
getProfile(
args):Promise<IAIProfile>
Defined in: internal/ai-profile-store/types.ts:59
getProfile -- one profile of a tenant
About
The first read of every call: which model, which tools, which caps.
Reads the tenant's cached profiles and returns a copy. An unknown id, or an id of another tenant, is a 404
(5372567786127): a profile is never visible across tenants.
Who needs it
prepareCall (step 1 of ask and run), AIGateway.resume (the profile a paused run continues on, D65).
Parameters
args
profileId
string
tenantId
string
Returns
Promise<IAIProfile>
listProfiles()
listProfiles(
args):Promise<IAIProfile[]>
Defined in: internal/ai-profile-store/types.ts:73
listProfiles -- the profiles of a tenant, for its administration screen and its model menu
About
Every profile of the tenant, as stored; empty for a tenant without one.
Read through the tenant's cache like getProfile; the order is the repository's.
Parameters
args
tenantId
string
Returns
Promise<IAIProfile[]>
removeProfile()
removeProfile(
args):Promise<void>
Defined in: internal/ai-profile-store/types.ts:112
removeProfile -- deletes a profile of a tenant
About
A profile a paused run waits on stays: the run resumes on it (D46).
An unknown profile is the 404 of getProfile. A profile named by a PAUSED run of the tenant is refused with a 409
(data.runIds): resume or cancel those runs first. There is no default profile to protect (D103). A thread is not
bound to a profile (D46), so nothing else holds one.
Parameters
args
profileId
string
tenantId
string
Returns
Promise<void>
upsertProfile()
upsertProfile(
args):Promise<void>
Defined in: internal/ai-profile-store/types.ts:96
upsertProfile -- creates or replaces a profile of a tenant, validated against the registries
About
A profile that is stored can be run: every name it holds was checked.
Validates before the write: modelId and cheapModelId (when set) must exist and be enabled in the ModelRegistry (the
registry's own 404 or 400 surfaces); every name of allowedTools and approvals must be registered in the ToolRegistry
(400, data.unknownTools); the skills must have unique, non-empty names (the SkillRegistry's 400, D124). Then saves
the profile as given and drops the tenant's cache.
Who needs it
The host's administration screen; the tests and the first run, to seed a profile.
Pitfalls
The profile is stored whole, so a partial object replaces every field. Other instances see the new version after their cache TTL; a paused run keeps resuming on the profile it was started with, as stored at its resume (D46).
Parameters
args
profile
tenantId
string
Returns
Promise<void>