ProjectConfigStore: the mechanism ProjectConfigService implements.
API
@Interface()
export abstract class ProjectConfigStore {
abstract readRaw(projectId: string): Promise<RawTable>;
abstract migrateStoredConfigs(): Promise<void>;
abstract loadConfig(projectId: string): Promise<ProjectConfig>;
abstract writeRaw(projectId: string, data: RawTable): Promise<void>;
abstract writeInitialConfig(projectId: string, name: string): Promise<void>;
abstract ensurePresetModels(projectId: string): Promise<boolean>;
abstract seedPresetPromotions(projectId: string): Promise<void>;
abstract getName(projectId: string): Promise<string | undefined>;
abstract setName(projectId: string, name: string): Promise<void>;
abstract getDefaultModelRef(projectId: string): Promise<ModelRef | undefined>;
abstract setDefaultModelRef(projectId: string, ref: ModelRefDto): Promise<ModelRefDto>;
abstract getChatDefaults(projectId: string): Promise<ChatDefaultsDto>;
abstract setChatDefaults(projectId: string, req: ChatDefaultsDto): Promise<ChatDefaultsDto>;
abstract getPluginTables(projectId: string): Promise<PluginTables>;
abstract setPluginTables(projectId: string, tables: PluginTables): Promise<PluginTables>;
abstract getCommandPolicy(projectId: string): Promise<CommandPolicyDto>;
abstract setCommandPolicy(
projectId: string,
req: {
enabled?: boolean;
rules: {
name: string;
pattern: string;
description?: string;
enabled?: boolean;
action?: "deny" | "ask";
}[];
},
): Promise<CommandPolicyDto>;
abstract getPricing(
projectId: string,
provider: string,
modelId: string,
): Promise<TieredRates | undefined>;
abstract detectVision(
projectId: string,
req: ModelVisionDetectRequest,
): Promise<ModelVisionDetectResponse>;
abstract testModel(
projectId: string,
req: ModelTestRequest,
testRequestFor?: ModelTestRequestSource,
): Promise<ModelTestResponse>;
abstract detectProtocol(
projectId: string,
req: ModelProtocolDetectRequest,
): Promise<ModelProtocolDetectResponse>;
abstract listEndpointModels(
req: EndpointModelListRequest,
listImpl?: (options: ListEndpointModelsOptions) => Promise<string[]>,
timeoutMs?: number,
): Promise<EndpointModelListResponse>;
abstract getModels(projectId: string): Promise<ModelsResponse>;
abstract updateModels(projectId: string, req: ModelsUpdateRequest): Promise<ModelsResponse>;
abstract setProviderConnection(
projectId: string,
provider: string,
patch: ProviderConnectionUpdate,
): Promise<ProviderConnectionResponse>;
abstract syncPresets(projectId: string, mode: PresetSyncMode): Promise<PresetSyncResponse>;
abstract setGroupApiKey(
projectId: string,
provider: string,
apiKey: string,
): Promise<GroupKeyApplied>;
abstract setGroupApiKeyWithProviderAuthToken(
projectId: string,
provider: string,
apiKey: string,
token: Omit<ModelProviderAuthToken, "provider" | "updatedAt">,
options?: { expectedRefreshToken?: string },
): Promise<number>;
abstract getGroupApiKey(projectId: string, provider: string): Promise<string | undefined>;
abstract getModelApiKey(
projectId: string,
provider: string,
modelId: string,
): Promise<string | undefined>;
abstract getGroupBalanceKey(projectId: string, provider: string): Promise<string | undefined>;
abstract setModelApiKeyResolver(
resolver: (context: ModelRequestContext) => Promise<string | undefined>,
): void;
abstract mergePlatformModels(
projectId: string,
provider: string,
catalog: PlatformModelCatalog,
apiKey: string,
applyKeyToExisting: boolean,
): Promise<PlatformModelApplyResult>;
abstract completeOnce(projectId: string, prompt: string): Promise<UtilityCompletion>;
abstract getToolModels(projectId: string): Promise<Record<string, ModelRefDto>>;
abstract setToolModel(
projectId: string,
key: string,
model: ModelRefDto | null,
): Promise<Record<string, ModelRefDto>>;
abstract modelRequestApiKey(projectId: string, model: ModelRefDto): Promise<string | undefined>;
}Contract Topology
Static AST wiring across @Module / @Provide / @UseMembers (37)
readRaw
readRaw(projectId: string): Promise<RawTable>stringPromise<RawTable>migrateStoredConfigs
migrateStoredConfigs(): Promise<void>Reads every Project's config once, so what the read path's one-time migrations write back (core's and the server's) is on disk before any Session opens one.
Promise<void>loadConfig
loadConfig(projectId: string): Promise<ProjectConfig>stringPromise<ProjectConfig>writeRaw
writeRaw(projectId: string, data: RawTable): Promise<void>stringRawTablePromise<void>writeInitialConfig
writeInitialConfig(projectId: string, name: string): Promise<void>stringstringPromise<void>ensurePresetModels
ensurePresetModels(projectId: string): Promise<boolean>stringPromise<boolean>seedPresetPromotions
seedPresetPromotions(projectId: string): Promise<void>stringPromise<void>getName
getName(projectId: string): Promise<string | undefined>stringPromise<string | undefined>setName
setName(projectId: string, name: string): Promise<void>stringstringPromise<void>getDefaultModelRef
getDefaultModelRef(projectId: string): Promise<ModelRef | undefined>stringPromise<ModelRef | undefined>setDefaultModelRef
setDefaultModelRef(projectId: string, ref: ModelRefDto): Promise<ModelRefDto>stringModelRefDtoPromise<ModelRefDto>getChatDefaults
getChatDefaults(projectId: string): Promise<ChatDefaultsDto>stringPromise<ChatDefaultsDto>setChatDefaults
setChatDefaults(projectId: string, req: ChatDefaultsDto): Promise<ChatDefaultsDto>stringChatDefaultsDtoPromise<ChatDefaultsDto>getPluginTables
getPluginTables(projectId: string): Promise<PluginTables>The [plugins] key: the shared table and each machine's own, package name → requirement, in the file's order.
stringPromise<PluginTables>setPluginTables
setPluginTables(projectId: string, tables: PluginTables): Promise<PluginTables>Replaces the tables (a declarative PUT); answers what was written.
stringPluginTablesPromise<PluginTables>getCommandPolicy
getCommandPolicy(projectId: string): Promise<CommandPolicyDto>stringPromise<CommandPolicyDto>setCommandPolicy
setCommandPolicy(projectId: string, req: { enabled?: boolean; rules: { name: string; pattern: string; description?: string; enabled?: boolean; action?: "deny" | "ask"; }[]; }): Promise<CommandPolicyDto>string{ enabled?: boolean; rules: { name: string; pattern: string; description?: string; enabled?: boolean; action?: "deny" | "ask"; }[]; }Promise<CommandPolicyDto>getPricing
getPricing(projectId: string, provider: string, modelId: string): Promise<TieredRates | undefined>stringstringstringPromise<TieredRates | undefined>detectVision
detectVision(projectId: string, req: ModelVisionDetectRequest): Promise<ModelVisionDetectResponse>stringModelVisionDetectRequestPromise<ModelVisionDetectResponse>testModel
testModel(projectId: string, req: ModelTestRequest, testRequestFor?: ModelTestRequestSource): Promise<ModelTestResponse>The connection test; testRequestFor names a tool model's own request (ModelTestRequestSource).
stringModelTestRequestModelTestRequestSourcePromise<ModelTestResponse>detectProtocol
detectProtocol(projectId: string, req: ModelProtocolDetectRequest): Promise<ModelProtocolDetectResponse>stringModelProtocolDetectRequestPromise<ModelProtocolDetectResponse>listEndpointModels
listEndpointModels(req: EndpointModelListRequest, listImpl?: (options: ListEndpointModelsOptions) => Promise<string[]>, timeoutMs?: number): Promise<EndpointModelListResponse>EndpointModelListRequest(options: ListEndpointModelsOptions) => Promise<string[]>numberPromise<EndpointModelListResponse>getModels
getModels(projectId: string): Promise<ModelsResponse>stringPromise<ModelsResponse>updateModels
updateModels(projectId: string, req: ModelsUpdateRequest): Promise<ModelsResponse>stringModelsUpdateRequestPromise<ModelsResponse>setProviderConnection
setProviderConnection(projectId: string, provider: string, patch: ProviderConnectionUpdate): Promise<ProviderConnectionResponse>One group's [providers.<id>] connection, merged per field; rows are never touched. The
group's first key reports its connect default as defaultOffer; the default is untouched.
stringstringProviderConnectionUpdatePromise<ProviderConnectionResponse>syncPresets
syncPresets(projectId: string, mode: PresetSyncMode): Promise<PresetSyncResponse>"Add new models" (add) or "Restore defaults" (restore) against the built-in catalog.
stringPresetSyncModePromise<PresetSyncResponse>setGroupApiKey
setGroupApiKey(projectId: string, provider: string, apiKey: string): Promise<GroupKeyApplied>Writes the group key; resolves to how many of the group's rows use it (none of their own), and the connect default the group's first key offers as the default model.
stringstringstringPromise<GroupKeyApplied>setGroupApiKeyWithProviderAuthToken
setGroupApiKeyWithProviderAuthToken(projectId: string, provider: string, apiKey: string, token: Omit<ModelProviderAuthToken, "provider" | "updatedAt">, options?: { expectedRefreshToken?: string }): Promise<number>stringstringstringOmit<ModelProviderAuthToken, "provider" | "updatedAt">{ expectedRefreshToken?: string }Promise<number>getGroupApiKey
getGroupApiKey(projectId: string, provider: string): Promise<string | undefined>The group key ([providers.<id>].api_key), never a row's own. Server-side only.
stringstringPromise<string | undefined>getModelApiKey
getModelApiKey(projectId: string, provider: string, modelId: string): Promise<string | undefined>One row's own key (its override of the group's), or undefined. Server-side only.
stringstringstringPromise<string | undefined>getGroupBalanceKey
getGroupBalanceKey(projectId: string, provider: string): Promise<string | undefined>The key a group's account balance is read with: the group key (never a row's own), or else the vendor's environment key where MMSP's vendor client reads it for the group's base URL (none, or the vendor's own default endpoint). Server-side only.
stringstringPromise<string | undefined>setModelApiKeyResolver
setModelApiKeyResolver(resolver: (context: ModelRequestContext) => Promise<string | undefined>): void(context: ModelRequestContext) => Promise<string | undefined>voidmergePlatformModels
mergePlatformModels(projectId: string, provider: string, catalog: PlatformModelCatalog, apiKey: string, applyKeyToExisting: boolean): Promise<PlatformModelApplyResult>stringstringPlatformModelCatalogstringbooleanPromise<PlatformModelApplyResult>completeOnce
completeOnce(projectId: string, prompt: string): Promise<UtilityCompletion>stringstringPromise<UtilityCompletion>getToolModels
getToolModels(projectId: string): Promise<Record<string, ModelRefDto>>The [tools] bindings that name a configured model, by key (an empty object when none does).
stringPromise<Record<string, ModelRefDto>>setToolModel
setToolModel(projectId: string, key: string, model: ModelRefDto | null): Promise<Record<string, ModelRefDto>>Binds key to a configured model, or with null unbinds it; answers the bindings as they now
stand. A model the Project does not configure is a 400. Which keys exist, and which models
a key accepts, is the binding's declarer's rule (ToolModelBindings), not this store's.
stringstringModelRefDto | nullPromise<Record<string, ModelRefDto>>modelRequestApiKey
modelRequestApiKey(projectId: string, model: ModelRefDto): Promise<string | undefined>The key the host resolves for one request to this model (a managed credential it refreshes, as a Session's requests get it), or undefined when the file's own connection applies.
stringModelRefDtoPromise<string | undefined>