sessions: WorkBuddy AI's own sessions are listed under its name (maxleebeta)
maxleebeta (Discord #general) is signed in to both WorkBuddy builds, the
China one and the international one, and the international one was
missing from an agent list. The provider side lists both: provider.All()
and CatalogFor have workbuddy/* and workbuddy-ai/* models under "WorkBuddy"
and "WorkBuddy AI". The sessions package, though, read only ~/.workbuddy.
WorkBuddy AI keeps the same files in ~/.workbuddy-ai (its product.json
dataFolderName, as internal/agent wires it), and nothing read them. So
WorkBuddy AI was missing from the Sessions page's agent picker, from
Usage > Sessions' agent strip, from the reading consent's folders and
from the usage ledger.
Changed:
- WorkBuddyAIDir and workbuddyAIFiles read ~/.workbuddy-ai/projects as
agent workbuddy-ai with WorkBuddy's parser, in allFiles, Dirs,
callSources (wholeCallReaders), Deletable and Found.
- buddyDir picks WorkBuddy AI's own models.json for the
call-through-magpie skip.
- A ~/.workbuddy-ai that is a link to ~/.workbuddy is read once, as
WorkBuddy's.
- skillsCounted names workbuddy-ai (WorkBuddy's parser counts no skills).
- docs/subsystems/gateway-sessions.md has a line for it.
Tests:
- TestWorkBuddyAI checks sessions, cwd, title, tokens, Deletable, Found,
calls, the skip of magpie's gateway, and the link.
- TestWorkBuddyAIGatewayIsItsOwn: one model id that WorkBuddy's
models.json gives to magpie and WorkBuddy AI's gives to the user's own
provider.
- TestWorkBuddyAISessionsListedUnderTheirName checks /api/sessions,
/api/sessions/manage and /api/sessions/stats: name "WorkBuddy AI",
icon workbuddy-color, deletable.
Broken by hand (each went red): allFiles, parserFor, Deletable, Found,
the call sources, the wholeCallReaders entry, buddyDir.
Run on mote at this head (base origin/main c86fa2a34):
- gofmt -l and go vet for darwin, GOOS=linux and GOOS=windows -tags nogui
(internal/sessions, internal/gui): clean.
- go test -tags nogui -timeout 45m over sessions and every package that
imports it: ok for sessions (after the skillsCounted line), agent, cli,
davsync, gui, otlp, tui, tune and usage.
- internal/gateway failed only TestCodexPoolSaysTheClientsVersion, which
is #4807 (red in a full package run on mote, another test's Codex
identity reaches it). Nothing here touches it.
Not tried:
- The reporter's screenshots, which we couldn't download, so their list
may be another one.
- A real WorkBuddy AI install.
- The Agents page's detection of a newer, renamed WorkBuddy AI bundle
(5.9.3).
- Windows.
- WORKBUDDY_CONFIG_DIR set: both apps then use that folder, and its
sessions are listed as WorkBuddy's.
- No GUI JS changed (the page reads the agents from the API), so no
Playwright files were run.
This commit is contained in:
@@ -550,7 +550,12 @@ are read (`sessions.Calls`, from `callSources` in
|
||||
Code's, Claude Desktop's and Cowork's, Codex's (and both in WSL), and,
|
||||
read a file at a time (`wholeCallReaders` in
|
||||
[`call_cache.go`](../../internal/sessions/call_cache.go)), OpenCode's
|
||||
(#680), ZCode's, DeepSeek Harness's (`dsh`), WorkBuddy's, CodeBuddy
|
||||
(#680), ZCode's, DeepSeek Harness's (`dsh`), WorkBuddy's, WorkBuddy
|
||||
AI's (the international build's own `~/.workbuddy-ai`, read as
|
||||
WorkBuddy's with its own models.json, listed and deletable under its own
|
||||
name, and read once as WorkBuddy's when it is a link to `~/.workbuddy`:
|
||||
`TestWorkBuddyAI`, `TestWorkBuddyAIGatewayIsItsOwn`,
|
||||
`TestWorkBuddyAISessionsListedUnderTheirName`), CodeBuddy
|
||||
Code's (#1779; its sessions are on the Sessions page too, from the same
|
||||
`projects/<cwd>/<id>.jsonl` files read as WorkBuddy's, resumed with
|
||||
`codebuddy --resume <id>` and deletable, #2657: `TestCodeBuddy`,
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/yetone/magpie/internal/sessions"
|
||||
)
|
||||
|
||||
// WorkBuddy AI's sessions (~/.workbuddy-ai/projects, the international
|
||||
// build's folder, here holding the sessions package's WorkBuddy fixture)
|
||||
// reach the Sessions page's agents and Usage > Sessions under WorkBuddy
|
||||
// AI's name and icon, beside the China build's, and the page offers them to
|
||||
// the trash (maxleebeta on Discord: signed in to both, the international
|
||||
// build was missing from the agents).
|
||||
func TestWorkBuddyAISessionsListedUnderTheirName(t *testing.T) {
|
||||
h := sandboxHome(t)
|
||||
src := filepath.Join("..", "sessions", "testdata", "workbuddy")
|
||||
dst := filepath.Join(h, ".workbuddy-ai")
|
||||
if err := filepath.WalkDir(src, func(p string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rel, _ := filepath.Rel(src, p)
|
||||
if d.IsDir() {
|
||||
return os.MkdirAll(filepath.Join(dst, rel), 0o755)
|
||||
}
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(filepath.Join(dst, rel), b, 0o644)
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sessions.Reset()
|
||||
t.Cleanup(sessions.Reset)
|
||||
// the stats another test kept are not this HOME's
|
||||
forgetStats()
|
||||
t.Cleanup(forgetStats)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
sessionRoutes(mux, folderOnly{})
|
||||
sessionManageRoutes(mux, folderOnly{})
|
||||
get := func(path string, v any) {
|
||||
t.Helper()
|
||||
w := httptest.NewRecorder()
|
||||
mux.ServeHTTP(w, httptest.NewRequest("GET", path, nil))
|
||||
if w.Code != 200 {
|
||||
t.Fatalf("%s: %d %s", path, w.Code, w.Body)
|
||||
}
|
||||
if err := json.Unmarshal(w.Body.Bytes(), v); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
type named struct {
|
||||
Agent string `json:"agent"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Resume string `json:"resume"`
|
||||
}
|
||||
var list struct{ Sessions []named }
|
||||
get("/api/sessions", &list)
|
||||
n := 0
|
||||
for _, s := range list.Sessions {
|
||||
if s.Agent != "workbuddy-ai" {
|
||||
continue
|
||||
}
|
||||
n++
|
||||
if s.Name != "WorkBuddy AI" || s.Icon != "workbuddy-color" {
|
||||
t.Errorf("listed as %q (%s), want WorkBuddy AI (workbuddy-color)", s.Name, s.Icon)
|
||||
}
|
||||
// a desktop app: nothing resumes it from a terminal
|
||||
if s.Resume != "" {
|
||||
t.Errorf("resume %q", s.Resume)
|
||||
}
|
||||
}
|
||||
if n != 3 {
|
||||
t.Fatalf("want 3 WorkBuddy AI sessions, got %d: %+v", n, list.Sessions)
|
||||
}
|
||||
var manage struct {
|
||||
Agents []struct {
|
||||
named
|
||||
Deletable bool `json:"deletable"`
|
||||
}
|
||||
}
|
||||
get("/api/sessions/manage", &manage)
|
||||
found := false
|
||||
for _, a := range manage.Agents {
|
||||
if a.Agent == "workbuddy-ai" {
|
||||
found = true
|
||||
if a.Name != "WorkBuddy AI" {
|
||||
t.Errorf("the Sessions page's agent is %q, want WorkBuddy AI", a.Name)
|
||||
}
|
||||
if !a.Deletable {
|
||||
t.Error("the Sessions page offers no trash for WorkBuddy AI's sessions")
|
||||
}
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("no workbuddy-ai among the Sessions page's agents: %+v", manage.Agents)
|
||||
}
|
||||
var stats struct {
|
||||
Agents map[string]string `json:"agents"`
|
||||
}
|
||||
get("/api/sessions/stats?days=0", &stats)
|
||||
if stats.Agents["workbuddy-ai"] != "WorkBuddy AI" {
|
||||
t.Errorf("Usage > Sessions' agent strip names it %q: %v", stats.Agents["workbuddy-ai"], stats.Agents)
|
||||
}
|
||||
}
|
||||
@@ -207,6 +207,7 @@ func Found() []string {
|
||||
add("qoder-cn", filepath.Join(QoderDir("qoder-cn"), "projects"))
|
||||
add("grok", filepath.Join(GrokDir(), "sessions"))
|
||||
add("workbuddy", filepath.Join(WorkBuddyDir(), "projects"))
|
||||
add("workbuddy-ai", filepath.Join(WorkBuddyAIDir(), "projects"))
|
||||
add("codebuddy", filepath.Join(CodeBuddyDir(), "projects"))
|
||||
add("omp", filepath.Join(OmpDir(), "sessions"))
|
||||
add("droid", filepath.Join(FactoryDir(), "sessions"))
|
||||
|
||||
@@ -242,10 +242,11 @@ func keepCalls(path string, st *callFile) {
|
||||
// in callFiles needs an entry here, in lineCallReaders or in
|
||||
// resumeCallReaders, or its calls are never read.
|
||||
var wholeCallReaders = map[string]func(file) (*callFile, bool){
|
||||
"opencode": readOpenCodeCalls,
|
||||
"zcode": readZCodeCalls,
|
||||
"workbuddy": readWorkBuddyCalls,
|
||||
"codebuddy": readWorkBuddyCalls, // #1779
|
||||
"opencode": readOpenCodeCalls,
|
||||
"zcode": readZCodeCalls,
|
||||
"workbuddy": readWorkBuddyCalls,
|
||||
"workbuddy-ai": readWorkBuddyCalls,
|
||||
"codebuddy": readWorkBuddyCalls, // #1779
|
||||
// #1605
|
||||
"minimax-code": readMiniMaxCalls,
|
||||
"agy": readAgyCalls, // #2097
|
||||
|
||||
@@ -339,7 +339,7 @@ func callSourcesWith(codex []file) []file { return callSourcesInto(nil, codex) }
|
||||
// callSourcesInto is callSourcesWith appended to out.
|
||||
func callSourcesInto(out []file, codex []file) []file {
|
||||
lists := append(callFileLists(codex), openCodeCallFiles(), zcodeCallFiles(), dshCallFiles(),
|
||||
minimaxCallFiles(), kimiCallFiles(), wslFiles("kimi"), piCallFiles(), codebuddyCallFiles(),
|
||||
minimaxCallFiles(), kimiCallFiles(), wslFiles("kimi"), piCallFiles(), codebuddyCallFiles(), workbuddyAIFiles(),
|
||||
agyCallFiles(), // #2097
|
||||
workbuddyCallFiles(), grokCallFiles()) // #4423
|
||||
if out == nil {
|
||||
|
||||
@@ -59,8 +59,11 @@ func CodeBuddyDir() string {
|
||||
|
||||
// buddyDir is the folder an agent read here keeps its models.json in.
|
||||
func buddyDir(agent string) string {
|
||||
if agent == "codebuddy" {
|
||||
switch agent {
|
||||
case "codebuddy":
|
||||
return CodeBuddyDir()
|
||||
case "workbuddy-ai":
|
||||
return WorkBuddyAIDir()
|
||||
}
|
||||
return WorkBuddyDir()
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ type AgentCount struct {
|
||||
// those kept as files of their own, in a layout magpie knows whole.
|
||||
func Deletable(agent string) bool {
|
||||
switch agent {
|
||||
case "claude", "qoder", "qoder-cn", "workbuddy", "codebuddy", "codex", "pi", "raft", "cindy", "omp", "cursor", "dsh", "droid", "agy":
|
||||
case "claude", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "codebuddy", "codex", "pi", "raft", "cindy", "omp", "cursor", "dsh", "droid", "agy":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -120,7 +120,7 @@ type Session struct {
|
||||
// Gateway: seen only through magpie's gateway, with no file of the
|
||||
// agent's on this computer (external.go)
|
||||
Gateway bool `json:"gateway,omitempty"`
|
||||
Agent string `json:"agent"` // magpie agent id: claude, codex, opencode, pi, omp, zcode, dsh, cline, qoder, qoder-cn, grok, workbuddy, codebuddy, droid, cursor, hermes, alma, kimi, agy
|
||||
Agent string `json:"agent"` // magpie agent id: claude, codex, opencode, pi, omp, zcode, dsh, cline, qoder, qoder-cn, grok, workbuddy, workbuddy-ai, codebuddy, droid, cursor, hermes, alma, kimi, agy
|
||||
ID string `json:"id"`
|
||||
Cwd string `json:"cwd"`
|
||||
Title string `json:"title"` // the name it was given, else the agent's own title, else the first prompt
|
||||
@@ -698,7 +698,7 @@ func allFiles() []file {
|
||||
// agent's name is held to that agent too
|
||||
return allowed(distinctOf(append(callFileLists(codexFiles()), openCodeFiles(), piFiles(), raftFiles(), cindyFiles(),
|
||||
wslFiles("pi", "raft", "omp", "kimi"), zcodeFiles(), dshFiles(), clineFiles(), ccFiles("qoder", QoderDir("qoder")), ccFiles("qoder-cn", QoderDir("qoder-cn")),
|
||||
grokFiles(), workbuddyFiles(), codebuddyFiles(), droidFiles(), ompFiles(), cursorFiles(), hermesFiles(), almaFiles(), kimiFiles(), agyFiles())...))
|
||||
grokFiles(), workbuddyFiles(), workbuddyAIFiles(), codebuddyFiles(), droidFiles(), ompFiles(), cursorFiles(), hermesFiles(), almaFiles(), kimiFiles(), agyFiles())...))
|
||||
}
|
||||
|
||||
// distinctOf is lists one after another with each path kept once, the
|
||||
@@ -785,6 +785,7 @@ func Dirs() []string {
|
||||
{QoderDir("qoder-cn"), filepath.Join(QoderDir("qoder-cn"), "projects")},
|
||||
{GrokDir(), filepath.Join(GrokDir(), "sessions")},
|
||||
{WorkBuddyDir(), filepath.Join(WorkBuddyDir(), "projects")},
|
||||
{WorkBuddyAIDir(), filepath.Join(WorkBuddyAIDir(), "projects")},
|
||||
{CodeBuddyDir(), filepath.Join(CodeBuddyDir(), "projects")},
|
||||
{OmpDir(), filepath.Join(OmpDir(), "sessions")},
|
||||
{FactoryDir(), filepath.Join(FactoryDir(), "sessions")},
|
||||
@@ -1918,7 +1919,7 @@ func parserFor(agent string) sessionParser {
|
||||
return sessionParser{line: codexBody}
|
||||
case "pi", "raft", "cindy", "omp":
|
||||
return sessionParser{line: piParse}
|
||||
case "workbuddy", "codebuddy":
|
||||
case "workbuddy", "workbuddy-ai", "codebuddy":
|
||||
return sessionParser{line: workbuddyLine}
|
||||
default:
|
||||
return sessionParser{line: claudeLine, claude: true}
|
||||
|
||||
@@ -44,6 +44,7 @@ var skillsCounted = map[string]struct {
|
||||
"kimi": {none: "Kimi Code's wire tool.call is counted by name, but how it brings in a skill was not seen in a real session (only the retired Python kimi-cli 1.52 was run)"},
|
||||
"workbuddy": {none: "its Skill function_call lines are not read; no real session with tool lines"},
|
||||
"codebuddy": {none: "reads with WorkBuddy's parser, which counts no skills"},
|
||||
"workbuddy-ai": {none: "reads with WorkBuddy's parser, which counts no skills"},
|
||||
"hermes": {none: "its skill_view tool is not read; hermes is not run in a sandbox (it rewrites the live launcher)"},
|
||||
"cursor": {none: "selected skills live in selectedContext; needs a signed-in Cursor for a real session"},
|
||||
"agy": {none: "skill_lookup's keys are not known from a real session"},
|
||||
|
||||
@@ -40,6 +40,27 @@ func WorkBuddyDir() string {
|
||||
// a session's own <id>.jsonl, and a subagent's under <id>/subagents/.
|
||||
func workbuddyFiles() []file { return buddyFiles("workbuddy", WorkBuddyDir()) }
|
||||
|
||||
// WorkBuddyAIDir is WorkBuddy AI's folder, the international build's
|
||||
// (www.workbuddy.ai): ~/.workbuddy-ai, its cli/product.json's
|
||||
// dataFolderName, as internal/agent's workbuddy.go wires it.
|
||||
func WorkBuddyAIDir() string {
|
||||
home, _ := os.UserHomeDir()
|
||||
return filepath.Join(home, ".workbuddy-ai")
|
||||
}
|
||||
|
||||
// workbuddyAIFiles are WorkBuddy AI's sessions, kept as the China build
|
||||
// keeps its own, in its own folder: listed under its own agent, not
|
||||
// WorkBuddy's, so someone signed in to both apps finds each one's
|
||||
// (maxleebeta on Discord: the international build was missing from the
|
||||
// Sessions page's agents). None when its folder is WorkBuddy's (a link),
|
||||
// which workbuddyFiles reads already.
|
||||
func workbuddyAIFiles() []file {
|
||||
if sameFolder(WorkBuddyAIDir(), WorkBuddyDir()) {
|
||||
return nil
|
||||
}
|
||||
return buddyFiles("workbuddy-ai", WorkBuddyAIDir())
|
||||
}
|
||||
|
||||
// codebuddyFiles are the same under CodeBuddy Code's projects/: the CLI keeps
|
||||
// them as its desktop sibling does, one agent's folder apart (#1779). None
|
||||
// when its folder is WorkBuddy's, which workbuddyFiles reads already.
|
||||
@@ -69,8 +90,10 @@ func sameFolder(a, b string) bool {
|
||||
}
|
||||
|
||||
// isBuddy is whether agent keeps its sessions the way WorkBuddy does: its
|
||||
// own, or CodeBuddy Code's.
|
||||
func isBuddy(agent string) bool { return agent == "workbuddy" || agent == "codebuddy" }
|
||||
// own, WorkBuddy AI's, or CodeBuddy Code's.
|
||||
func isBuddy(agent string) bool {
|
||||
return agent == "workbuddy" || agent == "workbuddy-ai" || agent == "codebuddy"
|
||||
}
|
||||
|
||||
// buddyFiles are the sessions under projects/ in dir, as agent's: WorkBuddy's,
|
||||
// or CodeBuddy Code's, which keeps them the same way.
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package sessions
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// WorkBuddy AI, the international build, keeps its sessions as the China
|
||||
// build does, in ~/.workbuddy-ai: someone signed in to both apps finds each
|
||||
// one's sessions under its own agent on the Sessions page, its calls on the
|
||||
// Usage page and its folder among those the reading consent lists
|
||||
// (maxleebeta on Discord: the international build was missing from the
|
||||
// agents). The fixture is the China build's own files, as the two builds
|
||||
// are one app writing to its own folder.
|
||||
func TestWorkBuddyAI(t *testing.T) {
|
||||
inZone(t, 0)
|
||||
home := setupAgents(t)
|
||||
copyTree(t, "testdata/workbuddy", filepath.Join(home, ".workbuddy-ai"))
|
||||
Reset()
|
||||
ss := List(0)
|
||||
if n := count(ss, "workbuddy-ai"); n != 3 {
|
||||
t.Fatalf("want 3 WorkBuddy AI sessions, got %d", n)
|
||||
}
|
||||
// the China build's stay its own, each listed once
|
||||
if n := count(ss, "workbuddy"); n != 3 {
|
||||
t.Fatalf("want 3 WorkBuddy sessions, got %d", n)
|
||||
}
|
||||
w := find(t, ss, "workbuddy-ai", wbID)
|
||||
if w.Cwd != "/work/wb" || w.Title != "Launch notes draft" || w.Resume != "" {
|
||||
t.Fatalf("workbuddy-ai: %+v", w)
|
||||
}
|
||||
if m := model(w, "hy3"); m.Tokens != (Tokens{2422, 968, 8777, 0, 0}) {
|
||||
t.Fatalf("hy3: %+v", m)
|
||||
}
|
||||
// brought over from its older history: the cwd from its meta file
|
||||
if o := find(t, ss, "workbuddy-ai", wbOldID); o.Cwd != "/work/wb-old" {
|
||||
t.Fatalf("old: %+v", o)
|
||||
}
|
||||
if !Deletable("workbuddy-ai") {
|
||||
t.Fatal("WorkBuddy AI's sessions are not deletable")
|
||||
}
|
||||
if !slices.Contains(Found(), "workbuddy-ai") {
|
||||
t.Fatalf("the reading consent doesn't list WorkBuddy AI: %v", Found())
|
||||
}
|
||||
|
||||
// its calls reach the usage ledger, the one its own models.json names
|
||||
// as magpie's gateway left to the gateway, as WorkBuddy's are (its own
|
||||
// calls alone: the fixture's message ids are WorkBuddy's, which the
|
||||
// ledger counts once over every agent)
|
||||
cs := map[string]Call{}
|
||||
for _, c := range AgentCalls(time.Time{}, "workbuddy-ai") {
|
||||
if c.Agent == "workbuddy-ai" && c.Msg != "" {
|
||||
cs[c.Msg] = c
|
||||
}
|
||||
}
|
||||
if m := cs["m1"]; m.Model != "hy3" || m.Tokens != (Tokens{200, 80, 1000, 0, 0}) {
|
||||
t.Fatalf("WorkBuddy AI's reply: %+v (%v)", m, cs)
|
||||
}
|
||||
if _, dup := cs["wm1"]; dup {
|
||||
t.Fatalf("a call made to magpie's gateway was read from the file too: %+v", cs["wm1"])
|
||||
}
|
||||
if _, ok := cs["wm2"]; !ok {
|
||||
t.Fatalf("no call for the user's own custom provider: %+v", cs)
|
||||
}
|
||||
|
||||
// a ~/.workbuddy-ai that is a link to ~/.workbuddy is read once, as
|
||||
// WorkBuddy's
|
||||
if err := os.RemoveAll(filepath.Join(home, ".workbuddy-ai")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.Symlink(filepath.Join(home, ".workbuddy"), filepath.Join(home, ".workbuddy-ai")); err != nil {
|
||||
t.Skip("no symlinks here:", err)
|
||||
}
|
||||
Reset()
|
||||
ss = List(0)
|
||||
if n, m := count(ss, "workbuddy-ai"), count(ss, "workbuddy"); n != 0 || m != 3 {
|
||||
t.Fatalf("one folder under two names: %d WorkBuddy AI and %d WorkBuddy sessions, want 0 and 3", n, m)
|
||||
}
|
||||
}
|
||||
|
||||
// WorkBuddy AI's own models.json says which of its calls went through
|
||||
// magpie's gateway, not WorkBuddy's: with the China build's model pointed at
|
||||
// magpie and the international build's same id at the user's own provider,
|
||||
// the international build's call is its own, read from its file.
|
||||
func TestWorkBuddyAIGatewayIsItsOwn(t *testing.T) {
|
||||
inZone(t, 0)
|
||||
home := setupAgents(t)
|
||||
copyTree(t, "testdata/workbuddy", filepath.Join(home, ".workbuddy-ai"))
|
||||
// WorkBuddy's own-proxy/glm-5 is magpie's; WorkBuddy AI's keeps the
|
||||
// fixture's models.json, where it is the user's
|
||||
viaMagpie := `[{"id": "own-proxy/glm-5", "name": "GLM-5", "vendor": "magpie",
|
||||
"apiKey": "magpie-workbuddy", "url": "http://127.0.0.1:3425/v1/chat/completions"}]
|
||||
`
|
||||
if err := os.WriteFile(filepath.Join(home, ".workbuddy", "models.json"), []byte(viaMagpie), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
Reset()
|
||||
if !workbuddyGateway("custom-local:own-proxy/glm-5") {
|
||||
t.Fatal("WorkBuddy's models.json is not read as naming magpie's gateway")
|
||||
}
|
||||
if buddyGateway(WorkBuddyAIDir(), "custom-local:own-proxy/glm-5") {
|
||||
t.Fatal("WorkBuddy AI's own provider is read as magpie's gateway")
|
||||
}
|
||||
var ai, wb bool
|
||||
for _, c := range Calls(time.Time{}) {
|
||||
if c.Msg == "wm2" {
|
||||
ai = ai || c.Agent == "workbuddy-ai"
|
||||
wb = wb || c.Agent == "workbuddy"
|
||||
}
|
||||
}
|
||||
if !ai || wb {
|
||||
t.Fatalf("the call to the user's own provider: read as WorkBuddy AI's %v, as WorkBuddy's %v; want true, false", ai, wb)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user