foobra asked for DevEco Code (npm @deveco/deveco-code), Huawei's
HarmonyOS coding agent. It is OpenCode underneath, so it joins through
openCodeLike as MiMo Code did (03a01a548):
- Config in ~/.config/deveco. magpie writes the first of deveco.jsonc,
deveco.json, config.json there (the one DevEco reads last wins its
merge), or DEVECO_CONFIG_DIR when that is an absolute folder; agentenv
carries DEVECO_CONFIG_DIR. Auth at ~/.local/share/deveco/auth.json.
- Its provider block carries the key magpie-deveco, not the plain one.
0.2.3 sends "deveco/0.2.3 ai-sdk/provider-utils/4.0.23 runtime/bun/1.4.2"
on chat, but parts of its code still send opencode/<version>, so the key
keeps its usage DevEco's whichever it sends. Check flags the plain key,
and Sync writes DevEco's back. OpenCode's own key is unchanged.
- The user's own provider, small_model, $schema and comments stay; the
model they were on comes back on Disconnect.
- Library: AGENTS.md instructions (with the "reads Claude Code's
CLAUDE.md" note, as OpenCode and MiMo Code), MCP in OpenCode's shape,
skills. No WSL folder.
- Install/update: npm @deveco/deveco-code on macOS and Windows only, as the
package has no Linux binary (new cliSpec.only); the self installer under
~/.local/share/deveco/versions updates with `deveco upgrade`.
- Icon: DevEco's own logo, byte for byte from its IntelliJ plugin's
pluginIcon.svg. Model picker /models. Route hue, READMEs (en, zh), site
agent lists (en, zh, ja), docs/reference.md, subsystem pages, CLI help.
What was run
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- go test -tags nogui: internal/library, agentenv, proc, cli, gui, usage
pass; internal/agent passes in 559s with -timeout 40m;
its first run, at the default 10m with load average ~40 from other
sessions, was cut off by the timeout (no test had failed).
- New deveco_test.go: config lookup and DEVECO_CONFIG_DIR, the key, and
Connect/Check/Sync/Disconnect against a deveco.jsonc holding the user's
own model, provider, small_model, $schema and a comment. Made
openCodeKeyAt return the plain key by hand: TestDevEcoKeyNamesIt and
TestDevEcoConnectKeepsTheUsersOwn go red.
- GUI: new library-deveco.test.cjs (the note in en, zh, zh-TW, ja, de,
and the icon draws), chromium and webkit; red with deveco taken out of
library.js's note. library-instr-sets, library-instr-busy,
panel-routing, agent-connect, library-desktop-skills, getting-started,
filter-ime, routing-account-identity pass in both engines.
- Real use, sandbox HOME: npm-installed @deveco/deveco-code 0.2.3,
`deveco auth consent --accept` (sandbox only, no Huawei sign-in). magpie
serve on 127.0.0.1:3592 with a fake upstream; `magpie deveco fake/fake-1`
wrote provider magpie (magpie-deveco, http://127.0.0.1:3592/v1) beside
the user's own and kept the file's comment; `deveco run "Reply with one
word: ping"` answered from the fake, and `magpie usage today` counted it
under DevEco Code. The User-Agent above is what it sent.
Not tried
- Windows, and DevEco Studio's plugin mode; a Huawei-signed-in DevEco.
- `magpie deveco <model>` then `magpie deveco default` doesn't bring back
the model the user was on before: the CLI set path doesn't stash. It is
the same for OpenCode today; Connect/Disconnect in the GUI does.
Reported-by: foobra
79 lines
2.6 KiB
Go
79 lines
2.6 KiB
Go
package agent
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
// An agent that spells a model provider/model, magpie's as magpie/<ref>:
|
|
// one of its own providers named as one of magpie's (its own relay, and
|
|
// magpie's relay) is its own model, not magpie's. The row isn't connected
|
|
// on it, and Disconnect from magpie puts it back and is done, rather than
|
|
// leaving the row connected on the model it went back to (#835, OpenHanako's
|
|
// own deepseek/deepseek-v4-pro).
|
|
func TestOwnProviderNamedAsMagpies(t *testing.T) {
|
|
ids := []string{"agy", "opencode", "openchamber", "mimocode", "deveco", "pi", "aside", "omo", "prime-agent", "goose", "zed", "vscode",
|
|
"crush", "dsh", "commandcode", "fx", "omp", "hermes", "morph", "kimi", "empryo", "minimax-code", "droid",
|
|
"qoder", "qoder-cn", "grok", "atomcode", "cline", "snow"}
|
|
for _, id := range ids {
|
|
t.Run(id, func(t *testing.T) {
|
|
if id == "aside" {
|
|
asideHome(t)
|
|
} else {
|
|
syncHome(t)
|
|
}
|
|
a, err := Find(id)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
f := &a.Fields[0]
|
|
if id == "cline" {
|
|
// a model of OpenRouter's, the provider Cline is on
|
|
hanakoWrite(t, a.Path, `{"version":1,"modes":{},"providers":{},"lastUsedProvider":"openrouter"}`, 0o600)
|
|
}
|
|
if err := f.Set("relay/glm-4.6"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if v := f.Get(); v != "relay/glm-4.6" {
|
|
t.Fatalf("own model reads %q", v)
|
|
}
|
|
if a.Wired() {
|
|
t.Fatal("its own relay/glm-4.6 reads as magpie's")
|
|
}
|
|
if err := a.Connect(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !a.Wired() {
|
|
t.Fatalf("not connected after Connect: %v", a.Values())
|
|
}
|
|
if err := a.Disconnect(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if a.Wired() {
|
|
t.Fatalf("still connected after Disconnect: %v", a.Values())
|
|
}
|
|
if v := f.Get(); v != "relay/glm-4.6" {
|
|
t.Errorf("Disconnect left %q, not its own relay/glm-4.6", v)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// OpenCode's own provider that sends to magpie's gateway is magpie's all
|
|
// the same (openCodeRef names a model there by it).
|
|
func TestOpenCodeGatewayProviderIsMagpies(t *testing.T) {
|
|
syncHome(t)
|
|
a, err := Find("opencode")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
hanakoWrite(t, a.Path, `{"provider":{"relay":{"options":{"baseURL":"`+gatewayV1()+`"},"models":{"relay/glm-4.6":{}}}},"model":"relay/relay/glm-4.6"}`, 0o644)
|
|
if !a.Wired() {
|
|
t.Fatalf("a model through its own provider at the gateway isn't magpie's: %v (%s)", a.Values(), filepath.Base(a.Path))
|
|
}
|
|
hanakoWrite(t, a.Path, `{"provider":{"relay":{"options":{"baseURL":"https://x/v1"},"models":{"glm-4.6":{}}}},"model":"relay/glm-4.6"}`, 0o644)
|
|
if a.Wired() {
|
|
t.Fatalf("its own relay elsewhere reads as magpie's: %v", a.Values())
|
|
}
|
|
}
|