Class BowireAiUserConfigStore
- Namespace
- Kuestenlogik.Bowire.Ai
- Assembly
- Kuestenlogik.Bowire.Ai.dll
Reads + writes the per-user AI configuration (ai-config.json)
through the IBowireUserStore seam (#28 Phase 2) so the
Settings UI (#63) survives restart. Single-user installs land at
~/.bowire/ai-config.json; multi-tenant installs partition by
authenticated identity once the SCIM phase ships.
public static class BowireAiUserConfigStore
- Inheritance
-
BowireAiUserConfigStore
- Inherited Members
Remarks
The store layers on top of BowireAiOptions defaults but never collapses the file to "everything matches the default" — that would race the overlay precedence (disk wins over env vars wins over CLI flags wins over BowireAiOptions defaults). When the user picks the same value as the default we still persist it so the next restart doesn't surprise them with a downstream config change.
Methods
HasOverride(string?)
True when a per-workspace override file exists for the given workspace id. Used by the API to flag "this workspace is overriding the global config" so the UI can render correctly.
public static bool HasOverride(string? workspaceId)
Parameters
workspaceIdstring
Returns
RemoveOverride(string)
Drop a workspace's per-workspace override so loads fall back to the global config. No-op when no override exists.
public static void RemoveOverride(string workspaceId)
Parameters
workspaceIdstring
Save(BowireAiOptions, string?)
Persist opts to ai-config.json when no
workspaceId is given, or to ai-config.<workspaceId>.json
when one is. Creates the parent directory if needed. Throws on
I/O errors so the caller (the POST /api/ai/config handler)
can return 500 with the underlying message instead of silently
dropping the user's pick.
public static void Save(BowireAiOptions opts, string? workspaceId = null)
Parameters
optsBowireAiOptionsworkspaceIdstring
TryLoad(string?)
Load the persisted config and return a BowireAiOptions
populated from it. Returns null when no file is present so
callers can distinguish "user hasn't picked anything" from "user
explicitly saved these defaults".
public static BowireAiOptions? TryLoad(string? workspaceId = null)
Parameters
workspaceIdstringWhen set, prefer the workspace's own override file. Falls back to global when the override doesn't exist.