Changeset 0.21.1 (#86)

This commit is contained in:
2026-03-01 14:44:55 +00:00
parent 817062e5fc
commit 70aa78e486
18 changed files with 3778 additions and 29 deletions

View File

@@ -29,6 +29,7 @@ import (
postgres "git.gobha.me/xcaliber/chat-switchboard/store/postgres"
"git.gobha.me/xcaliber/chat-switchboard/tools"
"git.gobha.me/xcaliber/chat-switchboard/tools/search"
"git.gobha.me/xcaliber/chat-switchboard/workspace"
)
func main() {
@@ -150,6 +151,20 @@ func main() {
// ── EventBus (created early — needed by role resolver) ──
bus := events.NewBus()
// ── Workspace FS (v0.21.0) ──────────────
// Provides file operations for workspace storage primitive.
// Nil-safe: handler checks wfs != nil before operating.
var wfs *workspace.FS
if cfg.StoragePath != "" {
wfs = workspace.NewFS(cfg.StoragePath+"/workspaces", stores.Workspaces)
if err := wfs.Init(); err != nil {
log.Printf("⚠ Workspace FS init failed: %v", err)
wfs = nil
} else {
log.Printf(" 📁 Workspace FS initialized at %s/workspaces", cfg.StoragePath)
}
}
// Role resolver for model role dispatch (needs stores + vault + bus)
roleResolver := roles.NewResolver(stores, keyResolver).WithBus(bus)
@@ -400,6 +415,24 @@ func main() {
protected.PUT("/notifications/preferences/:type", notifH.SetPreference)
protected.DELETE("/notifications/preferences/:type", notifH.DeletePreference)
// Workspaces (v0.21.0)
if wfs != nil {
wsH := handlers.NewWorkspaceHandler(stores, wfs)
protected.POST("/workspaces", wsH.Create)
protected.GET("/workspaces/:id", wsH.Get)
protected.PATCH("/workspaces/:id", wsH.Update)
protected.DELETE("/workspaces/:id", wsH.Delete)
protected.GET("/workspaces/:id/files", wsH.ListFiles)
protected.GET("/workspaces/:id/files/read", wsH.ReadFile)
protected.PUT("/workspaces/:id/files/write", wsH.WriteFile)
protected.DELETE("/workspaces/:id/files/delete", wsH.DeleteFileHandler)
protected.POST("/workspaces/:id/files/mkdir", wsH.Mkdir)
protected.POST("/workspaces/:id/archive/upload", wsH.UploadArchive)
protected.GET("/workspaces/:id/archive/download", wsH.DownloadArchive)
protected.POST("/workspaces/:id/reconcile", wsH.Reconcile)
protected.GET("/workspaces/:id/stats", wsH.Stats)
}
// Attachments (file upload/download)
attachH := handlers.NewAttachmentHandler(stores, objStore, extQueue)
protected.POST("/channels/:id/attachments", attachH.Upload)