fix scratchpad routing by caller project

This commit is contained in:
2026-05-27 13:50:17 +01:00
parent 80a14502c4
commit c56de27f44
6 changed files with 102 additions and 34 deletions

View File

@@ -150,6 +150,12 @@ func (r *ProjectRegistry) Count() int {
return len(r.projects)
}
func (r *ProjectRegistry) DefaultProject() *Project {
r.mu.Lock()
defer r.mu.Unlock()
return r.projects[r.defaultProjectKey]
}
func (r *ProjectRegistry) Shutdown() {
r.mu.Lock()
projects := make([]*Project, 0, len(r.projects))
@@ -418,24 +424,24 @@ func (r *ProjectRegistry) TimerList(callerID string) ([]mcp.TimerInfo, error) {
return r.hostForCaller(callerID).TimerList(callerID)
}
func (r *ProjectRegistry) ScratchpadList() ([]scratchpad.Entry, error) {
return r.hostForCaller("").ScratchpadList()
func (r *ProjectRegistry) ScratchpadList(callerID string) ([]scratchpad.Entry, error) {
return r.hostForCaller(callerID).ScratchpadList(callerID)
}
func (r *ProjectRegistry) ScratchpadRead(name string) (string, string, error) {
return r.hostForCaller("").ScratchpadRead(name)
func (r *ProjectRegistry) ScratchpadRead(callerID, name string) (string, string, error) {
return r.hostForCaller(callerID).ScratchpadRead(callerID, name)
}
func (r *ProjectRegistry) ScratchpadWrite(name, content, expectedRevision string) (string, error) {
return r.hostForCaller("").ScratchpadWrite(name, content, expectedRevision)
func (r *ProjectRegistry) ScratchpadWrite(callerID, name, content, expectedRevision string) (string, error) {
return r.hostForCaller(callerID).ScratchpadWrite(callerID, name, content, expectedRevision)
}
func (r *ProjectRegistry) ScratchpadAppend(name, content string) error {
return r.hostForCaller("").ScratchpadAppend(name, content)
func (r *ProjectRegistry) ScratchpadAppend(callerID, name, content string) error {
return r.hostForCaller(callerID).ScratchpadAppend(callerID, name, content)
}
func (r *ProjectRegistry) ScratchpadDelete(name string) error {
return r.hostForCaller("").ScratchpadDelete(name)
func (r *ProjectRegistry) ScratchpadDelete(callerID, name string) error {
return r.hostForCaller(callerID).ScratchpadDelete(callerID, name)
}
func (r *ProjectRegistry) WhoAmI(callerID string) mcp.WhoAmI {