Files
magpie/internal/gui/assets/icons/jcode.svg
T
yetone 9c11abbd00 agent: jcode is an agent magpie connects: a magpie profile with magpie's models, jcode started on the one picked (wani on Discord)
wani asked on Discord for jcode (1jehuang/jcode, a coding agent in Rust)
as an agent magpie connects. There was no earlier request in issues or
history.

What changed:
- internal/agent/jcode.go: a new agent for jcode's config.toml in
  $JCODE_HOME, else ~/.jcode (jcode-storage's jcode_dir). Detected by the
  file, the folder, or `jcode` on PATH.
  - Connecting adds a named profile, [providers.magpie], with the keys
    `jcode provider add` writes: type "openai-compatible", the gateway's
    /v1, an inline api_key naming jcode (magpie-jcode; jcode's requests
    carry nothing else that tells it apart) and requires_api_key = true.
    Without that key, jcode sends no key to a loopback base URL.
  - Its models list has one entry per model of magpie's: context_window
    (128000 when magpie doesn't know it; jcode would assume 200k), input
    text/image, and reasoning = true for a model with effort levels, so
    jcode's /effort offers them.
  - It sets [provider] default_provider = "magpie" and default_model, the
    model picked. What was there is stashed, and Disconnect puts it back.
  - Picking a model of jcode's own while it is on magpie takes magpie
    out: the profile goes and the user's provider comes back with that
    model.
  - Each key is set alone, so the user's other keys and tables stay, as
    do their own keys in magpie's profile (headers, extra_body) and a
    reasoning_effort they set on one of its models while the model has
    that level.
  - jcode writes a profile's models as [[providers.magpie.models]]
    tables when it rewrites the file itself (Config::save,
    to_string_pretty). Those are replaced by the one list.
  - A sync with nothing to change doesn't write.
  - Disconnect drops the profile whole, sub-tables included.
  - Check says when the profile is gone while jcode still starts on it,
    or when its base_url or key is off.
  - While jcode runs, the notice says to restart open jcode sessions,
    since it reads the file when it starts. The notice is a newNotice
    template, translated in i18n.js (zh-CN, zh-TW, ja, de) and listed in
    NOTICES, as TestEveryNoticeIsTranslated asks.
- agents.go, agentenv.go: registers it; JCODE_HOME joins the agent env.
- icons/jcode.svg: jcode's halftone mark (jcode.sh/favicon.svg) as a
  mask icon, every other dot of its lattice.
- docs/reference.md, docs/subsystems/agent-wiring.md, README.md,
  README.zh-CN.md: jcode's row and its place in the agent list.
- WSL isn't covered: jcodeAt reads the place's home and JCODE_HOME, but
  it isn't added to the WSL agent list (another session has wsl.go open).

What was run:
- go test -tags nogui ./internal/agent -run '^TestJcode'. The fixture is
  the bytes jcode 0.94.0 wrote for `jcode provider add`. The tests went
  red when, by hand, I:
  - made a no-op sync write;
  - dropped the user's reasoning_effort;
  - skipped the stash, so Disconnect wasn't byte-identical;
  - left jcode's [[providers.magpie.models]] tables in, which makes
    invalid TOML;
  - dropped requires_api_key.
- Real use:
  - jcode v0.94.0 (release binary, sha256 checked) ran under a sandbox
    HOME with JCODE_HOME set and JCODE_NO_TELEMETRY=1. Its config.toml
    was the one jcode wrote for its own "probe" profile.
  - A sandbox magpie (MAGPIE_ADDR 127.0.0.1:3671) with a fake OpenAI
    upstream on 3672 ran `magpie jcode magpie/fake/org/echo-1`, a model id
    with two slashes.
  - `jcode run 'Say hello in one word.'` answered with the upstream's
    reply, streamed. The upstream saw model org/echo-1, and usage.jsonl
    recorded the turn under agent "jcode".
  - `jcode provider add two …` while connected appended its own profile
    and left magpie's as it was.
  - `magpie jcode default` then gave back the file jcode wrote,
    byte-identical, with jcode's new [providers.two] kept.
- The icon rendered as a mask in Chromium and WebKit. The only GUI
  change is the notice's translations; TestEveryNoticeIsTranslated and
  internal/gui pass, and node --check accepts i18n.js.
- gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows) on internal/agent
  and internal/agentenv; go test -tags nogui ./internal/agent
  ./internal/agentenv ./internal/gui; go test -tags nogui ./... under a
  temp HOME (load ~80): every package passed. After rebasing on
  origin/main, internal/agent and internal/agentenv were run again,
  along with internal/gui, gofmt and the linux/windows vet.
2026-10-11 04:33:53 +08:00

12 KiB