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
59 lines
2.3 KiB
Go
59 lines
2.3 KiB
Go
package agent
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/usage"
|
|
)
|
|
|
|
// Every agent's requests are told by what its own description says.
|
|
func TestAgentOf(t *testing.T) {
|
|
cases := map[string]string{
|
|
"claude-cli/2.1.0 (external, cli)": "claude",
|
|
"codex_cli_rs/0.40.0 (Mac OS 26.0; arm64)": "codex",
|
|
"GeminiCLI/0.9.0 (darwin; arm64)": "gemini",
|
|
"opencode/1.2.3": "opencode",
|
|
"mimocode/1.2.3": "mimocode",
|
|
"deveco/0.2.3 ai-sdk/provider-utils/4.0": "deveco", // 0.2.3 sends ai-sdk/provider-utils/4.0.23
|
|
"curl/8.4.0": "curl",
|
|
"oh-my-pi/1.0": "omp",
|
|
"command-code/2.0": "commandcode",
|
|
"deepseek-harness/0.3.1": "dsh",
|
|
"dsh": "dsh", // a record kept by an id already
|
|
"pi": "pi",
|
|
"grok-pager/0.2.1": "grok",
|
|
"ZCode/3.10.1": "zcode",
|
|
"Alma/1.2.0": "alma",
|
|
"HanaAgent/1.0": "hanako",
|
|
"hanako": "hanako", // its key
|
|
"atomcode/5.2.1": "atomcode",
|
|
"cline ai-sdk/openai-compatible/3.0.37": "cline",
|
|
"minimax-code": "minimax-code", // what magpie's entry sends
|
|
"MiniMaxCode": "minimax-code", // 0.6.8's own (#1605)
|
|
"": "other",
|
|
}
|
|
for ua, want := range cases {
|
|
if got := usage.AgentOf(ua); got != want {
|
|
t.Errorf("%q: got %q want %q", ua, got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
// Every agent's own gateway key (gateway.TokenFor) names it in usage: the
|
|
// ones that send no User-Agent of their own (StepCode, jcode, Prime Agent,
|
|
// Snow…) are told by that key alone (#1605's check of the class).
|
|
func TestEveryAgentNamedByItsKey(t *testing.T) {
|
|
seen := map[string]bool{}
|
|
for _, a := range Clients() {
|
|
seen[a.ID] = true
|
|
if got := usage.AgentOf(a.ID); got != a.ID {
|
|
t.Errorf("%s's key names %q", a.ID, got)
|
|
}
|
|
}
|
|
for _, id := range []string{"minimax-code", "stepcode", "jcode", "prime-agent", "snow", "deveco"} {
|
|
if !seen[id] {
|
|
t.Errorf("%s isn't among the agents usage knows", id)
|
|
}
|
|
}
|
|
}
|