f2eb56c6bbde1300dddc402861b59cd4e45e0215
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c358e76607 |
zcode: on Windows, write where ZCode reads, %HOME% before %USERPROFILE%
Gearclickist on Discord: magpie connects ZCode without an error, but
ZCode on Windows never lists magpie as a provider; on a Mac it does.
ZCode 3.14.3 (the same JS in the Mac and Windows builds, diff -rq of the
extracted app.asar) picks its data folder from setting.json's dataBaseDir,
then ZCODE_DATA_BASE_DIR, then process.env.HOME, and only then
os.homedir() (USERPROFILE). magpie used Go's home, which on Windows is
USERPROFILE. With HOME set (Git Bash, MSYS2, Emacs and the like), ZCode
reads %HOME%\.zcode\v2\provider_config.json and magpie wrote
%USERPROFILE%\.zcode\v2\..., a folder ZCode never opens. On a Mac HOME is
Go's home too, so the two always met.
appdir.ZCodeHome gives %HOME% on Windows when it is set, absolute, and
the folder asked about is USERPROFILE (a folder given on purpose is
kept). The agent target, the ZCode credential and team readers and the
library target use it. ZCode's CLI database stays under USERPROFILE (seen
on Windows below), so the sessions reader is unchanged; its comment says
why.
Run:
- go test ./internal/agent/ -run TestZCode; the new
TestZCodeOnWindowsUsesTheHomeZCodeReads forces zcodeOS=windows with
HOME and USERPROFILE apart. Broken by hand (ZCodeDataIn(home) back in
zcode()): red, "ZCode's folder on Windows with HOME set: .../001/.zcode
... want .../003/.zcode".
- gofmt -l; go vet for darwin, linux (-tags nogui) and windows.
- Windows box, sandbox folders only, HOME and USERPROFILE set apart:
ZCode 3.14.3 for Windows, extracted and started there, kept its logs,
workspace and provider_config.json under HOME\.zcode\v2 and only
cli\db under USERPROFILE. The old magpie.exe's `zcode provider magpie`
wrote profile\.zcode\v2\{config,provider_config}.json (the bug); this
build's wrote home\.zcode\v2\..., beside ZCode's own files, and nothing
under the profile.
- Full suite (go test -timeout 45m ./..., one at a time on the box):
68 packages ok, exit 0, at d87be7f13 and again after rebasing onto
|
||
|
|
41972b25fc |
zcode: magpie's provider reaches a ZCode whose data was moved to another folder in its settings (flower on Discord)
What changed: ZCode 3.14 has a 数据存储路径 (data storage path) setting.
Changing it copies ~/.zcode/v2 to <folder>/.zcode/v2, and from the next
start ZCode reads its providers (provider_config.json, config.json),
credentials.json and runtime/provider from there. The choice stays in the
home folder's .zcode/v2/setting.json as dataBaseDir, which ZCode's main
process reads first (readBootstrapDataBaseDirFromDisk, then setDataBaseDir;
getDataBaseDir is that, else ZCODE_DATA_BASE_DIR, else HOME). magpie always
wrote ~/.zcode/v2, so for such a user it said ZCode was connected while
ZCode's 模型设置 showed only BigModel and Start Plan and no magpie.
appdir.ZCodeDataIn reads dataBaseDir the way ZCode does (trimmed, ignored
when empty or relative); the ZCode agent target, the ZCode subscription's
credentials.json and its zcode-builtin.json glob use it. Skills, AGENTS.md
and the CLI's cli/config.json stay under the home folder: ZCode reads
those from HOME/USERPROFILE (getUserZcodeSkillRoot, the MCP config path),
so internal/library is unchanged. ZCode's session database
(internal/sessions) is not changed here: where ZCode's CLI keeps it under a
moved folder was not checked.
Read from ZCode 3.14.3's app.asar (copied to the scratchpad):
out/main/index.js (bootstrap, setDataBaseDir, buildHostProcessEnv passing
ZCODE_DATA_BASE_DIR), out/host/chunk-*.js (getAppConfigDir =
<base>/.zcode/v2) and out/host/index.js (provider_config.json under it).
flower hasn't said they moved the folder; this is the one way found in
ZCode's code for "magpie says connected, ZCode has no magpie" with a
provider_config.json magpie wrote. That file, and the one this build
writes, decode with ZCode's own decodeProviderConfigFile (run from a copy
of glm/zcode.cjs): providers ["magpie"].
What was run:
- TestZCodeMovedDataFolder (new): with dataBaseDir set, Set("magpie")
writes both files under the moved folder and none in ~/.zcode/v2; an
empty, blank or relative dataBaseDir keeps ~/.zcode. On the old
zcode.go it fails: "no magpie in the moved folder's
provider_config.json".
- Sandbox, built binary: HOME=<sandbox>, setting.json dataBaseDir=<sandbox>/D,
`magpie zcode magpie` wrote D/.zcode/v2/{config,provider_config}.json
and nothing under the home folder's .zcode/v2 but setting.json.
- go test -tags nogui ./internal/agent ./internal/appdir ./internal/provider
under a temp HOME; gofmt -l; GOOS=linux and GOOS=windows go vet -tags
nogui on the three packages.
- Not run: the ZCode app itself with a moved folder (not launched against
any config), and Windows.
|