Switch to prefixed IDs and tell agents which Mac a message came from

This commit is contained in:
Ian Gulliver
2026-10-20 23:15:19 -07:00
parent f1296ba13d
commit 59bf17189d
42 changed files with 770 additions and 145 deletions
+7 -2
View File
@@ -2,6 +2,7 @@ package agents
import (
"context"
"crypto/rand"
"fmt"
"log/slog"
"os"
@@ -43,11 +44,15 @@ func vendorOf(model string) api.AgentSessionVendor {
return api.Claude
}
func initialVendorSessionID(vendor api.AgentSessionVendor, id string) string {
func initialVendorSessionID(vendor api.AgentSessionVendor) string {
if vendor != api.Claude {
return ""
}
return id
b := make([]byte, 16)
rand.Read(b)
b[6] = b[6]&0x0f | 0x40
b[8] = b[8]&0x3f | 0x80
return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
}
func (m *Manager) changeModel(ctx context.Context, sess api.AgentSession, model, actor string) (api.AgentSession, error) {