94 lines
3.3 KiB
Markdown
94 lines
3.3 KiB
Markdown
# v0.15.0 Phase 1 — Changeset Notes
|
||
|
||
## Files included in this zip (new or fully replaced)
|
||
|
||
```
|
||
server/treepath/path.go NEW — PathMessage, GetActivePath, etc.
|
||
server/treepath/summary.go NEW — IsSummaryMessage, FindSummaryBoundary
|
||
server/treepath/cursor.go NEW — UpdateCursor, NextSiblingIndex
|
||
server/treepath/siblings.go NEW — GetSiblingCount, GetSiblings, FindLeafFromMessage
|
||
server/compaction/compaction.go NEW — Service, Compact, CheckRateLimit
|
||
server/handlers/tree.go REPLACED — thin wrappers delegating to treepath
|
||
server/handlers/summarize.go REPLACED — thin HTTP wrapper using compaction.Service
|
||
src/js/settings-handlers.js REPLACED — bug fixes for display name + role config
|
||
```
|
||
|
||
## Surgical edits needed in existing files
|
||
|
||
### 1. `server/handlers/completion.go`
|
||
|
||
**Delete** the `isSummaryMessage` function (lines ~832–841). It is now
|
||
defined in `treepath/summary.go` and aliased in `handlers/tree.go`.
|
||
Without this deletion, the build fails with a duplicate function error.
|
||
|
||
```go
|
||
// DELETE this entire function from completion.go:
|
||
|
||
// isSummaryMessage checks if a PathMessage has summary metadata.
|
||
func isSummaryMessage(m *PathMessage) bool {
|
||
if m.Metadata == nil {
|
||
return false
|
||
}
|
||
var meta map[string]interface{}
|
||
if err := json.Unmarshal(*m.Metadata, &meta); err != nil {
|
||
return false
|
||
}
|
||
return meta["type"] == "summary"
|
||
}
|
||
```
|
||
|
||
No other changes needed in completion.go — the `isSummaryMessage` calls
|
||
throughout the file now resolve via the alias in `handlers/tree.go`.
|
||
|
||
### 2. `server/main.go`
|
||
|
||
**Change** the summarize handler wiring (~line 252). Old constructor
|
||
takes `(stores, roleResolver)`, new one takes `(*compaction.Service)`.
|
||
|
||
```go
|
||
// ── BEFORE ──
|
||
// Summarize & Continue
|
||
summarize := handlers.NewSummarizeHandler(stores, roleResolver)
|
||
protected.POST("/channels/:id/summarize", summarize.Summarize)
|
||
|
||
// ── AFTER ──
|
||
// Compaction service (shared by manual summarize handler + future auto-scanner)
|
||
compactionSvc := compaction.NewService(stores, roleResolver)
|
||
|
||
// Summarize & Continue (manual compaction via HTTP)
|
||
summarize := handlers.NewSummarizeHandler(compactionSvc)
|
||
protected.POST("/channels/:id/summarize", summarize.Summarize)
|
||
```
|
||
|
||
**Add import** at top of main.go:
|
||
```go
|
||
"git.gobha.me/xcaliber/chat-switchboard/compaction"
|
||
```
|
||
|
||
## Bug fixes included
|
||
|
||
### Display Name not saved or used
|
||
|
||
`handleSaveSettings()` now also saves `display_name` and `email` via
|
||
`API.updateProfile()`. Updates `API.user` and calls `UI.updateUser()` so
|
||
the sidebar reflects the change immediately.
|
||
|
||
### User utility model role not displayed after save
|
||
|
||
`_initUserRolePrimitive()` → `fetchModels` callback now calls the
|
||
global `fetchModels()` (which refreshes `App.models` from the server)
|
||
before returning the model list. This ensures recently added personal
|
||
provider models appear in the role config dropdown after tab switch or
|
||
save-refresh.
|
||
|
||
## Verification
|
||
|
||
After applying all changes:
|
||
|
||
1. `cd server && go build .` — should compile cleanly
|
||
2. Existing integration tests should pass (no behavior change)
|
||
3. Manual test: Settings → Profile → change display name → Save → verify
|
||
sidebar updates and value persists on reload
|
||
4. Manual test: Settings → Model Roles → pick personal provider + model →
|
||
Save → verify dropdown shows saved values after refresh
|