diff --git a/internal/provider/migrate_side.go b/internal/provider/migrate_side.go index 3c60f3cb3..a85ac590a 100644 --- a/internal/provider/migrate_side.go +++ b/internal/provider/migrate_side.go @@ -17,7 +17,7 @@ import ( func init() { movers["devin"] = &mover{ pkg: "@magpie-community/opencode-devin-auth", - min: "0.1.23", // a reply with only usage or metadata is refused before the stream starts, not passed on as an empty success (plugins #297); 0.1.22: organisations under one email are kept apart, each with its own quota (plugins #296); 0.1.21: a chat request past 8 KiB goes as a gzipped Connect frame, as the devin CLI sends it, where an uncompressed large one could be refused 413 (plugins #275); 0.1.20: a tool result's images go to Devin on the tool message that answers the call, as the built-in sent them; 0.1.19: Devin answers in JSON when the request asks for it (response_format into the instructions, as the built-in); 0.1.18: a tool whose parameters have a root anyOf, oneOf or allOf goes as a plain object (#1196), a branch that is a union itself folded too (#1271); a turn's parallel calls split over two assistant messages keep their results (#1275); a temperature or top_p of 0 goes as 1e-6, which Devin takes (plugins #50); a call id with ":" or "#" goes to the agent as one Claude Code takes, and back to Devin as it was (#1304); a week used up, its share left out of GetUserStatus, is 100% and holds the account until its reset (面条); SWE-2, which Devin's quota doesn't count (its Free cost tier), is left out of the day and week and listed free, so a used-up quota no longer holds it (太陽と向日葵); a tool schema with a list type, an array with no items, or properties or an enum with no type goes to a Gemini model in a shape it takes, not "There is an issue with this request" (7eleven); each model carries the price Devin lists for it, and SWE-2 stays free beside the -lightning variants Devin now files under it (太陽と向日葵, Usage showed no cost) + min: "0.1.24", // the CLI's sign-in keeps its "cli" mark as the string OpenCode stores, so OpenCode 1 keeps the account (plugins #396); 0.1.23: a reply with only usage or metadata is refused before the stream starts, not passed on as an empty success (plugins #297); 0.1.22: organisations under one email are kept apart, each with its own quota (plugins #296); 0.1.21: a chat request past 8 KiB goes as a gzipped Connect frame, as the devin CLI sends it, where an uncompressed large one could be refused 413 (plugins #275); 0.1.20: a tool result's images go to Devin on the tool message that answers the call, as the built-in sent them; 0.1.19: Devin answers in JSON when the request asks for it (response_format into the instructions, as the built-in); 0.1.18: a tool whose parameters have a root anyOf, oneOf or allOf goes as a plain object (#1196), a branch that is a union itself folded too (#1271); a turn's parallel calls split over two assistant messages keep their results (#1275); a temperature or top_p of 0 goes as 1e-6, which Devin takes (plugins #50); a call id with ":" or "#" goes to the agent as one Claude Code takes, and back to Devin as it was (#1304); a week used up, its share left out of GetUserStatus, is 100% and holds the account until its reset (面条); SWE-2, which Devin's quota doesn't count (its Free cost tier), is left out of the day and week and listed free, so a used-up quota no longer holds it (太陽と向日葵); a tool schema with a list type, an array with no items, or properties or an enum with no type goes to a Gemini model in a shape it takes, not "There is an issue with this request" (7eleven); each model carries the price Devin lists for it, and SWE-2 stays free beside the -lightning variants Devin now files under it (太陽と向日葵, Usage showed no cost) agents: []string{"devin"}, out: func() ([]Moving, error) { var out []Moving @@ -42,7 +42,7 @@ func init() { md["server"] = s } if l.Home == "" { - md["cli"] = true // the plugin reads the CLI's key again, as the built-in does + md["cli"] = "true" // the plugin reads the CLI's key again, as the built-in does; a string, as OpenCode keeps metadata } out = append(out, Moving{User: l.User, First: l.Active, On: l.On, Lapsed: l.Lapsed != "", Plan: plan, Own: l.Home == "", Auth: map[string]any{"type": "api", "key": key, "metadata": md}}) @@ -55,7 +55,7 @@ func init() { if key == "" { return ls, "", errors.New("Devin: an unreadable plugin sign-in") } - if own, _, err := DevinAuthAt(""); err == nil && (own == key || md["cli"] == true) { + if own, _, err := DevinAuthAt(""); err == nil && (own == key || cliMarked(md)) { return ls, ownUser(ls, "devin", str(md["email"])), nil } if user == "" { @@ -168,7 +168,7 @@ func init() { if key == "" { return ls, "", errors.New("Command Code: an unreadable plugin sign-in") } - if _, own, ok := cmdOwn(); ok && (own.APIKey == key || md["cli"] == true) { + if _, own, ok := cmdOwn(); ok && (own.APIKey == key || cliMarked(md)) { return ls, ownUser(ls, CommandCodePlanID, str(md["email"])), nil } i := -1 diff --git a/internal/provider/migrate_side_test.go b/internal/provider/migrate_side_test.go index 02eff83c2..b178ba58b 100644 --- a/internal/provider/migrate_side_test.go +++ b/internal/provider/migrate_side_test.go @@ -114,13 +114,13 @@ func TestMoveDevin(t *testing.T) { out, before, after := moveAndBack(t, "devin", // the CLI's account, its key since rotated in the CLI: still the CLI's - map[string]any{"type": "api", "key": "key-stale", "metadata": map[string]any{"email": "dev@example.com", "cli": true}}, + map[string]any{"type": "api", "key": "key-stale", "metadata": map[string]any{"email": "dev@example.com", "cli": "true"}}, map[string]any{"type": "api", "key": "key-three", "metadata": map[string]any{"email": "three@example.com", "plan": "Pro"}}) if len(out) != 2 || out[0].User != "two@example.com" || !out[0].First || out[0].Own || out[0].Auth["key"] != "key-two" || out[0].Auth["metadata"].(map[string]any)["server"] != "https://eu.codeium.com" || out[0].Auth["metadata"].(map[string]any)["plan"] != "Devin Max" || out[1].User != "dev@example.com" || !out[1].Own || out[1].Auth["key"] != "key-own" || out[1].Auth["metadata"].(map[string]any)["server"] != nil || - out[1].Auth["metadata"].(map[string]any)["cli"] != true || out[0].Auth["metadata"].(map[string]any)["cli"] != nil { + out[1].Auth["metadata"].(map[string]any)["cli"] != "true" || out[0].Auth["metadata"].(map[string]any)["cli"] != nil { t.Fatalf("out %+v", out) } ls := loginsOfAgent(after, "devin") diff --git a/internal/provider/plugin_accounts.go b/internal/provider/plugin_accounts.go index a3c461809..af2e75d5b 100644 --- a/internal/provider/plugin_accounts.go +++ b/internal/provider/plugin_accounts.go @@ -93,6 +93,13 @@ type pluginLogin struct { acct plugin.Account } +// cliMarked says a sign-in carries the "cli" mark of the agent's own +// sign-in: true as a mover wrote it before, "true" as the Devin plugin +// writes it since 0.1.24 (plugins #396). +func cliMarked(md map[string]any) bool { + return md["cli"] == true || md["cli"] == "true" +} + // pluginOwn says a plugin sign-in is the agent's own (its CLI's, its // app's), which the plugin reads where the agent keeps it. The movers mark // it so (migrate_side.go, migrate_kiro.go, migrate_workbuddy.go, @@ -101,7 +108,7 @@ func pluginOwn(id string, auth map[string]any) bool { md, _ := auth["metadata"].(map[string]any) switch id { case "devin", CommandCodePlanID: - return md["cli"] == true + return cliMarked(md) case "grok": return samePath(str(auth["refresh"]), GrokHome()) case "cursor":