Files
magpie/internal
yetone dccfefdf72 library: a skill brought in from an app's versioned folder follows the app's updates (#2635)
iomect's ego lite keeps its skill in a framework version folder and
points its own links at the current one:

  ~/.agents/skills/ego-browser -> ~/.local/share/ego/ego-skills
  ~/.local/share/ego/ego-skills -> ~/.local/share/ego/active_version_dir/Resources/ego-skills/ego-browser
  ~/.local/share/ego/active_version_dir -> /Applications/ego lite.app/.../Versions/0.6.0.12
  .../Versions/Current -> 0.6.0.12

ImportSkill linked the library to the fully resolved folder
(Versions/0.5.1.13/...). After the update to 0.6.0.12 the old folder was
still there, so the library and every agent it gives skills to kept the
old skill.

importSkill now links to linkVia(f.at, f.real), and Source.Dir is that
same path. linkVia follows the found entry's links one at a time, and
stops at the first one outside every skills folder (the agents', the
shared ~/.agents/skills and the library's): for ego that is
~/.local/share/ego/ego-skills, which the app keeps pointing at its
current version. A Versions/<v> part is named Versions/Current when
Current is a link to that same version, which covers an entry that links
straight into the versioned folder. If that path doesn't resolve to the
same folder as today, linkVia returns the resolved folder, as before.
Nothing else changes: every comparison of Source.Dir already goes
through realDir.

Tests (skill_version_test.go):
- TestImportedSkillFollowsAppUpdate uses the reporter's layout
  (ego lite.app, ego Framework.framework/Versions, active_version_dir,
  ego-skills, ~/.agents/skills/ego-browser), brings it in at 0.5.1.13,
  then moves the app's links to 0.6.0.12 and checks the library's skill
  is 0.6.0.12's, listed and not missing.
- TestImportedSkillThroughVersionsCurrent does the same with an entry
  linking straight into Versions/0.5.1.13.
- TestImportedSkillPlainLink checks that a link to a plain folder is
  still linked to that folder.

Broken by hand:
- with `via := f.real` (the old link), FollowsAppUpdate and
  ThroughVersionsCurrent went red (the skill stayed "ego 0.5.1.13");
- with the Versions/Current step taken out, ThroughVersionsCurrent went
  red.

Not done: a skill brought in before this keeps its old resolved link
until it is brought in again, or its link in the library is replaced.
No ego install here; the tests use the layout from the reporter's ls.

Run: gofmt -l clean; go vet ./... (darwin), GOOS=linux and GOOS=windows
go vet -tags nogui ./... clean. go test -timeout 45m ./... under
set -o pipefail with a sandbox HOME, load ~280: 65 packages ok
(internal/library 352s), internal/gui red with 8 real-window AppKit tests
killed at their deadlines (#2645). internal/gui doesn't use this code.
It passed alone with the real HOME, with this change (186s at load
~260-341) and on 8bb9375e7 without it (204s at ~300). With the sandbox HOME
it went red again when run alone; the runs are on #2645. No GUI files
touched.

Rebased onto ebf3f48f7, which changes nothing under internal/library or
internal/agent; go build ./... and go test ./internal/library ok there
(697s).
2026-10-17 11:01:48 +08:00
..
…
…
…