mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 11:02:17 +00:00
refactor(coding-agent): improve settings storage semantics and error handling
This commit is contained in:
parent
5133697bc4
commit
de2736bad0
7 changed files with 386 additions and 152 deletions
|
|
@ -24,6 +24,19 @@ await createAgentSession({
|
|||
|
||||
console.log("Session created with custom settings");
|
||||
|
||||
// Setters update memory immediately and queue persistence writes.
|
||||
// Call flush() when you need a durability boundary.
|
||||
settingsManager.setDefaultThinkingLevel("low");
|
||||
await settingsManager.flush();
|
||||
|
||||
// Surface settings I/O errors at the app layer.
|
||||
const settingsErrors = settingsManager.drainErrors();
|
||||
if (settingsErrors.length > 0) {
|
||||
for (const { scope, error } of settingsErrors) {
|
||||
console.warn(`Warning (${scope} settings): ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// For testing without file I/O:
|
||||
const inMemorySettings = SettingsManager.inMemory({
|
||||
compaction: { enabled: false },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue